XML Tutorial Part 3

BrentRitchie

Chieftain
Joined
Oct 30, 2005
Messages
25
Ok, In the last two tutorials we defined a new civilization, and then gave it context through the text info's. Now it's time to take the dive and play with the AI of the governing Leader. I picked John A Macdonald for this because he was canada's first prime minister, and he did the impossible by uniting Upper Canada, Lower Canada, and the maritimes to create the federation of Canada. Really cool guy. So now we have to tell the game about John Macdonald so that it knows how to play as him. Again the comments are inlined and at the end we do some more work with the text info's (Woohoo).

<!-- This decalares the root element and that we have to use the right schema -->
<!-- Working with schema's can be a pain if your not used to them. Most errors come from typos -->
<Civ4LeaderHeadInfos xmlns="x-schema:CIV4CivilizationsSchema.xml">

<-- This start the list of leader heads -->
<LeaderHeadInfos>

<!-- This is the start of a new leaderhead -->
<LeaderHeadInfo>

<!-- This tag is a definition of our new leaderhead, you can call it whatever you want -->
<!-- I suggest you keep to the naming scheme because it makes it easier to refrence your leaderhead. -->
<Type>LEADER_JOHN_MACDONALD</Type>

<!-- This is the long description tag -->
<!-- Remember the purpose of the text info's files? Thats reight we have to translate his name into different languages -->
<!-- We have to go back to the textinfo's file for this so we'll do it at the end of the tutorial -->
<Description>TXT_KEY_LEADER_JOHN_MACDONALD</Description>

<!-- This is the civilopedia entry for our Leader. Again we have to go back to the text info's files -->
<!-- We will do this at the end of the tutorial -->
<Civilopedia>TXT_KEY_LEADER_JOHN_MACDONALD_PEDIA</Civilopedia>

<!-- This defines the actual leader head that shows up in the trade screnn and such -->
<!-- Although I am using the Cyrus leaderhead I will show how to modify this later -->
<!-- And yes this is also in another file. -->
<ArtDefineTag>ART_DEF_LEADER_CYRUS</ArtDefineTag>

<!-- Ok this is the first of the AI definitions -->
<!-- I will try to fill in as many as I can but some are hard to figure out -->
<!-- If I don't know what a tag does I will simply put ???? in the comments. -->
<!-- If I have a guess it will look like ??My guess?? -->
<!-- When I figure it out then I will edit this tutorial. -->

<!-- ??When deciding to build city improvements wonders will be weighted by this number?? -->
<iWonderConstructRand>0</iWonderConstructRand>

<-- ??What the leaders normal attitude is towards everyone?? -->
<iBaseAttitude>0</iBaseAttitude>

<!-- ??How much the leader likes peace?? -->
<iBasePeaceWeight>0</iBasePeaceWeight>

<!-- ???? -->
<iPeaceWeightRand>0</iPeaceWeightRand>

<!-- ??If you are in a war this civ will be easy to persuade to join you?? -->
<iWarmongerRespect>0</iWarmongerRespect>

<!-- ??How close to the brink of war you have to be to stop talking?? -->
<iRefuseToTalkWarThreshold>0</iRefuseToTalkWarThreshold>

<!-- ???? -->
<iNoTechTradeThreshold>0</iNoTechTradeThreshold>

<!-- ???? -->
<iTechTradeKnownPercent>0</iTechTradeKnownPercent>

<!-- The maximum amount of the leaders total gold he is willing to trade -->
<iMaxGoldTradePercent>0</iMaxGoldTradePercent>

<!-- The maximum amount of the leaders total gold he is willing to trade per turn -->
<iMaxGoldPerTurnTradePercent>0</iMaxGoldPerTurnTradePercent>

<!-- ???? -->
<iMaxWarRand>0</iMaxWarRand>

<!-- ???? -->
<iMaxWarNearbyPowerRatio>0</iMaxWarNearbyPowerRatio>

<!-- ???? -->
<iMaxWarDistantPowerRatio>0</iMaxWarDistantPowerRatio>

<!-- ???? -->
<iMaxWarMinAdjacentLandPercent>0</iMaxWarMinAdjacentLandPercent>

<!-- ???? -->
<iLimitedWarRand>0</iLimitedWarRand>

<!-- ???? -->
<iLimitedWarPowerRatio>0</iLimitedWarPowerRatio>

<!-- ???? -->
<iDogpileWarRand>0</iDogpileWarRand>

<!-- ???? -->
<iMakePeaceRand>0</iMakePeaceRand>

<!-- ???? -->
<iDeclareWarTradeRand>0</iDeclareWarTradeRand>

<!-- ???? -->
<iDemandRebukedSneakProb>0</iDemandRebukedSneakProb>

<!-- ???? -->
<iDemandRebukedWarProb>0</iDemandRebukedWarProb>

<!-- How often the leader will raze a city -->
<iRazeCityProb>0</iRazeCityProb>

<!-- ???? -->
<iBuildUnitProb>0</iBuildUnitProb>

<!-- ???? -->
<iBaseAttackOddsChange>0</iBaseAttackOddsChange>

<!-- ???? -->
<iAttackOddsChangeRand>0</iAttackOddsChangeRand>

<!-- ??How much the leaders attitude will change if he has a higher score?? -->
<iWorseRankDifferenceAttitudeChange>0</iWorseRankDifferenceAttitudeChange>

<!-- ??How much the leaders attitude will change if he has a lower score?? -->
<iBetterRankDifferenceAttitudeChange>0</iBetterRankDifferenceAttitudeChange>

<!-- ??How much the leaders attitude will change if he has not negotiated open borders?? -->
<iCloseBordersAttitudeChange>0</iCloseBordersAttitudeChange>

<!-- ??How much the leaders attitude will change if he loses a war?? -->
<iLostWarAttitudeChange>0</iLostWarAttitudeChange>

<!-- ???? -->
<iAtWarAttitudeDivisor>0</iAtWarAttitudeDivisor>

<!-- ???? -->
<iAtWarAttitudeChangeLimit>0</iAtWarAttitudeChangeLimit>

<!-- ???? -->
<iAtPeaceAttitudeDivisor>0</iAtPeaceAttitudeDivisor>

<!-- ???? -->
<iAtPeaceAttitudeChangeLimit>0</iAtPeaceAttitudeChangeLimit>

<!-- ??How much the leaders attitude will change if another civ shares the same religion?? -->
<iSameReligionAttitudeChange>0</iSameReligionAttitudeChange>

<!-- ???? -->
<iSameReligionAttitudeDivisor>0</iSameReligionAttitudeDivisor>

<!-- ???? -->
<iSameReligionAttitudeChangeLimit>0</iSameReligionAttitudeChangeLimit>

<!-- How much the leaders attitude will change if another civ shares the same religion?? -->
<iDifferentReligionAttitudeChange>0</iDifferentReligionAttitudeChange>

<!-- ???? -->
<iDifferentReligionAttitudeDivisor>0</iDifferentReligionAttitudeDivisor>

<!-- ???? -->
<iDifferentReligionAttitudeChangeLimit>0</iDifferentReligionAttitudeChangeLimit>

<!-- ???? -->
<iBonusTradeAttitudeDivisor>0</iBonusTradeAttitudeDivisor>

<!-- ???? -->
<iBonusTradeAttitudeChangeLimit>0</iBonusTradeAttitudeChangeLimit>

<!-- ???? -->
<iOpenBordersAttitudeDivisor>0</iOpenBordersAttitudeDivisor>

<!-- ???? -->
<iOpenBordersAttitudeChangeLimit>0</iOpenBordersAttitudeChangeLimit>

<!-- ???? -->
<iDefensivePactAttitudeDivisor>0</iDefensivePactAttitudeDivisor>

<!-- ???? -->
<iDefensivePactAttitudeChangeLimit>0</iDefensivePactAttitudeChangeLimit>

<!-- ??How much the leaders attitude will change if they and another civ are fighting the same enemy?? -->
<iShareWarAttitudeChange>0</iShareWarAttitudeChange>

<!-- ???? -->
<iShareWarAttitudeDivisor>0</iShareWarAttitudeDivisor>

<!-- ???? -->
<iShareWarAttitudeChangeLimit>0</iShareWarAttitudeChangeLimit>

