I created the following event:
--Sarajevo Withdrawal
function SarajevoWithdrawal ()
local austria = game: GetFactionById (3)
local sarajevo = game: GetHex (106, 40)
if sarajevo.alliance.id == 2 and austria.alliance.id == 2 then
if GetEvent ("SarajevoBattle")> 0 then
if GetEvent ("SarajevoWithdrawal") == 0 then
local hexes = game.map:GetHexesInRange(sarajevo, 2)
for _, hex in pairs (hexes) of
if hex.unit ~ = nil and hex.unit.alliance.id == 2 then
SetEvent ("SarajevoWithdrawal", game.turn)
break
end
end
end
end
end
end
The "SarajevoBattle" event works very well. But as much as Serbian troops are more than two hexes apart, the "SarajevoWithdrawal" event does not appear during the game. What would be wrong?
