HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why does compiling this code crash WE?

09-01-2003, 07:48 PM#1
FyreDaug
Code:
function Trig_Poisoned_Countdown_Actions takes nothing returns nothing
local integer a = 1
local integer b = 1
    loop
        exitwhen (a > 3)
        call ForGroupBJ( udg_GameUNITGROUPPoisGroup[GetForLoopIndexA()], call SetUnitUserData( GetEnumUnit(), ( GetUnitUserData(GetEnumUnit()) - 1 ) )
        set a = a + 1
    endloop
    if ( not ( GetUnitUserData(GetEnumUnit()) == 0 ) ) then
        loop
            exitwhen (b > 60)
            call GroupRemoveUnitSimple( GetEnumUnit(), udg_GameUNITGROUPPoisGroup[b] )
            b = b + 1
        endloop
    else
    endif
endfunction

//===========================================================================
function InitTrig_Poisoned_Countdown takes nothing returns nothing
    set gg_trg_Poisoned_Countdown = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Poisoned_Countdown, 0.50 )
    call TriggerAddAction( gg_trg_Poisoned_Countdown, function Trig_Poisoned_Countdown_Actions )
endfunction

I think I made a stupid mistake somewhere, but I don't see it.
09-01-2003, 08:25 PM#2
meowmints
I think ForGroupBJ should use a function instead of a call (It's missing a parenthesis on the end I think from cutting and pasting, and you can stick everything from your if statement there, or else your "if ( not (GetUnitUserData(GetEnumUnit() == 0)" wouldn't work. Also the b = b + 1 is missing "set". Also you used blizz global "A" to refer to your array but you counted the loop with a local "a".

I think the crash comes from the b = b + 1 tho in this case.