<!-- ??How much their attitude will change if another civ has adopted the same civics?? -->
<iFavoriteCivicAttitudeChange>0</iFavoriteCivicAttitudeChange>

<!-- ???? -->
<iFavoriteCivicAttitudeDivisor>0</iFavoriteCivicAttitudeDivisor>

<!-- ???? -->
<iFavoriteCivicAttitudeChangeLimit>0</iFavoriteCivicAttitudeChangeLimit>

<!-- ??What thier attitude is towards another civ before they demand tribute?? -->
<DemandTributeAttitudeThreshold>ATTITUDE_CAUTIOUS</DemandTributeAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to give help?? -->
<NoGiveHelpAttitudeThreshold>ATTITUDE_CAUTIOUS</NoGiveHelpAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to trade technology?? -->
<TechRefuseAttitudeThreshold>ATTITUDE_ANNOYED</TechRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to trade strategic resources?? -->
<StrategicBonusRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</StrategicBonusRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to trade for resources that cause happiness?? -->
<HappinessBonusRefuseAttitudeThreshold>ATTITUDE_FURIOUS</HappinessBonusRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to trade resources that increase city health?? -->
<HealthBonusRefuseAttitudeThreshold>ATTITUDE_ANNOYED</HealthBonusRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to trade maps?? -->
<MapRefuseAttitudeThreshold>ATTITUDE_PLEASED</MapRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to declare war for another civ?? -->
<DeclareWarRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</DeclareWarRefuseAttitudeThreshold>

<!-- ???? -->
<DeclareWarThemRefuseAttitudeThreshold>ATTITUDE_PLEASED</DeclareWarThemRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to stop trading with another civ?? -->
<StopTradingRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</StopTradingRefuseAttitudeThreshold>

<!-- ???? -->
<StopTradingThemRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</StopTradingThemRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to adopt a different civic?? -->
<AdoptCivicRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</AdoptCivicRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse to convert religions?? -->
<ConvertReligionRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</ConvertReligionRefuseAttitudeThreshold>

??What thier attitude is towards another civ before they refuse an open border agreement?? -->
<OpenBordersRefuseAttitudeThreshold>ATTITUDE_ANNOYED</OpenBordersRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse a defensive pact?? -->
<DefensivePactRefuseAttitudeThreshold>ATTITUDE_PLEASED</DefensivePactRefuseAttitudeThreshold>

<!-- ??What thier attitude is towards another civ before they refuse a permanent alliance?? -->
<PermanentAllianceRefuseAttitudeThreshold>ATTITUDE_PLEASED</PermanentAllianceRefuseAttitudeThreshold>

<!-- This defines the leaders civic prefrences -->
<FavoriteCivic>CIVIC_REPRESENTATION</FavoriteCivic>

<!-- start listing the leaders traits -->
<Traits>

<!-- New trait for our Leader -->
<Trait>

<!-- This tells us the trait we want to give our leader -->
<TraitType>TRAIT_EXPANSIVE</TraitType>

<!-- ???? -->
<bTrait>1</bTrait>

<!-- Finished giving this trait -->
</Trait>

<!-- Start a new trait for our leader -->
<Trait>

<!-- The rest is the same as above -->
<TraitType>TRAIT_CREATIVE</TraitType>
<bTrait>1</bTrait>
</Trait>

<!-- Finish listing our Leaders traits -->
</Traits>

<!-- Add some flavors to our Leader -->
<!-- This section is wierd. I know what this section is doing I'm just not sure the impact flavors have on our Leader -->
<Flavors>

<!-- Start adding a new flavor -->
<Flavor>

<!-- Tell the game which flavor specifically we want added -->
<FlavorType>FLAVOR_GROWTH</FlavorType>

<!-- ??Some type of weight added to the flavor?? -->
<iFlavor>5</iFlavor>

<!-- Finished with our first flavor -->
</Flavor>
<Flavor>
<FlavorType>FLAVOR_CULTURE</FlavorType>
<iFlavor>2</iFlavor>
</Flavor>

<!-- Finished defining all flavors for our leader -->
</Flavors>

<!-- This is where the files start to get cryptic -->
<!-- Most of these are self explanatory but I have found descrepencies while playing -->
<!-- This section deals with when a civilization will contact you -->
<!-- This section and the next are highly intertwined here is the formula that I believe they use -->
<!-- ContactDelay +- (0 -> ContactRand) -->
<!-- What this means is that when a condition turns true a civ will wait the amount of turns in ContactDelay and randomly add or subtract a number between 0 and ContactRand -->
<!-- This equation gives a feeling of randomness but with purpose -->
<!-- The contact type are the conditions that must be true -->
<ContactRands>

<!-- Openeing tag of ContactRand -->
<ContactRand>

<!-- Tells which leader head variable you are working with -->
<ContactType>CONTACT_RELIGION_PRESSURE</ContactType>

<!-- The actual value of that variable -->
<iContactRand>0</iContactRand>

<!-- Closing tag of ContactRand -->
</ContactRand>

<!-- I am not going to go through each one as that would be pointless -->
<!-- I feel that all of these variables are expressive enough -->

<ContactRand>
<ContactType>CONTACT_CIVIC_PRESSURE</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_JOIN_WAR</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_STOP_TRADING</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_GIVE_HELP</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_ASK_FOR_HELP</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_DEMAND_TRIBUTE</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_OPEN_BORDERS</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_DEFENSIVE_PACT</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_PERMANENT_ALLIANCE</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_PEACE_TREATY</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_TRADE_TECH</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_TRADE_BONUS</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>
<ContactRand>
<ContactType>CONTACT_TRADE_MAP</ContactType>
<iContactRand>0</iContactRand>
</ContactRand>

<!-- Closing tag of Contact Rand -->
</ContactRands>
 
<!-- See above this section is identical to the last -->
<ContactDelays>
<ContactDelay>
<ContactType>CONTACT_RELIGION_PRESSURE</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_CIVIC_PRESSURE</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_JOIN_WAR</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_STOP_TRADING</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_GIVE_HELP</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_ASK_FOR_HELP</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_DEMAND_TRIBUTE</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_OPEN_BORDERS</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_DEFENSIVE_PACT</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_PERMANENT_ALLIANCE</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_PEACE_TREATY</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_TRADE_TECH</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_TRADE_BONUS</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
<ContactDelay>
<ContactType>CONTACT_TRADE_MAP</ContactType>
<iContactDelay>0</iContactDelay>
</ContactDelay>
</ContactDelays>

<!-- This section tells you how long the AI will remember something that another civ did that affects it -->
<!-- These values do not only apply to the human opponents but ALL opponents. That is why civ's seem to actually evolve relationships -->
<!-- I believe that all the great relationship AI comes from this section mainly -->
<MemoryDecays>

<!-- Begin the MemoryDecay section -->
<MemoryDecay>

<!-- This tells which event will decay -->
<MemoryType>MEMORY_GIVE_HELP</MemoryType>

<!-- This is in turns after so many turns the oldest event in memory is erased -->
<iMemoryRand>0</iMemoryRand>

<!-- Finished with this memory -->
<!-- I am not going to go through all of these but there a are a few to note so I will do those only -->
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_REFUSED_HELP</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_ACCEPT_DEMAND</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_REJECTED_DEMAND</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>

<!-- even when set to zero the leaderhead will always remember at least four turns -->
<MemoryType>MEMORY_ACCEPTED_RELIGION</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_DENIED_RELIGION</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_ACCEPTED_CIVIC</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_DENIED_CIVIC</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_ACCEPTED_JOIN_WAR</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_DENIED_JOIN_WAR</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_ACCEPTED_STOP_TRADING</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_DENIED_STOP_TRADING</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_STOPPED_TRADING_RECENT</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_MADE_DEMAND_RECENT</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_CANCELLED_OPEN_BORDERS</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>

<!-- even when set to zero the leaderhead will always remember at least four turns -->
<MemoryType>MEMORY_TRADED_TECH_TO_US</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
<MemoryDecay>
<MemoryType>MEMORY_RECEIVED_TECH_FROM_ANY</MemoryType>
<iMemoryRand>0</iMemoryRand>
</MemoryDecay>
</MemoryDecays>

