Modifying Caesar's trait

Voidbane

Chieftain
Joined
Sep 18, 2013
Messages
4
Basically I have 0 knowledge about coding, but I want to add more effects to Rome's trait, such as all units starting with medic I and cover I, as well as incorporating Montezuma and Napoleon's unique abilities.
After struggling a bit, I came up with this:
Spoiler :
<GameData>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<CultureFromKills>100</CultureFromKills>
</Set>
</Update>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<CityCultureBonus>5</CityCultureBonus>
</Set>
</Update>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
<PromotionType>PROMOTION_COVER_1</PromotionType>

</Set>
</Update>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
<promotionType>PROMOTION_MEDIC_1</promotionType>
<update>
<Where Type="Trait_CAPITAL_BUILDINGS_CHEAPER"/>
<set>
<Type>ROUTE_ROAD</Type>
<Description>TXT_KEY_ROUTE_ROAD</Description>
<Value>1</Value>
<AdvancedStartCost>12</AdvancedStartCost>
<Movement>30</Movement>
<FlatMovement>30</FlatMovement>
<GoldMaintenance>0</GoldMaintenance>
</set>
</update>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<RouteType>ROUTE_ROAD</RouteType>
<TechType>TECH_MACHINERY</TechType>
<MovementChange>-30</MovementChange>
</Set>
</Update>
</GameData>


Obviously it doesn't work, but I don't understand why. Could anyone tell me what I've done wrong?
Also I would like to know if its possible to also make every Roman ground melee unit build roads and forts like the Legion.
 
Firstly, your XML isn't actually doing anything to anything.

Let's take the first section. You have:
Code:
GameData>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<CultureFromKills>100</CultureFromKills>
</Set>
</Update>

The problem here is you haven't pointed to the table that is to be UPDATED.
GAMEDATA is the database name inside of which there exist many, many tables.
Inside those tables are the columns that define what is contained and the rows which contain the specific data.

So.
Code:
<GameData>     [COLOR="Blue"]*The name of the database*[/COLOR]
  <Traits>     [COLOR="blue"]*The name of the table*[/COLOR]
    <Update>     [COLOR="blue"]*The command to modify the table*[/COLOR]
      <Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>      [COLOR="blue"]*The row to look for inside the table*[/COLOR]
      <Set CultureFromKills="100" />     [COLOR="blue"]*The column and value to change*[/COLOR]
    </Update>
  </Traits>
</GameData>

To modify any value, you first know in which table the value resides and what column to modify within that table.

You have Rome's trait correct but not all the values you are trying to change reside in the same table.
eg. It looks like you are trying to give the PROMOTION_MEDIC_1 to all UNITCOMBAT_MELEE type units that have the Roman trait.

Your logic is good, but wrong. :D

To give all units of a specific type a particular promotion the table 'Trait_FreePromotionUnitCombats' will need to be modified. Likewise with your other changes. Specific tables for specific tasks.

The whole database Firaxis has set up can at first be rather daunting, if not intimidating. After awhile though it actually makes sense.

Clearly define what goals are required to do what you need to do.
Examine where each task is done by looking at the other examples, like you did with copying Napoleon and Montezuma.
Break the whole job into small parts and implement each part separately to test it.
Lastly, if you don't already have a good text editor, get one. Notepad just won't cut it. IMO
Also a database viewer like SQLiteSpy is handy to see the whole database as it is used.
 
This is what I've got after your advice, still doesn't work.
Spoiler :
<GameData>
<traits>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<CultureFromKills>100</CultureFromKills>
</Set>
</Update>
</traits>
<traits>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<CityCultureBonus>5</CityCultureBonus>
</Set>
</Update>
</traits>
<Trait_FreePromotionUnitCombats>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
<PromotionType>PROMOTION_COVER_1</PromotionType>

</Set>
</Update>
</Trait_FreePromotionUnitCombats>
<Trait_FreePromotionUnitCombats>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
<promotionType>PROMOTION_MEDIC_1</promotionType>
</Set>
</Update>
</Trait_FreePromotionUnitCombats>
<ROUTES>
<update>
<Where Type="Trait_CAPITAL_BUILDINGS_CHEAPER"/>
<set>
<Type>ROUTE_ROAD</Type>
<Description>TXT_KEY_ROUTE_ROAD</Description>
<Value>1</Value>
<AdvancedStartCost>12</AdvancedStartCost>
<Movement>30</Movement>
<FlatMovement>30</FlatMovement>
<GoldMaintenance>0</GoldMaintenance>
</set>
</update>
</ROUTES>
<Route_TECHMOVEMENTCHANGES>
<Update>
<Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>
<Set>
<RouteType>ROUTE_ROAD</RouteType>
<TechType>TECH_MACHINERY</TechType>
<MovementChange>-30</MovementChange>
</Set>
</Update>
</Route_TECHMOVEMENTCHANGES>
</GameData>
 
Hmm... by 'followed you advice' you mean, completely ignored.:)

I said:
To modify any value, you first know in which table the value resides and what column to modify within that table.

You are trying to modify values inside tables that don't handle those values.
eg.
Routes can not modify the column Type by looking for TRAIT_CAPITAL_BUILDINGS_CHEAPER. The only values it contains are 'Type's of Routes, not 'Traits'

Put it another way. Are you familiar with cars? Maybe even do your own servicing? Would you put the transmission oil in the washer/wiper reserve? Or replace the leads with fanbelts?
I don't want to sound harsh, but maybe a little bit more of researching HOW the modding process works would be best?
To modify ANYTHING, CivV or a motor car, you need to know how it works and why changing something makes a difference.
Have a look around the forum here, there are hundreds of tutorials and 'howtos' to read that will explain what you need.
Grab an existing mod of something that does similar to what you want and look through the files. The best way to understand how it works is to see someone do it. Reading someone else's work MAY help you.

Also, good easy to read code makes it much easier to spot mistakes. Notice the indentation of my code compared to yours? each indent matches the opening and closing tags. You also have simple mistakes like extra '<' marks that will automatically render your code useless, even if you get all the other stuff right.

Also, why are you asking here in the SDK/LUA forum? This would be better placed in the general Creation & Customization or Modding fora.
 
Even if I leave just this
Code:
<GameData>     
  <Traits>     
    <Update>     
      <Where Type="TRAIT_CAPITAL_BUILDINGS_CHEAPER"/>    
      <Set CultureFromKills="100" />     
    </Update>
  </Traits>
</GameData>

it still doesn't work.
 
Did you set it in the mod properties to update database with your XML file?
 
Back
Top Bottom