- Joined
- Sep 14, 2009
- Messages
- 284
In this small section of a trigger I have a loop that never ends and I don't know why. The message in the loop gives 2, 2, 2... and so on and then just stops but the "Loop end" is never displayed.
EDIT: Solved. Thanks Ceday.
JASS:
function CombatLostDialogButton01_Actions takes nothing returns nothing
local group g
local unit u
//----------
set g = GetUnitsInRectAll(udg_CombatRect)
set u = FirstOfGroup(g)
call DisplayTextToForce(GetPlayersAll(), "Loop start")
loop
exitwhen CountUnitsInGroup(g) == 0
set u = FirstOfGroup(g)
call RemoveUnit(u)
call DisplayTextToForce(GetPlayersAll(), I2S(CountUnitsInGroup(g)))
endloop
call DisplayTextToForce(GetPlayersAll(), "Loop end")
call DestroyGroup(g)
set g = null
set u = null
endfunction
EDIT: Solved. Thanks Ceday.
Last edited: