Switching leader traits

Mortac

Warlord
Joined
Aug 15, 2006
Messages
177
Location
Karlskrona, Sweden
I checked a few pages back but couldn't find anything about this.

Basically what I want to do is to copy a leader trait to another leader. I want to do this because I much prefer to play a specific civ, but I hate the trait it has. Thus, if I could simply copy the trait I want from another civ to the one I want to play, it'd make me a happy man! :)

Also, since I would be playing that civ myself, it wouldn't interfere with the AI in any way.

I tried switching the leader trait line in Civilization V/assets/DLC/Expansion/Gameplay/XML/Leaders, but that appears to merely change the tooltip and has no actual impact other than that.

Could anyone guide me on how to do this? I haven't really played around with LUA before, but I assume I will have to if I'm to get this done.
 
You shouldn't need lua to do this. If for example you wanted Attila to have Ghandi's trait you would write the following:

Spoiler :
Code:
<GameData>
	<Leader_Traits>
		<Update>
			<Where LeaderType = LEADER_ATTILA/>
			<Set TraitType = TRAIT_POPULATION_GROWTH/>
		</Update>
	</Leader_Traits>
</GameData>

Name the xml file something other than the base file (make sure to 'save as' in the mod folder you are using). Then do the onmodactivated in the properties -> action portion of your mod.
 
On a related note, is it possible to switch traits during play, using Lua?
 
Thanks for the help, Evalis. I've managed to create a mod and have it showing up in the mod list, however, the mod doesn't seem to work. I added what you listed in the XML-file, but it doesn't seem to have any effect in game.