<!-- I have no idea what this section is for. I have did testing and still no idea -->
<!-- Anyone with AI testing experience care to explain this? -->
<MemoryAttitudePercents>
<MemoryAttitudePercent>
<MemoryType>MEMORY_DECLARED_WAR</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_DECLARED_WAR_ON_FRIEND</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_HIRED_WAR_ALLY</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_NUKED_US</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_NUKED_FRIEND</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_RAZED_CITY</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_RAZED_HOLY_CITY</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_SPY_CAUGHT</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_GIVE_HELP</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_REFUSED_HELP</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_ACCEPT_DEMAND</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_REJECTED_DEMAND</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_ACCEPTED_RELIGION</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_DENIED_RELIGION</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_ACCEPTED_CIVIC</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_DENIED_CIVIC</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_DENIED_JOIN_WAR</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_ACCEPTED_STOP_TRADING</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_DENIED_STOP_TRADING</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_STOPPED_TRADING</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_HIRED_TRADE_EMBARGO</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_MADE_DEMAND</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
<MemoryAttitudePercent>
<MemoryType>MEMORY_TRADED_TECH_TO_US</MemoryType>
<iMemoryAttitudePercent>0</iMemoryAttitudePercent>
</MemoryAttitudePercent>
</MemoryAttitudePercents>

<!-- This section is beyond me, Someone care to take a stab at it? -->
<NoWarAttitudeProbs>
<NoWarAttitudeProb>
<AttitudeType>ATTITUDE_ANNOYED</AttitudeType>
<iNoWarProb>0</iNoWarProb>
</NoWarAttitudeProb>
<NoWarAttitudeProb>
<AttitudeType>ATTITUDE_CAUTIOUS</AttitudeType>
<iNoWarProb>0</iNoWarProb>
</NoWarAttitudeProb>
<NoWarAttitudeProb>
<AttitudeType>ATTITUDE_PLEASED</AttitudeType>
<iNoWarProb>0</iNoWarProb>
</NoWarAttitudeProb>
<NoWarAttitudeProb>
<AttitudeType>ATTITUDE_FRIENDLY</AttitudeType>
<iNoWarProb>0</iNoWarProb>
</NoWarAttitudeProb>
</NoWarAttitudeProbs>

<!-- This section is beyond me, Someone care to take a stab at it? -->
<UnitAIWeightModifiers>
<UnitAIWeightModifier>
<UnitAIType>UNITAI_COUNTER</UnitAIType>
<iWeightModifier>0</iWeightModifier>
</UnitAIWeightModifier>
</UnitAIWeightModifiers>

<!-- This section is beyond me, Someone care to take a stab at it? -->
<ImprovementWeightModifiers>
<ImprovementWeightModifier>
<ImprovementType>IMPROVEMENT_FARM</ImprovementType>
<iWeightModifier>0</iWeightModifier>
</ImprovementWeightModifier>
<ImprovementWeightModifier>
<ImprovementType>IMPROVEMENT_WINDMILL</ImprovementType>
<iWeightModifier>0</iWeightModifier>
</ImprovementWeightModifier>
</ImprovementWeightModifiers>

<!-- Just in my defense before someone calls me a bumbling idiot -->
<!-- I have never AI tested before so please have pity on me :) -->
<!-- When I do figure these out I will update -->

<!-- Music definition in an AI file?? -->
<!-- Something tells me that the firaxis programmers got lazy ;) -->
<!-- This section is trivial, it just tells which music to play during which era -->
<!-- This section is specificlly the music played in the trade screen during the first few seconds during peace time -->
<!-- apparently there are seven era's -->
<!-- After reading the next sections you might say that this section is incomplete -->
<!-- Your right, because this section happens to use the default music -->
<!-- The defaults are probably defined in some other file I really haven't gotten that far yet -->
<DiplomacyIntroMusicPeace>
<DiploMusicPeaceEra>
<EraType>ERA_ANCIENT</EraType>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_CLASSICAL</EraType>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MEDIEVAL</EraType>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_RENAISSANCE</EraType>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_INDUSTRIAL</EraType>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MODERN</EraType>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_FUTURE</EraType>
</DiploMusicPeaceEra>
</DiplomacyIntroMusicPeace>

