Leader Trait is being applied to All Civs in Game

kingchris20

Wisdom Seeker
Joined
Jul 30, 2012
Messages
1,343
Location
Resident of Heaven; Currently in the Waiting Room
My leader trait is supposed to grant his naval units an ability to heal from kills. This works; however the ability is also applied to any kind of unit from any civilization so long as a naval unit from my leader is present anywhere on the map.

How can I make it so that this ability is only applied to my leader's naval units?

Code:
<GameData>
    <Types>
        <Row Type="LEADER_KC20_BLACK_BART" Kind="KIND_LEADER"/>
        <Row Type="HEAL_FROM_NAVAL_KILLS_TRAIT" Kind="KIND_TRAIT"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS" Kind="KIND_ABILITY"/>
    </Types>
    <Leaders>
        <Row LeaderType="LEADER_KC20_BLACK_BART" Name="LOC_LEADER_KC20_BLACK_BART_NAME" InheritFrom="LEADER_DEFAULT" SceneLayers="4"/>
    </Leaders>
    <LeaderTraits>
        <Row LeaderType="LEADER_KC20_BLACK_BART" TraitType="HEAL_FROM_NAVAL_KILLS_TRAIT"/>
    </LeaderTraits>
    <Traits>
        <Row TraitType="HEAL_FROM_NAVAL_KILLS_TRAIT" Name="LOC_TRAIT_LEADER_KC20_BLACK_BART_NAME" Description="LOC_TRAIT_LEADER_KC20_BLACK_BART_DESCRIPTION"/>
    </Traits>
    <TraitModifiers>
        <Row TraitType="HEAL_FROM_NAVAL_KILLS_TRAIT" ModifierId="LEADER_KC20_BLACK_BART_HEAL_FROM_NAVAL_KILLS_TRAIT"/>
    </TraitModifiers>
    <Modifiers>
        <!-- Modifiers for Leader Trait-->
        <Row>
            <ModifierId>LEADER_KC20_BLACK_BART_HEAL_FROM_NAVAL_KILLS_TRAIT</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
            <Permanent>true</Permanent>
        </Row>
        <!-- Modifiers for Leader Trait Unit Abilities-->
        <Row>
            <ModifierId>HEAL_FROM_NAVAL_KILLS</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_HEAL_FROM_COMBAT</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <!-- Modifier Arguments for Leader Trait -->
        <Row>
            <ModifierId>LEADER_KC20_BLACK_BART_HEAL_FROM_NAVAL_KILLS_TRAIT</ModifierId>
            <Name>AbilityType</Name>
            <Value>ABILITY_HEAL_FROM_NAVAL_KILLS</Value>
        </Row>
        <!-- Modifier Arguments for Leader Trait Unit Abilities-->
        <Row>
            <ModifierId>HEAL_FROM_NAVAL_KILLS</ModifierId>
            <Name>Amount</Name>
            <Value>100</Value>
        </Row>
    </ModifierArguments>
    <TypeTags>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_RAIDER"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_MELEE"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_RANGED"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_CARRIER"/>
    </TypeTags>
    <UnitAbilities>
        <Row UnitAbilityType="ABILITY_HEAL_FROM_NAVAL_KILLS" Name="LOC_ABILITY_HEAL_FROM_NAVAL_KILLS_NAME" Description="LOC_ABILITY_HEAL_FROM_NAVAL_KILLS_DESCRIPTION"/>
    </UnitAbilities>
    <UnitAbilityModifiers>
        <Row>
            <UnitAbilityType>ABILITY_HEAL_FROM_NAVAL_KILLS</UnitAbilityType>
            <ModifierId>HEAL_FROM_NAVAL_KILLS</ModifierId>
        </Row>
    </UnitAbilityModifiers>
</GameData>

I have a similar leader trait for a different leader that is working properly and only applying to his naval units
Spoiler :
Code:
<GameData>
    <Types>
        <Row Type="LEADER_KC20_BLACKBEARD" Kind="KIND_LEADER"/>
        <Row Type="PURE_INTIMIDATION_TRAIT" Kind="KIND_TRAIT"/>
        <Row Type="ABILITY_PURE_INTIMIDATION" Kind="KIND_ABILITY"/>
    </Types>
    <Leaders>
        <Row LeaderType="LEADER_KC20_BLACKBEARD" Name="LOC_LEADER_KC20_BLACKBEARD_NAME" InheritFrom="LEADER_DEFAULT" SceneLayers="4"/>
    </Leaders>
    <LeaderTraits>
        <Row LeaderType="LEADER_KC20_BLACKBEARD" TraitType="PURE_INTIMIDATION_TRAIT"/>
    </LeaderTraits>
    <Traits>
        <Row TraitType="PURE_INTIMIDATION_TRAIT" Name="LOC_TRAIT_LEADER_KC20_BLACKBEARD_NAME" Description="LOC_TRAIT_LEADER_KC20_BLACKBEARD_DESCRIPTION"/>
    </Traits>
    <TraitModifiers>
        <Row TraitType="PURE_INTIMIDATION_TRAIT" ModifierId="LEADER_KC20_BLACKBEARD_PURE_INTIMIDATION_TRAIT"/>
    </TraitModifiers>
    <Modifiers>
        <!-- Modifiers for Leader Trait-->
        <Row>
            <ModifierId>LEADER_KC20_BLACKBEARD_PURE_INTIMIDATION_TRAIT</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
            <Permanent>true</Permanent>
        </Row>
        <!-- Modifiers for Leader Trait Unit Abilities-->
        <Row>
            <ModifierId>PURE_INTIMIDATION_NEGATIVE_COMBAT</ModifierId>
            <ModifierType>MODIFIER_ALL_UNITS_ATTACH_MODIFIER</ModifierType>
            <SubjectRequirementSetId>PURE_INTIMIDATION_AT_WAR_REQUIREMENTS</SubjectRequirementSetId>
        </Row>
        <Row>
            <ModifierId>PURE_INTIMIDATION_NEGATIVE_COMBAT_MODIFIER</ModifierId>
            <ModifierType>MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH</ModifierType>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <!-- Modifier Arguments for Leader Trait -->
        <Row>
            <ModifierId>LEADER_KC20_BLACKBEARD_PURE_INTIMIDATION_TRAIT</ModifierId>
            <Name>AbilityType</Name>
            <Value>ABILITY_PURE_INTIMIDATION</Value>
        </Row>
        <!-- Modifier Arguments for Leader Trait Unit Abilities-->
        <Row>
            <ModifierId>PURE_INTIMIDATION_NEGATIVE_COMBAT</ModifierId>
            <Name>ModifierId</Name>
            <Value>PURE_INTIMIDATION_NEGATIVE_COMBAT_MODIFIER</Value>
        </Row>
        <Row>
            <ModifierId>PURE_INTIMIDATION_NEGATIVE_COMBAT_MODIFIER</ModifierId>
            <Name>Amount</Name>
            <Value>-5</Value>
        </Row>
    </ModifierArguments>
    <ModifierStrings>
        <Row ModifierId="PURE_INTIMIDATION_NEGATIVE_COMBAT_MODIFIER" Context="Preview" Text="LOC_ABILITY_PURE_INTIMIDATION_NEGATIVE_COMBAT_MODIFIER_DESCRIPTION"/>
    </ModifierStrings>
    <RequirementSets>
        <Row>
            <RequirementSetId>PURE_INTIMIDATION_AT_WAR_REQUIREMENTS</RequirementSetId>
            <RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
        </Row>
    </RequirementSets>
    <RequirementSetRequirements>
        <Row>
            <RequirementSetId>PURE_INTIMIDATION_AT_WAR_REQUIREMENTS</RequirementSetId>
            <RequirementId>PURE_INTIMIDATION_UNIT_AT_WAR_REQUIREMENTS</RequirementId>
        </Row>
    </RequirementSetRequirements>
    <Requirements>
        <Row>
            <RequirementId>PURE_INTIMIDATION_UNIT_AT_WAR_REQUIREMENTS</RequirementId>
            <RequirementType>REQUIREMENT_PLOT_ADJACENT_TO_OWNER_AT_WAR</RequirementType>
        </Row>
    </Requirements>
    <RequirementArguments>
        <Row>
            <RequirementId>PURE_INTIMIDATION_UNIT_AT_WAR_REQUIREMENTS</RequirementId>
            <Name>MinDistance</Name>
            <Value>1</Value>
        </Row>
        <Row>
            <RequirementId>PURE_INTIMIDATION_UNIT_AT_WAR_REQUIREMENTS</RequirementId>
            <Name>MaxDistance</Name>
            <Value>3</Value>
        </Row>
    </RequirementArguments>
    <TypeTags>
        <Row Type="ABILITY_PURE_INTIMIDATION"    Tag="CLASS_NAVAL_RAIDER"/>
        <Row Type="ABILITY_PURE_INTIMIDATION"    Tag="CLASS_NAVAL_MELEE"/>
        <Row Type="ABILITY_PURE_INTIMIDATION"    Tag="CLASS_NAVAL_RANGED"/>
        <Row Type="ABILITY_PURE_INTIMIDATION"    Tag="CLASS_NAVAL_CARRIER"/>
    </TypeTags>
    <UnitAbilities>
        <Row UnitAbilityType="ABILITY_PURE_INTIMIDATION" Name="LOC_ABILITY_PURE_INTIMIDATION_NAME" Inactive="true" Description="LOC_ABILITY_PURE_INTIMIDATION_DESCRIPTION"/>
    </UnitAbilities>
    <UnitAbilityModifiers>
        <Row>
            <UnitAbilityType>ABILITY_PURE_INTIMIDATION</UnitAbilityType>
            <ModifierId>PURE_INTIMIDATION_NEGATIVE_COMBAT</ModifierId>
        </Row>
    </UnitAbilityModifiers>
</GameData>
 
Last edited:
Update:

Making the ability "inactive" solved this problem. Now other Civs do not get this benefit, but my leader does.
Code:
<UnitAbilities>
        <Row UnitAbilityType="ABILITY_HEAL_FROM_NAVAL_KILLS" Name="LOC_ABILITY_HEAL_FROM_NAVAL_KILLS_NAME" Description="LOC_ABILITY_HEAL_FROM_NAVAL_KILLS_DESCRIPTION" Inactive="true"/>
</UnitAbilities>
 
Scratch that, adding [Inactive="True"] to the Unit Ability solved the issue where any civilization's units got this ability, but it did not solve the same problem within this Leader's unit group.

Any Black Bart unit will heal completely after defeating an enemy so long as a Black Bart naval unit is located somewhere on the map. Still trying to work through this.\

Basically, when Black Bart produces a naval unit and that naval unit is on the map anywhere, the ability is attached to all his units. If no Black Bart naval unit is present on the map, the ability is not attached to his other units.
 
Just talking with myself, but maybe someone in the future will find their answer from this.

I found a solution to this, and it has to do with adding requirements to the modifier. The modifier was just attaching itself to any unit of Black Bart's so long as a unit with the correct Class for the ability was on the map. So to hone this down, I needed to add an owner requirement and a subject requirement. The owner requirement ensures that Black Bart's unit is a naval unit, and the subject requirement ensures that the enemy is also a naval unit. And because the game already had this requirement set up, all I needed to do was find the Requirement name...

Code:
<OwnerRequirementSetId>REQUIREMENTS_UNIT_SEA_DOMAIN</OwnerRequirementSetId>
<SubjectRequirementSetId>REQUIREMENTS_UNIT_SEA_DOMAIN</SubjectRequirementSetId>

And shown as it is in the XML.

