Craig_Sutter
Deity
Just want to bring up an unexpected result from creating my leader.
What was supposed to happen is that units starting in either Encampments or City Center Districts would have +5 movement (just for testing). So, they Warriors would move 7 when starting in either district. The result was unexpected though, as they were moving 12 and this only worked for the City Center and not the Encampment.
I think I know the reason... I used the same Dynamic Modifier for each bit of the leader trait. So the upshot is that Dynamic modifiers should only be applied once within each Trait or they will be additive (depending upon the values used.
Here is the code that brought about the odd results:
The solution is that I am going to have to go back and create my own version of the MODIFIER_PLAYER_UNIT_ADJUST_MOVEMENT and MODIFIER_PLAYER_UNITS_ATTACH_MODIFIER dynamic modifiers to ensure that the results will not be duplicated by the code.
Just thought I would like to point out what happened so others will not be surprised.
What was supposed to happen is that units starting in either Encampments or City Center Districts would have +5 movement (just for testing). So, they Warriors would move 7 when starting in either district. The result was unexpected though, as they were moving 12 and this only worked for the City Center and not the Encampment.
I think I know the reason... I used the same Dynamic Modifier for each bit of the leader trait. So the upshot is that Dynamic modifiers should only be applied once within each Trait or they will be additive (depending upon the values used.
Here is the code that brought about the odd results:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- edited by Craig Sutter -->
<GameInfo>
<Types>
<Row Type="LEADER_ALFRED" Kind="KIND_LEADER"/>
<Row Type="TRAIT_LEADER_CALLING_THE_FYRD" Kind="KIND_TRAIT"/>
<Row Type="TRAIT_LEADER_UNIT_DANISH_HIRDMANN" Kind="KIND_TRAIT" />
</Types>
<Leaders>
<Row LeaderType="LEADER_ALFRED" Name="LOC_LEADER_ALFRED_NAME" InheritFrom="LEADER_DEFAULT" SceneLayers="4"/>
</Leaders>
<LeaderQuotes>
<Row LeaderType="LEADER_ALFRED" Quote="LOC_PEDIA_LEADERS_PAGE_LEADER_ALFRED_QUOTE" QuoteAudio="Play_NORW_HH_MISC_PEP_TALK_B_1"/>
</LeaderQuotes>
<LeaderTraits>
<Row LeaderType="LEADER_ALFRED" TraitType="TRAIT_LEADER_CALLING_THE_FYRD"/>
<Row LeaderType="LEADER_ALFRED" TraitType="TRAIT_LEADER_UNIT_DANISH_HIRDMANN"/>
</LeaderTraits>
<Traits>
<Row TraitType="TRAIT_LEADER_CALLING_THE_FYRD" Name="LOC_TRAIT_LEADER_CALLING_THE_FYRD_NAME" Description="LOC_TRAIT_LEADER_CALLING_THE_FYRD_DESCRIPTION"/>
<Row TraitType="TRAIT_LEADER_UNIT_DANISH_HIRDMANN" Name="LOC_UNIT_DANISH_HIRDMANN_NAME" Description="LOC_UNIT_DANISH_HIRDMANN_DESCRIPTION"/>
</Traits>
<TraitModifiers>
<Row TraitType="TRAIT_LEADER_CALLING_THE_FYRD" ModifierId="TRAIT_BURH_CITY_CENTER_MOVEMENT_BONUS"/>
<Row TraitType="TRAIT_LEADER_CALLING_THE_FYRD" ModifierId="TRAIT_BURH_ENCAMPMENT_MOVEMENT_BONUS"/>
</TraitModifiers>
<Agendas>
<Row AgendaType="AGENDA_DANELAW" Name="LOC_AGENDA_DANELAW_NAME" Description="LOC_AGENDA_DANELAW_DESCRIPTION"/>
</Agendas>
<HistoricalAgendas>
<Row LeaderType="LEADER_ALFRED" AgendaType="AGENDA_DANELAW"/>
</HistoricalAgendas>
<AiListTypes>
<Row ListType="AlfredCivics"/>
<Row ListType="AlfredTechs"/>
<Row ListType="AlfredWonders"/>
</AiListTypes>
<AiLists>
<Row ListType="AlfredWonders" LeaderType="TRAIT_LEADER_CALLING_THE_FYRD" System="Buildings"/>
<Row ListType="AlfredCivics" LeaderType="TRAIT_LEADER_CALLING_THE_FYRD" System="Civics"/>
<Row ListType="AlfredTechs" LeaderType="TRAIT_LEADER_CALLING_THE_FYRD" System="Technologies"/>
</AiLists>
<AiFavoredItems>
<Row ListType="AlfredWonders" Item="BUILDING_GREAT_LIGHTHOUSE"/>
<Row ListType="AlfredWonders" Item="BUILDING_TERRACOTTA_ARMY"/>
<Row ListType="AlfredCivics" Item="CIVIC_MILITARY_TRAINING"/>
<Row ListType="AlfredCivics" Item="CIVIC_MERCENARIES"/>
<Row ListType="AlfredTechs" Item="TECH_SHIPBUILDING"/>
<Row ListType="AlfredTechs" Item="TECH_IRON_WORKING"/>
</AiFavoredItems>
<Modifiers>
<Row>
<ModifierId>TRAIT_BURH_CITY_CENTER_MOVEMENT_BONUS_MODIFIER</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNIT_ADJUST_MOVEMENT</ModifierType>
</Row>
<Row>
<ModifierId>TRAIT_BURH_CITY_CENTER_MOVEMENT_BONUS</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNITS_ATTACH_MODIFIER</ModifierType>
<SubjectRequirementSetId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENTS</SubjectRequirementSetId>
</Row>
<Row>
<ModifierId>TRAIT_BURH_ENCAMPMENT_MOVEMENT_BONUS_MODIFIER</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNIT_ADJUST_MOVEMENT</ModifierType>
</Row>
<Row>
<ModifierId>TRAIT_BURH_ENCAMPMENT_MOVEMENT_BONUS</ModifierId>
<ModifierType>MODIFIER_PLAYER_UNITS_ATTACH_MODIFIER</ModifierType>
<SubjectRequirementSetId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENTS</SubjectRequirementSetId>
</Row>
</Modifiers>
<ModifierArguments>
<Row>
<ModifierId>TRAIT_BURH_CITY_CENTER_MOVEMENT_BONUS_MODIFIER</ModifierId>
<Name>Amount</Name>
<Value>5</Value>
</Row>
<Row>
<ModifierId>TRAIT_BURH_CITY_CENTER_MOVEMENT_BONUS</ModifierId>
<Name>ModifierId</Name>
<Value>TRAIT_BURH_CITY_CENTER_MOVEMENT_BONUS_MODIFIER</Value>
</Row>
<Row>
<ModifierId>TRAIT_BURH_ENCAMPMENT_MOVEMENT_BONUS_MODIFIER</ModifierId>
<Name>Amount</Name>
<Value>5</Value>
</Row>
<Row>
<ModifierId>TRAIT_BURH_ENCAMPMENT_MOVEMENT_BONUS</ModifierId>
<Name>ModifierId</Name>
<Value>TRAIT_BURH_ENCAMPMENT_MOVEMENT_BONUS_MODIFIER</Value>
</Row>
</ModifierArguments>
<RequirementSets>
<Row>
<RequirementSetId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENTS</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
<Row>
<RequirementSetId>PLOT_MOVEMENT_HAS_ENCAMPMENT_REQUIREMENTS</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
</RequirementSets>
<RequirementSetRequirements>
<Row>
<RequirementSetId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENTS</RequirementSetId>
<RequirementId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENT</RequirementId>
</Row>
<Row>
<RequirementSetId>PLOT_MOVEMENT_HAS_ENCAMPMENT_REQUIREMENTS</RequirementSetId>
<RequirementId>PLOT_MOVEMENT_HAS_ENCAMPMENT_REQUIREMENT</RequirementId>
</Row>
</RequirementSetRequirements>
<Requirements>
<Row>
<RequirementId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENT</RequirementId>
<RequirementType>REQUIREMENT_PLOT_DISTRICT_TYPE_MATCHES</RequirementType>
</Row>
<Row>
<RequirementId>PLOT_MOVEMENT_HAS_ENCAMPMENT_REQUIREMENT</RequirementId>
<RequirementType>REQUIREMENT_PLOT_DISTRICT_TYPE_MATCHES</RequirementType>
</Row>
</Requirements>
<RequirementArguments>
<Row>
<RequirementId>PLOT_MOVEMENT_HAS_CITY_CENTER_REQUIREMENT</RequirementId>
<Name>DistrictType</Name>
<Value>DISTRICT_CITY_CENTER</Value>
</Row>
<Row>
<RequirementId>PLOT_MOVEMENT_HAS_ENCAMPMENT_REQUIREMENT</RequirementId>
<Name>DistrictType</Name>
<Value>DISTRICT_ENCAMPMENT</Value>
</Row>
</RequirementArguments>
</GameInfo>
The solution is that I am going to have to go back and create my own version of the MODIFIER_PLAYER_UNIT_ADJUST_MOVEMENT and MODIFIER_PLAYER_UNITS_ATTACH_MODIFIER dynamic modifiers to ensure that the results will not be duplicated by the code.
Just thought I would like to point out what happened so others will not be surprised.