<!-- Music played after the intro music during peace time -->
<DiplomacyMusicPeace>
<DiploMusicPeaceEra>

<!-- same thing as above -->
<EraType>ERA_ANCIENT</EraType>

<!-- Override the default music played -->
<DiploScriptId>AS2D_DIPLO_CAESAR_EARLY</DiploScriptId>
</DiploMusicPeaceEra>

<!-- I could go on and explain every tag in detail but that would be a waste -->
<!-- I'm about three weeks late with this as it is. -->
<!-- If it's any help these tags all do basically the same thing so just read them and you should be able to figure it out -->

<DiploMusicPeaceEra>
<EraType>ERA_CLASSICAL</EraType>
<DiploScriptId>AS2D_DIPLO_CAESAR_EARLY</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MEDIEVAL</EraType>
<DiploScriptId>AS2D_DIPLO_CAESAR_MIDDLE</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_RENAISSANCE</EraType>
<DiploScriptId>AS2D_DIPLO_CAESAR_MIDDLE</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_INDUSTRIAL</EraType>
<DiploScriptId>AS2D_DIPLO_CAESAR_LATE</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_MODERN</EraType>
<DiploScriptId>AS2D_DIPLO_CAESAR_LATE</DiploScriptId>
</DiploMusicPeaceEra>
<DiploMusicPeaceEra>
<EraType>ERA_FUTURE</EraType>
<DiploScriptId>AS2D_DIPLO_CAESAR_LATE</DiploScriptId>
</DiploMusicPeaceEra>
</DiplomacyMusicPeace>
<DiplomacyIntroMusicWar>
<DiploMusicWarEra>
<EraType>ERA_ANCIENT</EraType>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_CLASSICAL</EraType>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_MEDIEVAL</EraType>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_RENAISSANCE</EraType>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_INDUSTRIAL</EraType>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_MODERN</EraType>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_FUTURE</EraType>
</DiploMusicWarEra>
</DiplomacyIntroMusicWar>
<DiplomacyMusicWar>
<DiploMusicWarEra>
<EraType>ERA_ANCIENT</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_EARLY</DiploScriptId>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_CLASSICAL</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_EARLY</DiploScriptId>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_MEDIEVAL</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_MIDDLE</DiploScriptId>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_RENAISSANCE</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_MIDDLE</DiploScriptId>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_INDUSTRIAL</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_LATE</DiploScriptId>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_MODERN</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_LATE</DiploScriptId>
</DiploMusicWarEra>
<DiploMusicWarEra>
<EraType>ERA_FUTURE</EraType>
<DiploScriptId>AS2D_DIPLO_WARDRUMS_LATE</DiploScriptId>
</DiploMusicWarEra>
</DiplomacyMusicWar>
</LeaderHeadInfo>
</LeaderHeadInfos>
</Civ4LeaderHeadInfos>


Ok, Now just to wet your appetite, the graphics files are found in the art0.fpk file. But if you want to add your own they go into the CustomAssets\art folder. The file that that you must extract is civics_civilizations_religions_atlas.dds. So for the next tuorial you must go get the Gimp, DDS Convertor 2, and the pak file extractor from firaxis. Use the gimp to create your civ's flag and use dds convertor 2 to create a dds file. If your brave try and edit the CIV4CivilizationInfos.xml file to add your flag. So untill next time (Which won't be so long hopefully). Have fun!!!!
 
That was long. Any way I am working on part 4 and hopefully it will be done sometime this week.

Part 3 Is far from done completely. I will add things as I try to keep testing the AI. But AI testing is long. It involves playing this game forever and taking detailed notes each and every turn. If someone else is also testing the AI maybe some pointers for me?
 
Great stuff. Looking forward to part 4 as I have tried to put my own leaderhead still pic in and it didn't want to work. There are certain NIF values that I don't know what to do with.
 
Looking forward to part 4 as I have tried to put my own leaderhead still pic in and it didn't want to work

I have not yet looked at the code, I've been very busy lately, else I'de tell you exactly, but here's a suggestion to point you in the right direction:

