- Joined
- Nov 30, 2007
- Messages
- 1,202
Trigger A has a section which adds a unit to a unit group and then starts trigger B if it's already not running:
Trigger B periodiacally does some work and then disables itself once the unit group is empty:
It works fine the first time around, however after trigger B is done and disables properly, and then trigger A adds a new unit to the unit group and enables the trigger it disables instantly rather than doing work like the previous run.
Any ideas?
A session looks like this:
STARTED
working...
working...
working...
DISABLED
STARTED
DISABLED
As illustrated the second time it just disables instantly.
JASS:
...
call GroupAddUnit(udg_FS_flames, flame)
if (IsTriggerEnabled(gg_trg_UpdateFlames) == false) then
call EnableTrigger(gg_trg_UpdateFlames)
endif
Trigger B periodiacally does some work and then disables itself once the unit group is empty:
JASS:
function FlamesIterator takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 10., "working...")
endfunction
function Trig_UpdateFlames_Actions takes nothing returns nothing
local unit u = FirstOfGroup(udg_FS_flames)
if (FirstOfGroup(udg_FS_flames) == null) then
call DisableTrigger(gg_trg_UpdateFlames)
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 10., "DISABLED")
else
call ForGroup(udg_FS_flames, function FlamesIterator)
endif
endfunction
//===========================================================================
function InitTrig_UpdateFlames takes nothing returns nothing
set gg_trg_UpdateFlames = CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_UpdateFlames, 0.5, true)
call TriggerAddAction(gg_trg_UpdateFlames, function Trig_UpdateFlames_Actions)
call DisableTrigger(gg_trg_UpdateFlames)
endfunction
It works fine the first time around, however after trigger B is done and disables properly, and then trigger A adds a new unit to the unit group and enables the trigger it disables instantly rather than doing work like the previous run.
Any ideas?
A session looks like this:
STARTED
working...
working...
working...
DISABLED
STARTED
DISABLED
As illustrated the second time it just disables instantly.
Last edited: