sp00n
Prince
- Joined
- Jan 4, 2007
- Messages
- 371
I'm trying to give all naval units an on defense buff. The log files show no errors, however the modifier is not applied (testing this in Hotseat).
Can anybody point out what's wrong here?
MOD_UnitAbilities.xml
MOD_Units.xml
Ultimately I would like this mod to allow embarked land units to be destroyed more easily. My first approach was to give the ocean and coast tiles a -20 defense modifier, and giving it back to true naval units with the above code.
Giving embarked units a direct negative defense modifier would be the more direct approach. I have identified a couple of potential requirements for this (REQUIREMENT_OPPONENT_UNIT_DOMAIN_MATCHES, OPPONENT_IS_LAND_UNIT_REQUIREMENTS, REQUIRES_TERRAIN_OCEAN, REQUIRES_TERRAIN_COAST), but if I don't even get the above to work, progressing to defining new custom requirements doesn't make much sense.
Can anybody point out what's wrong here?
MOD_UnitAbilities.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<GameInfo>
<Types>
<Row Type="ABILITY_NAVAL_DEFENSE" Kind="KIND_ABILITY"/>
</Types>
<TypeTags>
<Row Type="ABILITY_NAVAL_DEFENSE" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
</TypeTags>
<UnitAbilities>
<Row UnitAbilityType="ABILITY_NAVAL_DEFENSE" Name="LOC_ABILITY_NAVAL_DEFENSE_NAME" Description="LOC_ABILITY_NAVAL_DEFENSE_DESCRIPTION"/>
</UnitAbilities>
<UnitAbilityModifiers>
<Row>
<UnitAbilityType>ABILITY_NAVAL_DEFENSE</UnitAbilityType>
<ModifierId>PLUS_X_WHEN_DEFENDING_COMBAT_NAVAL_BONUS</ModifierId>
</Row>
</UnitAbilityModifiers>
<Modifiers>
<Row>
<ModifierId>PLUS_X_WHEN_DEFENDING_COMBAT_NAVAL_BONUS</ModifierId>
<ModifierType>MODIFIER_UNIT_ADJUST_COMBAT_STRENGTH</ModifierType>
<SubjectRequirementSetId>PLAYER_IS_NAVAL_DEFENDER_REQUIREMENTS_SET</SubjectRequirementSetId>
</Row>
</Modifiers>
<ModifierStrings>
<Row ModifierId="PLUS_X_WHEN_DEFENDING_COMBAT_NAVAL_BONUS" Context="Preview" Text="PLUS_X_WHEN_DEFENDING_COMBAT_NAVAL_BONUS_DESC"/>
</ModifierStrings>
<ModifierArguments>
<Row>
<ModifierId>PLUS_X_WHEN_DEFENDING_COMBAT_NAVAL_BONUS</ModifierId>
<Name>Amount</Name>
<Value>20</Value>
</Row>
</ModifierArguments>
<RequirementSets>
<Row>
<RequirementSetId>PLAYER_IS_NAVAL_DEFENDER_REQUIREMENTS_SET</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
</RequirementSets>
<RequirementSetRequirements>
<Row>
<RequirementSetId>PLAYER_IS_NAVAL_DEFENDER_REQUIREMENTS_SET</RequirementSetId>
<RequirementId>PLAYER_IS_DEFENDER_REQUIREMENTS</RequirementId>
</Row>
</RequirementSetRequirements>
</GameInfo>
MOD_Units.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<GameInfo>
<Tags>
<Row Tag="CLASS_NAVAL_DEFENSE_BONUS" Vocabulary="ABILITY_CLASS"/>
</Tags>
<!-- Enter all the naval units here -->
<TypeTags>
<Row Type="UNIT_GALLEY" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_NORWEGIAN_LONGSHIP" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_CARAVEL" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_IRONCLAD" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_DESTROYER" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_QUADRIREME" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_FRIGATE" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_BATTLESHIP" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_BRAZILIAN_MINAS_GERAES" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_BARBARIAN_RAIDER" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_PRIVATEER" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_ENGLISH_SEADOG" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_SUBMARINE" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_GERMAN_UBOAT" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_NUCLEAR_SUBMARINE" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
<Row Type="UNIT_AIRCRAFT_CARRIER" Tag="CLASS_NAVAL_DEFENSE_BONUS"/>
</TypeTags>
</GameInfo>
Ultimately I would like this mod to allow embarked land units to be destroyed more easily. My first approach was to give the ocean and coast tiles a -20 defense modifier, and giving it back to true naval units with the above code.
Giving embarked units a direct negative defense modifier would be the more direct approach. I have identified a couple of potential requirements for this (REQUIREMENT_OPPONENT_UNIT_DOMAIN_MATCHES, OPPONENT_IS_LAND_UNIT_REQUIREMENTS, REQUIRES_TERRAIN_OCEAN, REQUIRES_TERRAIN_COAST), but if I don't even get the above to work, progressing to defining new custom requirements doesn't make much sense.