| 03-06-2003, 05:38 PM | #1 |
For some reason, putting Wait actions (TriggerSleepAction) into a callback function seems to cause BIG TROUBLE. For example, let's say I code this. Code:
function CrappyFunction takes nothing returns nothing
local unit KillMe = GetEnumUnit()
call TriggerSleepAction(1.00)
call KillUnit( KillMe )
endfunction
function Trig_BoddoZerg_Actions takes nothing returns nothing
call ForGroup( udg_KillThisGroup, function CrappyFunction )
endfunctionWhat happens when the trigger "BoddoZerg" is fired is - exactly nothing! None of the units in "KillThisGroup" ever die. In fact, if I re-coded CrappyFunction like this: Code:
function CrappyFunction takes nothing returns nothing
call DisplayTextToForce(GetPlayersAll(), "Before Wait")
call TriggerSleepAction(1.00)
call DisplayTextToForce(GetPlayersAll(), "After Wait")
endfunctionSeems like the eternally-problematic Wait has even more trouble within Callback routines. =( (How can Blizzard mess up something as simple as "Wait X Seconds"?) |
| 03-06-2003, 07:13 PM | #2 |
Guest | Have you found a work around? If not, you could use a loop like this... Code:
function CrappyFunction takes unit kill_me returns nothing
call TriggerSleepAction(1.00)
call KillUnit( kill_me )
endfunction
function Trig_BoddoZerg_Actions takes nothing returns nothing
local integer i = 1
local integer exit
local group crap_units = CreateGroup()
local unit kill_me
set crap_units = udg_KillThisGroup
set exit = UnitsInGroup(crap_units) // * func name?
loop
exitwhen i > exit
set kill_me = GetRandomUnitInGroup(crap_units) // * func name?
call CrappyFunction(kill_me)
call RemoveUnitFromGroup(kill_me, crap_units) // * func name?
set i = i + 1
endloop
endfunctionI'm using similar functions to this in my triggers to grab specific units out of a unit group. Seems to out fine. |
