So I need to pick a random unit from group.
I have take a look at GroupPickRandomUnitEnum but I can't understand it.
bj_groupRandomConsidered is probably already set before this action is run. I see no function calls to that.
Now this line is quite... special.
What I can tell from that line is it will always pick the first unit. If = 1.
But how can this when be random if it always picks the same unit.
And what if it fails? No picked unit then?
Or have I miss understand it?
I have take a look at GroupPickRandomUnitEnum but I can't understand it.
JASS:
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
bj_groupRandomConsidered is probably already set before this action is run. I see no function calls to that.
JASS:
if (GetRandomInt(1,bj_groupRandomConsidered) == 1) then
Now this line is quite... special.
What I can tell from that line is it will always pick the first unit. If = 1.
But how can this when be random if it always picks the same unit.
And what if it fails? No picked unit then?
Or have I miss understand it?