anansethespider
Warlord
- Joined
- Oct 27, 2016
- Messages
- 288
Is there any way to do this outside of dll modding? For instance, to make a unit that gains +1 experience at the beginning of every turn.
Figuring out a proper Turn Trigger would be very helpful.
I have two civ traits on the back burner, because they require a unit to be on top of improvement 'X' in order to gain a yield of some sort. Everything is coded fine, except a trigger for the turn.
Closest thing is the MODIFIER_PLAYER_UNIT_ADJUST_HEAL_PER_TURN , or REQUIREMENT_GAME_TURN_ATLEAST, or EFFECT_ADJUST_INFLUENCE_POINTS_PER_TURN 'Types' that I can't seem to reverse engineer to get what I need.
<GameInfo>
<Row Type="GAIN_EXPERIENCE_EVERY TURN" Kind="KIND_ABILITY"/>
<Row Type="GAIN_EXPERIENCE_EVERY TURN" Tag="CLASS_CONSTANT_EXPERIENCE"/>
<Row Tag="CLASS_CONSTANT_EXPERIENCE" Vocabulary="ABILITY_CLASS"/>
<Row Type="UNIT_WARRIOR" Tag="CLASS_CONSTANT_EXPERIENCE"/>
</GameInfo>
<!-----------------------------------------------------------------------------------------------------------------
BASIC FORMULA
Modifier: MODIFIER_UNITS_ADJUST_GRANT_EXPERIENCE
OwnerRequirementSetId: ON_TURN_STARTED
SubjectRequirementSetId: UNIT_IS_A_WARRIOR (Not exactly necessary, but I needed this for testing)
----------------------------------------------------------------------------------------------------------------->
<GameInfo>
<UnitAbilityModifiers>
<Row>
<UnitAbilityType>GAIN_EXPERIENCE_EVERY_TURN</UnitAbilityType>
<ModifierId>BONUS_EXPERIENCE_PER_TURN_EVERY_TURN</ModifierId>
</Row>
</UnitAbilityModifiers>
<Modifiers>
<Row>
<ModifierId>BONUS_EXPERIENCE_PER_TURN_EVERY_TURN</ModifierId>
<ModifierType>MODIFIER_UNITS_ADJUST_GRANT_EXPERIENCE</ModifierType>
<OwnerRequirementSetId>ON_PLAYER_STARTING_THE_TURN</OwnerRequirementSetId>
<SubjectRequirementSetId>UNIT_IS_A_WARRIOR</SubjectRequirementSetId>
<RunOnce>false</RunOnce>
<Permanent>true</Permanent>
</Row>
</Modifiers>
<ModifierArguments>
<Row>
<ModifierId>BONUS_EXPERIENCE_PER_TURN_EVERY_TURN</ModifierId>
<Name>Amount</Name>
<Value>-1</Value>
</Row>
</ModifierArguments>
<RequirementSets>
<Row>
<RequirementSetId>ON_PLAYER_STARTING_THE_TURN</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
<Row>
<RequirementSetId>UNIT_IS_A_WARRIOR</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
</RequirementSets>
<RequirementSetRequirements>
<Row>
<RequirementSetId>ON_PLAYER_STARTING_THE_TURN</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_STARTED_TURN</RequirementId>
</Row>
<Row>
<RequirementSetId>UNIT_IS_A_WARRIOR</RequirementSetId>
<RequirementId>REQUIREMENT_UNIT_IS_A_WARRIOR</RequirementId>
</Row>
</RequirementSetRequirements>
<Requirements>
<Row>
<RequirementId>REQUIRES_PLAYER_STARTED_TURN</RequirementId>
<RequirementType>REQUIREMENT_PLAYER_TURN_STARTED</RequirementType>
</Row>
<Row>
<RequirementId>REQUIREMENT_UNIT_IS_A_WARRIOR</RequirementId>
<RequirementType>REQUIREMENT_UNIT_TYPE_MATCHES</RequirementType>
</Row>
</Requirements>
<RequirementArguments>
<Row>
<RequirementId>REQUIREMENT_UNIT_IS_A_WARRIOR</RequirementId>
<Name>UnitType</Name>
<Value>UNIT_WARRIOR</Value>
</Row>
</RequirementArguments>
</GameInfo>
<GameInfo>
<Types>
<Row Type="GAIN_EXPERIENCE_EVERY_TURN" Kind="KIND_ABILITY"/>
</Types>
<Tags>
<Row Tag="CLASS_CONSTANT_EXPERIENCE" Vocabulary="ABILITY_CLASS"/>
</Tags>
<TypeTags>
<Row Type="GAIN_EXPERIENCE_EVERY_TURN" Tag="CLASS_CONSTANT_EXPERIENCE"/>
<Row Type="UNIT_WARRIOR" Tag="CLASS_CONSTANT_EXPERIENCE"/>
</TypeTags>
<UnitAbilityModifiers>
<Row>
<UnitAbilityType>GAIN_EXPERIENCE_EVERY_TURN</UnitAbilityType>
<ModifierId>BONUS_EXPERIENCE_PER_TURN_EVERY_TURN</ModifierId>
</Row>
</UnitAbilityModifiers>
<Modifiers>
<Row>
<ModifierId>BONUS_EXPERIENCE_PER_TURN_EVERY_TURN</ModifierId>
<ModifierType>MODIFIER_UNITS_ADJUST_GRANT_EXPERIENCE</ModifierType>
<OwnerRequirementSetId>ON_PLAYER_STARTING_THE_TURN</OwnerRequirementSetId>
<SubjectRequirementSetId>UNIT_IS_A_WARRIOR</SubjectRequirementSetId>
<RunOnce>false</RunOnce>
<Permanent>true</Permanent>
</Row>
</Modifiers>
<ModifierArguments>
<Row>
<ModifierId>BONUS_EXPERIENCE_PER_TURN_EVERY_TURN</ModifierId>
<Name>Amount</Name>
<Value>5</Value>
</Row>
</ModifierArguments>
<RequirementSets>
<Row>
<RequirementSetId>ON_PLAYER_STARTING_THE_TURN</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
<Row>
<RequirementSetId>UNIT_IS_A_WARRIOR</RequirementSetId>
<RequirementSetType>REQUIREMENTSET_TEST_ALL</RequirementSetType>
</Row>
</RequirementSets>
<RequirementSetRequirements>
<Row>
<RequirementSetId>ON_PLAYER_STARTING_THE_TURN</RequirementSetId>
<RequirementId>REQUIRES_PLAYER_STARTED_TURN</RequirementId>
</Row>
<Row>
<RequirementSetId>UNIT_IS_A_WARRIOR</RequirementSetId>
<RequirementId>REQUIREMENT_UNIT_IS_A_WARRIOR</RequirementId>
</Row>
</RequirementSetRequirements>
<Requirements>
<Row>
<RequirementId>REQUIRES_PLAYER_STARTED_TURN</RequirementId>
<RequirementType>REQUIREMENT_PLAYER_TURN_STARTED</RequirementType>
</Row>
<Row>
<RequirementId>REQUIREMENT_UNIT_IS_A_WARRIOR</RequirementId>
<RequirementType>REQUIREMENT_UNIT_TYPE_MATCHES</RequirementType>
</Row>
</Requirements>
<RequirementArguments>
<Row>
<RequirementId>REQUIREMENT_UNIT_IS_A_WARRIOR</RequirementId>
<Name>UnitType</Name>
<Value>UNIT_WARRIOR</Value>
</Row>
</RequirementArguments>
</GameInfo>
<GameData>
<Types>
<Row Type="GAIN_EXPERIENCE_EVERY_TURN" Kind="KIND_ABILITY"/>
</Types>
<TypeTags>
<Row Type="GAIN_EXPERIENCE_EVERY_TURN" Tag="CLASS_CONSTANT_EXPERIENCE"/>
<Row Type="UNIT_WARRIOR" Tag="CLASS_CONSTANT_EXPERIENCE"/>
</TypeTags>
<Tags>
<Row Tag="CLASS_CONSTANT_EXPERIENCE" Vocabulary="ABILITY_CLASS"/>
</Tags>
<UnitAbilities>
<Row UnitAbilityType="GAIN_EXPERIENCE_EVERY_TURN" Name="LOC_ABILITY_ANTI_CAVALRY_NAME" Description="LOC_ABILITY_ANTI_CAVALRY_DESCRIPTION"/>
</UnitAbilities>
<UnitAbilityModifiers>
etc
function TestPlayerUnits(iPlayer, bIsFirstTime)
local pPlayer = Players[iPlayer]
if pPlayer:IsHuman() then
local pPlayerUnits = pPlayer:GetUnits()
for i, pUnit in pPlayerUnits:Members() do
if pUnit:GetType() ~= nil then
if pUnit:GetType() == GameInfo.Units["UNIT_WARRIOR"].Index then
pUnit:GetExperience():ChangeExperience(1)
end
end
end
end
end
Events.PlayerTurnActivated.Add(TestPlayerUnits)