I figured the easiest way to test if it's working or not was to use Attilas trait, since it gives a free tech right at the start. I tried to give that trait to Gustavus Adolphus. So what I have so far are two files placed in a folder in the mod directory: leadertraitsmod.modinfo and leadertraitschanges.xml. Check the spoiler tags for the code I'm using (the part I didn't get from you I got from a modding tutorial):

Spoiler :
<?xml version="1.0" encoding="utf-8"?>
<Mod id="1450dc65-5d97-43ae-b724-335a0d41bca4" version="1">
<Properties>
<Name>Change Leader Traits</Name>
<Stability>Alpha</Stability>
<Description>Changes leader traits</Description>
<Authors>Mortac</Authors>
<SpecialThanks>Firaxis</SpecialThanks>
<Homepage>http://www.civfanatics.com</Homepage>
<AffectsSavedGames>1</AffectsSavedGames>
<MinCompatibleSaveVersion>0</MinCompatibleSaveVersion>
<SupportsSinglePlayer>1</SupportsSinglePlayer>
<SupportsMultiplayer>1</SupportsMultiplayer>
<SupportsMac>1</SupportsMac>
<ReloadLandmarkSystem>0</ReloadLandmarkSystem>
<ReloadUnitSystem>0</ReloadUnitSystem>
</Properties>
<Dependencies />
<References />
<Blocks />
<Files>
<File md5="e4e35066a2f632d955915f1a9c44d62a">leadertraitschanges.xml</File>
</Files>
<EntryPoints>
</EntryPoints>
<Actions>
<OnModActivated>
<UpdateDatabase>leadertraitschanges.xml</UpdateDatabase>
</OnModActivated>
</Actions>
</Mod>


For some reason it looks as if there's a space in one of the filenames, but there isn't I assure you. The forums appear to put that space there for some reason (leadertrait schanges.xml).

Spoiler :

<GameData>
<Leader_Traits>
<Update>
<Where LeaderType = LEADER_GUSTAVUS_ADOLPHUS/>
<Set TraitType = TRAIT_RAZE_AND_HORSES/>
</Update>
</Leader_Traits>
</GameData>


What am I doing wrong?
 
You aren't doing anything wrong. The free tech is associated with the civilization under <Civilization_FreeTechs> and is specific to the huns, not the trait. Try this with ghandi's trait - the reason I mentioned it is that it is testable right from the start of the game by hovering over your happy bar. If you are specifically trying to add another tech to a civilization use:

Spoiler :
Code:
<Civilization_FreeTechs>
	<Row>
	        <CivilizationType>CIVILIZATION_SWEDEN</CivilizationType>
	        <TechType>TECH_ANIMAL_HUSBANDRY</TechType>
	</Row>
</Civilization_FreeTechs>

Use <row> rather than <update> for this as we are adding rather than changing something. Also you can clean up your display by going 'advanced' and using the 'code' (#) button after highlighting the text.
 
Did you remember to do 'onmodactivated' in your properties section? Right click on your mod file (the one with the V and hammer under the solution) and right click properties.

This will load a screen with 5 tabs. Choose the 'actions' tab and then 'add' choose onmodactivated, updatedatabase and then the file name. If your file does not appear make sure the it is both loaded into the mod and on your tab panel at the top. Also ensure that it is saved into the directory you are using for this mod. Make sure to 'save all' and choose 'build' 'build solution' at the top program options.

If it -still- does not work, check your code for any extraneous characters.
 
Oh I was actually doing everything in notepad. I thought the lines...

<OnModActivated>
<UpdateDatabase>leadertraitschanges.xml</UpdateDatabase>
</OnModActivated>

... would be enough. I'll look into using a mod editor instead.
 
Whoopsie.. ugh I forgot the quotation marks! You need to put quotes around "Leader_Attila" and "Trait_Population_growth" or whatever it is you are using. oy oy. Sorry about that =x
 
Oh heck yeah, it's working now! :D Thanks a bunch!

I've probably bothered you enough, but if it's simple and you have the time to answer this, what would I write if I wanted to switch the unique units and/or buildings to that of another civ as well?

If I manage to do this I might actually put a tiny mod up for people that are like me; prefer to play certain civs but want another civ's traits. Of course, I'd credit you for it since you basically created it lol.
 
CIV5Civilizations.xml has Civilization_BuildingClassOverrides and Civilization_UnitClassOverrides. By altering those you can grant/remove unique buildings and units from civilizations.
 
As machievelli indicated you will want to look at the civilizations.xml file for the units/buildings you want to replace. In the event the civ you are editing has an equal number of units and buildings you can use the update tags. In the event there is an uneven number of these things (very likely) you will need to delete the entries. To do so make sure you find the proper reference name for the object you wish to remove then write code similar to this:

Spoiler :
Code:
<GameData>
	<Civilization_UnitClassOverrides>
		<Delete UnitType ="UNIT_HUN_HORSE_ARCHER"/>
		<Delete UnitType ="UNIT_HUN_BATTERING_RAM"/>
	</Civilization_UnitClassOverrides>
</GameData>

Deleting these entries should not have adverse affects on the game (other than now inccorrect text in the civilopedia) but the selection screen will not work properly until you add in two overrides to match. Code is the same as adding anything else into the game. An example of such is as follows:

Spoiler :
Code:
<GameData>
	<Civilization_BuildingClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_HUNS</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_MONUMENT</BuildingClassType>
			<BuildingType>BUILDING_STELE</BuildingType>
		</Row>
		<Row>
			<CivilizationType>CIVILIZATION_HUNS</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_SHRINE</BuildingClassType>
			<BuildingType>BUILDING_MAYA_PYRAMID</BuildingType>
		</Row>
	</Civilization_BuildingClassOverrides>
</GameData>

Both buildings and units are added/removed the same way using the appropriate override heading.
 
Hi, i am wanting to do something similar to what Mortac was wanting to do except i want to add the abilities of two other civs to one. However i am finding that xml isnt doing the job. I have set the "onmodactivated" "updatedatabase" in modbuddy. could i just get a finger pointed at what i am doing wrong? ive tried just adding the edits to the original trait itself and have finally just attempted to create a custom trait. heres what i have.

Spoiler :

<GameData>
<Traits>
<Row>
<Type>TRAIT_MELTING_POT</Type>
<Description>TXT_KEY_TRAIT_MELTING_POT</Description>
<ShortDescription>TXT_KEY_TRAIT_MELTING_POT_SHORT</ShortDescription>
<PlotBuyCostModifier>-50</PlotBuyCostModifier>
<CityStateFriendshipModifier>100</CityStateFriendshipModifier>
<BonusReligiousBelief>true</BonusReligiousBelief>
</Row>
</Traits>
</GameData>
<GameData>
<Leader_Traits>
<Update>
<where LeaderType="LEADER_WASHINGTON"/>
<set>
<TraitType>TRAIT_MELTING_POT</TraitType>
</set>
</Update>
</Leader_Traits>
</GameData>


or am i gonna need to figure out LUA? i am new to all this stuff.
 
Back
Top Bottom