Where to edit civ unique traits?

White Out

Prince
Joined
May 29, 2009
Messages
358
Location
Calgary
I'm looking to change some of the traits, for instance, I wanted to boost France's wonder building. Can't for the life of me find it thought.
 
You didn't mention if you are using XML or SQL. My mind is grounded mainly in SQL because that's how I do all my updates (because in SQL you can test your code against the database without actually running the game).

Speaking from the database perspective/SQL:
  • All of the "qualities" of a civ, ultimately come from a table called "Modifiers", which tells you which kind of modifier it is
  • Many of items also have an entry on a table called "ModifierArguments," which tells you how much, which building, etc.
So for example, if the name of a modifier is MODIFIER_MAKE_STUFF_CHEAP (totally made up) then in the ModifierArguments table there is likely to be a few rows like this:

Code:
ModifierId                                                     Name                     Value
'MODIFIER_MAKE_STUFF_CHEAP'          'Amount'                 '50'
'MODIFIER_MAKE_STUFF_CHEAP'          'BuildingType'         'BUILDING_TEMPLE'


So to change this, you have a two part task:
  • Find out the ModifierId for the ability
  • Edit the entries in the ModifierArguments table that match that id

Keep in mind that many abilities have more than one Modifier. In the case of apply abilities to a leader or civ, these Modifiers are all rolled together in an object called a Trait.
  • Modifiers do not attach directly to a leader or civilization. They are attached to "Traits" which in turn can be attached to either leaders or civs
    • A trait becomes associated with a leader (versus the civilization itself) if it is listed in a table called LeaderTraits
    • A trait becomes associated with a civilization are lised in a table called CivilizationTraits

The modifiers that are inside a Trait are attached to the trait using a table called TraitModifiers. I know this sounds confusing but its really very simple. The modifier we saw earlier called MODIFIER_MAKE_STUFF_CHEAP would appear in the TraitModifiers table next to a Trait. This just tells the game "This modifier is used inside of this Trait. When you apply the Trait to a leader or civilization, apply the Modifier."


Knowing all this, we can use SQL to come up with a map to any trait we want to find. Here's some code that would let you search for every CivilizationTrait. It lists the CivilizationTrait first.

Code:
-- Create a list of all Civilization Traits, followed by values from the Modifiers, ModifierArguments, TraitModifiers, and CivilizationTrait tables

SELECT CivilizationTraits.CivilizationType, * FROM Modifiers
INNER JOIN ModifierArguments on ModifierArguments.ModifierId = Modifiers.Modifierid
INNER JOIN TraitModifiers on TraitModifiers.Modifierid = Modifiers.Modifierid
INNER JOIN CivilizationTraits on CivilizationTraits.TraitType = Traitmodifiers.Traittype

upload_2017-1-3_22-44-43.png



I scroll down so we could see France.


Here's the same code for searching by Leader:

Code:
-- Create a list of all Leader Traits, followed by values from the Modifiers, ModifierArguments, TraitModifiers, and LeaderTrait tables

SELECT LeaderTraits.LeaderType, * FROM Modifiers
INNER JOIN ModifierArguments on ModifierArguments.ModifierId = Modifiers.Modifierid
INNER JOIN TraitModifiers on TraitModifiers.Modifierid = Modifiers.Modifierid
INNER JOIN LeaderTraits on LeaderTraits.TraitType = Traitmodifiers.Traittype



Now I realize those entries gave way too many results, so here I've changed the code to just show the ModifierArguments we said earlier were important.

Code:
SELECT CivilizationTraits.CivilizationType, ModifierArguments.ModifierId, ModifierArguments.Name, MOdifierArguments.Value FROM Modifiers
INNER JOIN ModifierArguments on ModifierArguments.ModifierId = Modifiers.Modifierid
INNER JOIN TraitModifiers on TraitModifiers.Modifierid = Modifiers.Modifierid
INNER JOIN CivilizationTraits on CivilizationTraits.TraitType = Traitmodifiers.Traittype

Here's some of the results. Again, I've scrolled down so we can see France.

upload_2017-1-3_22-51-20.png



So basically what you can see is that to update France's ability to build wonders quickly, we actually need to update a whole bunch of ModifierArguments, one per building. For example, the ability to build Chichen Itza faster is done by a modifier called TRAIT_CHICHENITZAPRODUCTION. You'd need to update the 'Amount" fields on ModifierArguments table. Luckily that's easy code:



UPDATE ModifierArguments SET Value='100' WHERE ModifierId='TRAIT_CHICHENITZAPRODUCTION' AND Name='Amount' ;


You just need to do it for every building in the list. Most Traits dont have this many Modifiers, but you got lucky and picked one of the few that has a whole bunch :)
 
Last edited:
So that's way above my head right now lol.

I tried this

<GameInfo>
<Units>
<Update>
<Where UnitType="UNIT_EGYPTIAN_CHARIOT_ARCHER" />
<Set Cost="85"/>
</Update>
</Units>
<BaseGameText>
<Update>
<Where UnitType="LOC_IMPROVEMENT_CHATEAU_DESCRIPTION" />
<Set Text="Unlocks the Builder ability to construct a Chateau, unique to France.[NEWLINE][NEWLINE]+1 [ICON_Culture] Culture. +4 [ICON_Culture] Culture if next to a wonder. +2 [ICON_Gold] Gold if next to a Luxury resource. Can only be built adjacent to Rivers."/>
</Update>
</BaseGameText>
</GameInfo>

For context the chariot archer works but the updating of the game text for the Chateau didnt. Is my formatting all frigged up?
 
The XML version is way above my head in a lot of ways. LOL.

When you write XML its basically SQL but in XML format. So translating that XML to SQL I think we have:


UPDATE Units SET Cost='85' WHERE UnitType='UNIT_EGYPTIAN_CHARIOT_ARCHER' ;


Most of the stuff in my last post was more concerned with figuring out where to find a particular ability. The actual changes are just that one final line of code. So don't it overwhelm you. :)


As for the LOC stuff, that needs to go in a separate file and set up differently in the modinfo file. Basically, that stuff goes under the LocalizedText grouping so the game can grab it. It doesn't read into the "main" database.
 
Back
Top Bottom