The Desert War Mod that comes with the game (WW2 in Africa) has each of the civs with their own still picture leaderhead. Looking at the XML coding there should give you an idea of what is necessary.

Thanks again Brent Richie for your help. What is needed now is leaderhead graphic customization tutorial. UU should be pretty easy from looking at the code. I have already coded my flag and civ button, leader button without difficulty.
 
Ok can someone quickly explain what is going on in this XML, what the NIF and KFM files actually do and any other info useful.

This extract is taken from the Desert War Civ4ArtDefines_Leaderhead.xml file,

Code:
<LeaderheadArtInfo>
	<Type>ART_DEF_LEADER_LOUIS_XIV</Type>
	<Button>art/interface/LeaderHeads/Btn_LH_FreeFr_Degaulle.dds</Button>
	<NIF>art/LeaderHeads/degaulle.dds</NIF>
	<KFM>art/LeaderHeads/Louis_XIV/louis_xiv.kfm</KFM>
	<NoShaderNIF>art/LeaderHeads/Louis_XIV/louis_xiv.nif</NoShaderNIF>
	<BackgroundKFM>art/LeaderHeads/Louis_XIV/louis_xiv_BG.kfm</BackgroundKFM>
</LeaderheadArtInfo>

I understand the DDS files but what do the NIF and KFM files actually do and does it matter which existing ones I use with my own DDS leaderheads?

Thanks alot.
 
These tutorials deserve stickies. Great Job! :goodjob: :goodjob: I'm a complete noob when it comes to modding, but i'll give it a try.
 
These are 25 pages in a word document
 
Looking at those codes.

Has anyone figured out how to get the civs leaders to continue to want to fight a war, continiously?

Thanks. This helped a bit.
 
OK, I tried this, but where can I add the leader's diplo text, because, there is no text...?
 
Caesium said:
OK, I tried this, but where can I add the leader's diplo text, because, there is no text...?
edit XML/GameInfo/CIV4DiplomacyInfos.xml adding your leader.
If it doesn't work (need more help) let me know.
English isn't my first language, hope you can understand me.
 
hi, im new to modding so i have a little question, before i say the question let me get some things straight, i have the warlord expansion pack and i currently use it and when i open the file it doesnt show the leaders from that expansion pack. My question is when i try to save it, it says: Cannot create ...program...file, make sure the file name or path is correct. So can anyone help me with this please?!?
 
Just thought I'd add here that these number variable personality traits for the leaders look like they are multiplier or addition variables for the purposes of the AI's decision calculations. The # limits are presumably not so finite, but the effect of the number will vary based on the scale of the other numbers involved in the equation. Obviously it is a part of a larger calculation whereby the multiplier decides if the event occurs or does not occur based on the situational data that goes into the equation.

<iPeaceWeightRand>0</iPeaceWeightRand>
Is likely a value for weighing random desire for peace. A high value should make for a quite forgiving civ.

<iNoTechTradeThreshold>0</iNoTechTradeThreshold>
Is a multiplier to decide how much this AI likes trading technology.

<iTechTradeKnownPercent>0</iTechTradeKnownPercent>
this is a percentile so 100 would be a max...
I think it is a variable for how well known a Tech must be before trading, but I can't be sure.

It would be nice to build an index of these definitions if people want to chime in perhaps. I may come back and look at it but I'm on a mission to get modding quick.
 
Hello, everyone. I've been modding Civ4 a little for myself, just for fun, and I actually created this account so that I could find parts 2 and 3 of the tutorial.

I like this guide very, very much, and feel that it would add to the discussion if I were to post links to its other parts, as they are difficult to find without the search function, and they're meant to be done together.

Part 1:
http://forums.civfanatics.com/showthread.php?t=135459

Part 2:
http://forums.civfanatics.com/showthread.php?t=135535

Part 3:
http://forums.civfanatics.com/showthread.php?t=141182

There was supposed to be a part 4, however, I believe that he abandoned the project, unfortunately. I believe all that was left to do were graphics things, which I believe have been covered elsewhere, by others. (If you're reading this, OP, you have done GREAT work here, and I would love to hear more if you're still playing Sid Meier games! You are an amazing teacher.)
 
Back
Top Bottom