Thread: AbilityPreload
View Single Post
Old 08-30-2010, 01:16 PM   #46
Bribe
User
 
Bribe's Avatar
 
Join Date: Mar 2010
Posts: 233

Submissions (1)

Bribe will become famous soon enough (30)Bribe will become famous soon enough (30)

Send a message via AIM to Bribe
Default

Collapse JASS:
function AbilityRangePreload takes integer start, integer end returns nothing
    local integer i = 1
        if start > end then
            set i = -1
        endif
        loop
            exitwhen start > end
            call UnitAddAbility(PreloadUnit, start)
            set start = start + i
        endloop
endfunction

I don't know what you intended to do with that integer i, but in its current state this whole function should just retain the loop alone and yet do the exact same thing;

Collapse JASS:
function AbilityRangePreload takes integer start, integer end returns nothing
    loop
        exitwhen start > end
        call UnitAddAbility(PreloadUnit, start)
        set start = start + 1
    endloop
endfunction

Perhaps you meant to do this?:

Collapse JASS:
function AbilityRangePreload takes integer start, integer end returns nothing
    local integer i = 1
    if (start > end) then
        set i = -1
    endif
    loop
        call UnitAddAbility(PreloadUnit, start)
        exitwhen start == end
        set start = start + i
    endloop
endfunction
Bribe is offline   Reply With Quote
Sponsored Links - Login to hide this ad!