I'm having a hard time getting long loops to run properly in my maps, and I have been unable to find any information about this phenomenon on the Internet.
My question is: Why does ex3 hang/crash/break when the code is obviously correct? (This also goes for various nested loops when the number of iterations is too high). Any help would be greatly appreciated.
Code:
// This will run without problems
function ex1 takes nothing returns nothing
local integer i = 0
loop
set i = i + 1
if i == 5 then
call DoNothing()
endif
exitwhen i == 2000
endloop
endfunction
// This will also run without problems
function ex2 takes nothing returns nothing
local integer i = 0
loop
set i = i + 1
// if i == 5 then
// call DoNothing()
// endif
exitwhen i == 20000
endloop
endfunction
// This function will never finish
function ex3 takes nothing returns nothing
local integer i = 0
loop
set i = i + 1
if i == 5 then
call DoNothing()
endif
exitwhen i == 20000
endloop
endfunction
My question is: Why does ex3 hang/crash/break when the code is obviously correct? (This also goes for various nested loops when the number of iterations is too high). Any help would be greatly appreciated.