bj_groupRandomCurrentPick??

Artificial

Without Intelligence
Reaction score
326
It's a global unit variable defined in Blizzard.j. It can be used in the exact same way as other globals are used, though I think declaring your own global should be preferred (for the sake of readability and safety (something else might use that bj_groupRandomCurrentPick, too)).
 

No_exit

Regular User (What is Custom User Title?)
Reaction score
40
The variable bj_groupRandomCurrentPick is used by the following built-in function:

JASS:
function GroupPickRandomUnit takes group whichGroup returns unit
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    set bj_groupRandomConsidered = 0
    set bj_groupRandomCurrentPick = null
    call ForGroup(whichGroup, function GroupPickRandomUnitEnum)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
    return bj_groupRandomCurrentPick
endfunction

function GroupPickRandomUnitEnum takes nothing returns nothing
    set bj_groupRandomConsidered = bj_groupRandomConsidered + 1
    if (GetRandomInt(1,bj_groupRandomConsidered) == 1) then
        set bj_groupRandomCurrentPick = GetEnumUnit()
    endif
endfunction


It just takes a group and returns a random unit from that group as you must have expected already from the name, maybe this function is what you needed?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top