Oh, now I understand...
You cannot do checks for stuff happening on the
SAME gameturn in PhaseStart(alliance) because PhaseStart(alliance) goes
BEFORE all events, so the check for
will never pass and that's the reason why the value for war effort has never changed.
What you could do is either put SetWarEffort(15, 60) directly into your event in function StandardDOW(attacker, defender)
Code: Select all
if GetEvent("DOWitaly") == game.turn then
SetEvent("SpainJoinsWar", game.turn)
end
if GetEvent("SpainJoinsWar") >0
and GetEvent("SpainJoinsWar") +2 == game.turn then
if italy.alliance.id == 2 then
local luck = math.random(1,6)
if luck <= 3 then
SetFactionAlignment(15, math.random(95,100))
SetEvent("SpainJoinsWar1", game.turn)
SetWarEffort(15, 60)
elseif luck > 3 and luck <= 5 then
SetEvent("SpainJoinsWar2", game.turn)
SetWarEffort(15, 60)
elseif luck == 6 then
SetFactionAlignment(15, math.random(0,5))
SetEvent("SpainJoinsWar3", game.turn)
SetWarEffort(15, 60)
end
end
end
or, if you absolutely want to use PhaseStart(alliance) then do a check for an event that lies in the
PAST like for example:
Code: Select all
if GetEvent("SpainJoinsWar") >0
and GetEvent("SpainJoinsWar") +2 == game.turn then
SetWarEffort(15, 60)
end
This WILL be checked because the event lies 2 turns in the past.
Note that any events that have not yet happened, and also events that do not even exist, have a value of 0 so you can
NOT just check for
Code: Select all
if GetEvent("SpainJoinsWar") +2 == game.turn then
SetWarEffort(15, 60)
end
because then the event would fire on turn 2 (0+2 = 2), that's why there's an additional check in the example for
Fascinating stuff, eh?
