I have this code that I'm working on. And It seems that it keeps crashing when i try to remove the unit. jass below
This works when I comment in the remove unit function.
However, when it removes the unit it crashes the game. Any help will be appreciated.
This works when I comment in the remove unit function.
JASS:
set i = 0
loop
exitwhen i>0
if (GetPlayerSlotState(Player(i)) == PLAYER_SLOT_STATE_PLAYING) then
if (GetPlayerController(Player(i)) == MAP_CONTROL_USER) then
set point = Location(GetUnitX(udg_selection_hero[i+1]),GetUnitY(udg_selection_hero[i+1]))
call special_effect(fx,point)
call BJDebugMsg("LOOP RAN")
//call RemoveUnit(udg_selection_hero[i+1])
endif
endif
set i = i + 1
endloop
However, when it removes the unit it crashes the game. Any help will be appreciated.