| 08-05-2003, 12:03 AM | #1 |
I don't know if anyone solved this yet, but I read in a post that someone needed this, so I found a simple solution to the ForForce(...) problem, of not alowing you to use local variables. The only catch is it might produce a bit more lag than normal (then again sence there normally isn't any, it shouldn't even be noticable) Code:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local integer iA
local integer jA
local integer iB
local integer jB
local unit random_unit
local unit array unit_list
local boolean already_picked
set iA = 1
set jA = CountUnitsInGroup(GetUnitsInRectAll(GetPlayableMapRect()))
loop
exitwhen iA > jA
set random_unit = GroupPickRandomUnit(GetUnitsInRectAll(GetPlayableMapRect()))
set already_picked = false
set iB = 1
set jB = iA
loop
exitwhen iB > jB
if ( unit_list[iB] == random_unit ) then
set already_picked = true
endif
set iB = iB + 1
endloop
if ( already_picked == false ) then
set unit_list[iA] = random_unit
set iA = iA + 1
endif
endloop
set iA = 1
loop
exitwhen iA > iJ
// Do Picked Unit actions here
// Except use unit_list[iA] where you use GetEnumUnit()
endloop
endfunction |
