The result of this event is supposed to disallow all french units to perform an attack during that turn (unit.ap = 0).
Code: Select all
-- Mutiny of french army
function FrenchMutiny()
if GetEvent("FrenchMutiny") == 0 then
local france = game:GetFactionById(0)
if game.date.year >= 1917 and france.morale < 50 and france.mp < 500 then
SetEvent("FrenchMutiny", game.turn)
for unit in france.units do
unit.ap = 0
end
end
end
end
So I suspect that either
a) my understanding of unit.ap = 0 is not what I suspected it to be, namely disallowing to execute an attack.
or
b) calls to functions in other scripts have been changed since the french Mutiny event was included, thus unit.ap = 0 isn't working anymore like it was originally intended.
or
c) it is just not sufficient to set unit.ap to 0 to prevent a unit from attacking, so the event has never been working correctly in the first place.
Any thoughts on this?
By the way: I also expected setting unit.mp ("movement points", which is not used in this example but in the "Kiel" and "Wilhelmshafen"-Mutiny Events) to "= 0" should(?) prevent a unit from moving by reducing it's movemt-allowance to zero. So I tried to apply "unit.mp = 0" in this event too but here I seemed to be wrong again, because all french units got to move their normal allowance.