AW Arcaeca
Deus Vult
Those are two things I need quite a lot, but never actually know how to do.
For example, in an upcoming civ, the UU has this effect:
"+10% combat if it starts its turn adjacent to another *New Unit Name*. +15% combat if it starts its turn within 2 tiles of an enemy capital."
Hopefully that's not UP.
Anyway I ran into some problems whilst coding it. This is only a fragment of the code, i.e. not the +10% clause because that's already done and without problems.
My main issues are:
1) This line:
Something tells me "Players" will require an extra parameter, but I don't know what. [iPlayer] immediately after it?
2) The event hook (I think that's what it's called) - GameEvents.PlayerDoTurn.Add. It's the only one I know but it sounds incredibly inconvenient to move your unit next to an enemy city but have to wait until your next turn for the extra bonus. Is anyone aware of a hook that fires when a unit is moved?
3) A better unit idea.
Also it's worth pointing out that the unit isn't intended to have a bonus directly against cities (which is stealing the mandekalu's ability) but rather just in proximity of them, sort of to protect your melee/archery/siege units.
Any ideas?
TIA
For example, in an upcoming civ, the UU has this effect:
"+10% combat if it starts its turn adjacent to another *New Unit Name*. +15% combat if it starts its turn within 2 tiles of an enemy capital."
Hopefully that's not UP.
Anyway I ran into some problems whilst coding it. This is only a fragment of the code, i.e. not the +10% clause because that's already done and without problems.
Code:
GameEvents.PlayerDoTurn.Add(
function(playerID)
pPlayer = Players[playerID]
if (pPlayer:IsAlive()) then
for pUnit in pPlayer:Units() do
for iPlayer in Players do
if (Teams[pPlayer:GetTeam()]:IsAtWar(Teams[iPlayer:GetTeam()]) then
if (pUnit:GetUnitType() == GameInfoTypes.UNIT_NEWUNIT) then
if (Map.PlotDistance(pUnit:GetX(), pUnit:GetY(), iPlayer:GetCapitalCity:GetX(), iPlayer:GetCapitalCity:GetY()) >= 2) then
pUnit:SetHasPromotion(GameInfoTypes.PROMOTION_NEWUNIT_SPECIFIC_PROMOTION, true)
else
pUnit:SetHasPromotion(GameInfoTypes.PROMOTION_NEWUNIT_SPECIFIC_PROMOTION, false)
end
end
end
end
end
end
end)
1) This line:
Code:
for iPlayer in Players do
2) The event hook (I think that's what it's called) - GameEvents.PlayerDoTurn.Add. It's the only one I know but it sounds incredibly inconvenient to move your unit next to an enemy city but have to wait until your next turn for the extra bonus. Is anyone aware of a hook that fires when a unit is moved?
3) A better unit idea.

Any ideas?
TIA
