Oh dear...your script is severely messed up.
Important: you cannot just set a unit.mp to 0 via events, this will not work but must be done in:
function SetUnitMovePenalty(unit)
which is in:
game_supply.lua
For the effect you described I would try add this to the end of function SetUnitMovePenalty(unit)
Code: Select all
local basra = game:GetHex(157, 68)
local hexes = game.map:GetHexesInRange(basra, 2)
for _, hex in pairs(hexes) do
if hex.unit ~= nil
and hex.unit.alliance.id == 1 then
if basra.unit ~= nil
and and basra.unit.type == Unit.LAND
and basra.unit.alliance.id = 2 then
basra.unit.mp = 0
break
end
end
end
By the way: the method GetHexesInRange(target, radius) always checks the center hex (in this case basra) too!