Code:
<GameData>
    <Types>
        <Row Type="LEADER_KC20_BLACK_BART" Kind="KIND_LEADER"/>
        <Row Type="HEAL_FROM_NAVAL_KILLS_TRAIT" Kind="KIND_TRAIT"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS" Kind="KIND_ABILITY"/>
    </Types>
    <TypeTags>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_RAIDER"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_MELEE"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_RANGED"/>
        <Row Type="ABILITY_HEAL_FROM_NAVAL_KILLS"    Tag="CLASS_NAVAL_CARRIER"/>
    </TypeTags>
    <Leaders>
        <Row LeaderType="LEADER_KC20_BLACK_BART" Name="LOC_LEADER_KC20_BLACK_BART_NAME" InheritFrom="LEADER_DEFAULT" SceneLayers="4"/>
    </Leaders>
    <LeaderTraits>
        <Row LeaderType="LEADER_KC20_BLACK_BART" TraitType="HEAL_FROM_NAVAL_KILLS_TRAIT"/>
    </LeaderTraits>
    <Traits>
        <Row TraitType="HEAL_FROM_NAVAL_KILLS_TRAIT" Name="LOC_TRAIT_LEADER_KC20_BLACK_BART_NAME" Description="LOC_TRAIT_LEADER_KC20_BLACK_BART_DESCRIPTION"/>
    </Traits>
    <TraitModifiers>
        <Row TraitType="HEAL_FROM_NAVAL_KILLS_TRAIT" ModifierId="LEADER_KC20_BLACK_BART_HEAL_FROM_NAVAL_KILLS_TRAIT"/>
    </TraitModifiers>
    <Modifiers>
        <!-- Modifiers for Leader Trait-->
        <Row>
            <ModifierId>LEADER_KC20_BLACK_BART_HEAL_FROM_NAVAL_KILLS_TRAIT</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
            <Permanent>true</Permanent>
        </Row>
        <!-- Modifiers for Leader Trait Unit Abilities-->
        <Row>
            <ModifierId>HEAL_FROM_NAVAL_KILLS</ModifierId>
            <ModifierType>MODIFIER_PLAYER_UNITS_ADJUST_HEAL_FROM_COMBAT</ModifierType>
            <OwnerRequirementSetId>REQUIREMENTS_UNIT_SEA_DOMAIN</OwnerRequirementSetId>
            <SubjectRequirementSetId>REQUIREMENTS_UNIT_SEA_DOMAIN</SubjectRequirementSetId>
        </Row>
    </Modifiers>
    <ModifierArguments>
        <!-- Modifier Arguments for Leader Trait -->
        <Row>
            <ModifierId>LEADER_KC20_BLACK_BART_HEAL_FROM_NAVAL_KILLS_TRAIT</ModifierId>
            <Name>AbilityType</Name>
            <Value>ABILITY_HEAL_FROM_NAVAL_KILLS</Value>
        </Row>
        <!-- Modifier Arguments for Leader Trait Unit Abilities-->
        <Row>
            <ModifierId>HEAL_FROM_NAVAL_KILLS</ModifierId>
            <Name>Amount</Name>
            <Value>100</Value>
        </Row>
    </ModifierArguments>
    <UnitAbilities>
        <Row UnitAbilityType="ABILITY_HEAL_FROM_NAVAL_KILLS" Name="LOC_ABILITY_HEAL_FROM_NAVAL_KILLS_NAME" Description="LOC_ABILITY_HEAL_FROM_NAVAL_KILLS_DESCRIPTION" Inactive="true"/>
    </UnitAbilities>
    <UnitAbilityModifiers>
        <Row>
            <UnitAbilityType>ABILITY_HEAL_FROM_NAVAL_KILLS</UnitAbilityType>
            <ModifierId>HEAL_FROM_NAVAL_KILLS</ModifierId>
        </Row>
    </UnitAbilityModifiers>
</GameData>
 
Back
Top Bottom