City State Unique Traits

Kobazco

Chieftain
Joined
Mar 6, 2016
Messages
55
Hey everyone. I'm trying to take Kabul's unique trait of giving their suzerain 2 times the normal amount combat exp and make it part of a leader trait. I've taken the following lines and properly formatted them into the game as a leader trait. However, my units are not getting the 2x exp.

Here are the original lines I've taken from Leaders.xml

<Row>
<ModifierId>MINOR_CIV_KABUL_UNIT_EXPERIENCE_BONUS</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_ATTACK_EXPERIENCE_MODIFIER</ModifierType>
</Row>

and

<Row>
<ModifierId>MINOR_CIV_KABUL_UNIT_EXPERIENCE_BONUS</ModifierId>
<Name>Amount</Name>
<Value>100</Value>
</Row>

I have changed these 2 things to this in my own leader.xml

<Row>
<ModifierId>TRAIT_XP_MODIFIER</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_ATTACK_EXPERIENCE_MODIFIER</ModifierType>
</Row>

<Row>
<ModifierId>TRAIT_XP_MODIFIER</ModifierId>
<Name>Amount</Name>
<Value>100</Value>
</Row>

As far as I can tell, I've defined everything properly. Let me know if you somehow find out the solution. I'm going to move onto making unique units.
 
It might be because of internal incompatibilities between traits.
 
Modifiers have to be attached to traits and abilities. Try attach the Kabul trait to your leader and see if that works.
 
I can't simply attach it because of how city state traits work. This one line ruins that. It does a check to see if the player is a suzerain, but it was part of the influence bonus so I left it out.

<Row>
<ModifierId>MINOR_CIV_KABUL_UNIQUE_INFLUENCE_BONUS</ModifierId>
<ModifierType>MODIFIER_ALL_PLAYERS_ATTACH_MODIFIER</ModifierType>
<SubjectRequirementSetId>PLAYER_IS_SUZERAIN</SubjectRequirementSetId>
</Row>

However, the influence bonus is actually tied to the exp bonus in a strange way here.

<Row>
<ModifierId>MINOR_CIV_KABUL_UNIQUE_INFLUENCE_BONUS</ModifierId>
<Name>ModifierId</Name>
<Value>MINOR_CIV_KABUL_UNIT_EXPERIENCE_BONUS</Value>
</Row>

I have omitted these 2 lines as I thought them to not be necessary. But perhaps not?
 
Traits and abilities are very convoluted. There are many moving parts. Make sure you understand the logic flow of the whole trait. Including modifiers and requirements.
 
I still don't see how I would need those influence related lines. First off, it attaches it to every player that is a suzerain (so only 1 player) and then it loops back around the EXP bonus? Its very strange. If you would like, here's the mod in its current state. The units.xml file is still incomplete though. The double XP trait is located in Oddone_Leader.xml . I also have another trait in Oddone_Civ.xml that is not working but I'll get to that later.
 

Attachments

Traits and abilities like these have two parts: the modifier value and the requirements. Value is obviously a numeric bonus to an object (e.g. unit). The requirements further limit who gets the bonus. These modifier and requirements are linked to the same id.

Take note of the parent sections and make sure your stuff is put in the right sections. There are many sections you have to consider. By Section i mean XML elements that contain rows. That is, what is the parent of that row?

I could look at your code later and test it myself.
 
I've made sure everything is in the right section. The entire thing looks like this. The other trait (Bakana) works perfectly btw.
<Types>
<Row Type="LEADER_ODDONE" Kind="KIND_LEADER"/>
<Row Type="TRAIT_LEADER_BAKANA" Kind="KIND_TRAIT"/>
<Row Type="TRAIT_LEADER_2XP" Kind="KIND_TRAIT"/>
</Types>

(Everything pertaining to the leader is between these)

<Traits>
<Row TraitType="TRAIT_LEADER_BAKANA" Name="LOC_TRAIT_LEADER_BAKANA_NAME" Description="LOC_TRAIT_LEADER_BAKANA_DESCRIPTION"/>
<Row TraitType="TRAIT_LEADER_2XP" Name="Nani?" Description="All units led by the Great General Oddone gain double the usual amount of EXP."/>
</Traits>
<TraitModifiers>
<Row TraitType="TRAIT_LEADER_BAKANA" ModifierId="TRAIT_MILITARY_GOVERNMENT_SLOT"/>
<Row TraitType="TRAIT_LEADER_2XP" ModifierId="TRAIT_XP_MODIFIER"/>
</TraitModifiers>
<Modifiers>
<Row>
<ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
<ModifierType>MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER</ModifierType>
</Row>
<Row>
<ModifierId>TRAIT_XP_MODIFIER</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_ATTACK_EXPERIENCE_MODIFIER</ModifierType>
</Row>
</Modifiers>
<ModifierArguments>
<Row>
<ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
<Name>GovernmentSlotType</Name>
<Value>SLOT_MILITARY</Value>
</Row>
<Row>
<ModifierId>TRAIT_XP_MODIFIER</ModifierId>
<Name>Amount</Name>
<Value>100</Value>
</Row>
</ModifierArguments>
 
Make sure you attach trait to the leader. This code should work:
Code:
	<Types>
		<Row Type="TRAIT_LEADER_2XP" Kind="KIND_TRAIT"/>
	</Types>
	<LeaderTraits>
		<Row LeaderType="LEADER_ODDONE" TraitType="TRAIT_LEADER_2XP"/>
	</LeaderTraits>
	<Traits>
		<Row TraitType="TRAIT_LEADER_2XP" Name="Nani?" Description="All units led by the Great General Oddone gain double the usual amount of EXP."/>
	</Traits>
	<TraitModifiers>
		<Row TraitType="TRAIT_LEADER_2XP" ModifierId="TRAIT_XP_MODIFIER"/>
	</TraitModifiers>
	<Modifiers>
		<Row>
			<ModifierId>TRAIT_XP_MODIFIER</ModifierId>
			<ModifierType>MODIFIER_PLAYER_UNITS_ATTACH_MODIFIER</ModifierType>
		</Row>
		 <Row>
			 <ModifierId>TRAIT_XP_MODIFIER_BONUS</ModifierId>
			 <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_ATTACK_EXPERIENCE_MODIFIER</ModifierType>
		 </Row>
	</Modifiers>
	<ModifierArguments>
		<Row>
			<ModifierId>TRAIT_XP_MODIFIER</ModifierId>
			<Name>ModifierId</Name>
			<Value>TRAIT_XP_MODIFIER_BONUS</Value>
		</Row>
		 <Row>
			 <ModifierId>TRAIT_XP_MODIFIER_BONUS</ModifierId>
			 <Name>Amount</Name>
			 <Value>100</Value>
		 </Row>
	</ModifierArguments>

You need another modifier to attach to a player's units. see Barbarossa.

Check the Civilopedia under your leader to make sure the trait is listed. Check Database.log for errors.

Note: The max XP gained in one combat is 8, which is a global parameter for the game. see GlobalParameters.xml:
Code:
		<Row Name="EXPERIENCE_MAXIMUM_ONE_COMBAT" Value="8" />
 
Alright I'll take a look at Barbarossa's trait. The trait does display properly in game and in the Civilopedia btw.
 
Huh. I'm fairly certain I've used the code you provided me, but my units in game still do not receive double the amount of XP. (Attacking a Barbarian Spearman yields 5xp, doubled should be 10xp.) And so on.
 
Believe me, I've restarted plenty of times. Would you like to see my current file? This is my entire leader.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Ed Beach (Firaxis Games) -->
<GameInfo>
    <PlayerColors>
        <Row>
            <Type>LEADER_ODDONE</Type>
            <Usage>UNIQUE</Usage>
            <PrimaryColor>COLOR_PLAYER_ODDONE_PRIMARY</PrimaryColor>
            <SecondaryColor>COLOR_PLAYER_ODDONE_SECONDARY</SecondaryColor>
            <TextColor>COLOR_PLAYER_WHITE_TEXT</TextColor>
        </Row>
    </PlayerColors>
    <Colors>
        <Row>
            <Type>COLOR_PLAYER_ODDONE_PRIMARY</Type>
            <Red>0.392</Red>
            <Green>0.254</Green>
            <Blue>0.647</Blue>
            <Alpha>1</Alpha>
        </Row>
        <Row>
            <Type>COLOR_PLAYER_ODDONE_SECONDARY</Type>
            <Red>0.925</Red>
            <Green>0.537</Green>
            <Blue>0.227</Blue>
            <Alpha>1</Alpha>
        </Row>
    </Colors>
    <Types>
        <Row Type="LEADER_ODDONE" Kind="KIND_LEADER"/>
        <Row Type="TRAIT_LEADER_BAKANA" Kind="KIND_TRAIT"/>
    </Types>
    <Leaders>
        <Row LeaderType="LEADER_ODDONE" Name="LOC_LEADER_ODDONE_NAME" InheritFrom="LEADER_DEFAULT" SceneLayers="4"/>
    </Leaders>
    <LeaderQuotes>
        <Row LeaderType="LEADER_ODDONE" Quote="Stay free noobs. Stay Free" QuoteAudio="Play_JAPA_HT_MISC_PEP_TALK_D_1"/>
    </LeaderQuotes>
    <HistoricalAgendas>
        <Row LeaderType="LEADER_ODDONE" AgendaType="AGENDA_BUSHIDO"/>
    </HistoricalAgendas>
    <AiListTypes>
        <Row ListType="ODDONECivics"/>
        <Row ListType="ODDONETechs"/>
        <Row ListType="ODDONEWonders"/>
    </AiListTypes>
    <AiFavoredItems>
        <Row ListType="ODDONEWonders" Item="BUILDING_RUHR_VALLEY"/>
        <Row ListType="ODDONECivics" Item="CIVIC_CRAFTSMANSHIP"/>
        <Row ListType="ODDONECivics" Item="CIVIC_FOREIGN_TRADE"/>
        <Row ListType="ODDONECivics" Item="CIVIC_STATE_WORKFORCE"/>
        <Row ListType="ODDONECivics" Item="CIVIC_EARLY_EMPIRE"/>
        <Row ListType="ODDONECivics" Item="CIVIC_GAMES_RECREATION"/>
        <Row ListType="ODDONECivics" Item="CIVIC_POLITICAL_PHILOSOPHY"/>
        <Row ListType="ODDONECivics" Item="CIVIC_DRAMA_POETRY"/>
        <Row ListType="ODDONECivics" Item="CIVIC_DEFENSIVE_TACTICS"/>
        <Row ListType="ODDONECivics" Item="CIVIC_RECORDED_HISTORY"/>
        <Row ListType="ODDONECivics" Item="CIVIC_FEUDALISM"/>
        <Row ListType="ODDONECivics" Item="CIVIC_CIVIL_SERVICE"/>
        <Row ListType="ODDONECivics" Item="CIVIC_MEDIEVAL_FAIRES"/>
        <Row ListType="ODDONECivics" Item="CIVIC_GUILDS"/>
        <Row ListType="ODDONECivics" Item="CIVIC_HUMANISM"/>
        <Row ListType="ODDONECivics" Item="CIVIC_DIPLOMATIC_SERVICE"/>
        <Row ListType="ODDONECivics" Item="CIVIC_MERCANTILISM"/>
        <Row ListType="ODDONECivics" Item="CIVIC_THE_ENLIGHTENMENT"/>
        <Row ListType="ODDONECivics" Item="CIVIC_CIVIL_ENGINEERING"/>
        <Row ListType="ODDONECivics" Item="CIVIC_NATIONALISM"/>
        <Row ListType="ODDONECivics" Item="CIVIC_URBANIZATION"/>
        <Row ListType="ODDONECivics" Item="CIVIC_MASS_MEDIA"/>
        <Row ListType="ODDONECivics" Item="CIVIC_MOBILIZATION"/>
        <Row ListType="ODDONECivics" Item="CIVIC_IDEOLOGY"/>
        <Row ListType="ODDONETechs" Item="TECH_APPRENTICESHIP"/>
        <Row ListType="ODDONETechs" Item="TECH_ELECTRICITY"/>
    </AiFavoredItems>
    <LeaderTraits>
        <Row LeaderType="LEADER_ODDONE" TraitType="TRAIT_LEADER_BAKANA"/>
    </LeaderTraits>
    <Traits>
        <Row TraitType="TRAIT_LEADER_BAKANA" Name="LOC_TRAIT_LEADER_BAKANA_NAME" Description="LOC_TRAIT_LEADER_BAKANA_DESCRIPTION"/>
    </Traits>
    <TraitModifiers>
        <Row TraitType="TRAIT_LEADER_BAKANA" ModifierId="TRAIT_MILITARY_GOVERNMENT_SLOT"/>
        <Row TraitType="TRAIT_LEADER_BAKANA" ModifierId="TRAIT_BOOST_ENCAMPMENT_PRODUCTION"/>
        <Row TraitType="TRAIT_LEADER_BAKANA" ModifierId="TRAIT_XP_MODIFIER"/>
    </TraitModifiers>
    <Modifiers>
        <Row>
            <ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
            <ModifierType>MODIFIER_PLAYER_CULTURE_ADJUST_GOVERNMENT_SLOTS_MODIFIER</ModifierType>
        </Row>
        <Row>
            <ModifierId>TRAIT_XP_MODIFIER</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ATTACH_MODIFIER</ModifierType>
        </Row>
        <Row>
            <ModifierId>TRAIT_XP_MODIFIER_BONUS</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_UNIT_ATTACK_EXPERIENCE_MODIFIER</ModifierType>
        </Row>
        <Row>
            <ModifierId>TRAIT_BOOST_ENCAMPMENT_PRODUCTION</ModifierId>
            <ModifierType>MODIFIER_PLAYER_CITIES_ADJUST_DISTRICT_PRODUCTION</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <Row>
            <ModifierId>TRAIT_MILITARY_GOVERNMENT_SLOT</ModifierId>
            <Name>GovernmentSlotType</Name>
            <Value>SLOT_MILITARY</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_XP_MODIFIER</ModifierId>
            <Name>ModifierId</Name>
            <Value>TRAIT_XP_MODIFIER_BONUS</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_XP_MODIFIER_BONUS</ModifierId>
            <Name>Amount</Name>
            <Value>100</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_BOOST_ENCAMPMENT_PRODUCTION</ModifierId>
            <Name>DistrictType</Name>
            <Value>DISTRICT_ENCAMPMENT</Value>
        </Row>
        <Row>
            <ModifierId>TRAIT_BOOST_ENCAMPMENT_PRODUCTION</ModifierId>
            <Name>Amount</Name>
            <Value>100</Value>
        </Row>
    </ModifierArguments>
