Warcraft III resources & community, 2003–2006 · archived

IterateForce

not rated
Submitted by AltSubmitterExecution0 downloads
Similar to IterateGroup, lets you iterate through a force without using a call to ForForce, so you can reference locals without worry, and if you want to do a player group within a playergroup while keeping the original reference to GetEnumPlayer use this for the second grouping.

Source

//Ignore this function, just make sure it comes first in script
//Actually make calls to the second function below.
function IterateForce_Enum takes nothing returns nothing
    if ( bj_forceRandomConsidered == 0 ) then
        set bj_forceRandomCurrentPick = GetEnumPlayer()
    endif
    set bj_forceRandomConsidered = bj_forceRandomConsidered - 1
endfunction

function IterateForce takes force whichForce, integer playerIndex returns player
    set bj_forceRandomCurrentPick = null
    set bj_forceRandomConsidered  = playerIndex
    call ForForce( whichForce, function IterateForce_Enum )
    return bj_forceRandomCurrentPick
endfunction

Comments

0

No comments.