</GameInfo>
 
Validate your XML:
http://codebeautify.org/xmlvalidator

Bad XML causes database errors. Also look out for database UNIQUE errors. You should not re-create modifiers that already exist in the base game. i.e. TRAIT_MILITARY_GOVERNMENT_SLOT & TRAIT_BOOST_ENCAMPMENT_PRODUCTION

I've changed all of my modifiers unique and I've validated my XML. Everything is the same. Everything works except for the XP modifier, just doesn't work it seems. I've tried everything :/
 
I had a nearly identical issue. This was mentioned in the thread already, but the globalparameters.xml file does limit maximum XP per battle to 8. For some reason it wasnt updating the databse with the new value. For testing, try changing the globalparameters.xml file itself and see if that gives you a higher value. When I did that, my maximum XP per battle increased. I then rewrote my mod to update the value and it worked the second time. Code below. Also, as an FYI, I tied mine to a building rather than a leader trait.

<GameInfo>
<GlobalParameters>
<!-- Unchanged, here for reference-->
<Update>
<Where Name="EXPERIENCE_MAX_BARB_LEVEL" /> <Set Value="6" />
</Update>
<Update>
<Where Name="EXPERIENCE_MAXIMUM_ONE_COMBAT" /> <Set Value="150" />
</Update>
</GlobalParameters>
</GameInfo>
 
Back
Top Bottom