trb92
Throwing science at the wall to see what sticks
- Reaction score
- 142
This trigger is in my map, but it doesn't work properly.
What it should do is run the actions when there are no living units owned by Brown. However, what it does do is checks conditions, both BJDebugMsg's show, but the actions never run. I can't figure out why, when I test this the units are clearly dead and this looks like it should work.
Thanks for any help I might get.
JASS:
function NextLevel_Filter takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) == Player(11) and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE) <= 0)
endfunction
function Trig_NextLevel_Conditions takes nothing returns boolean
local group g = CreateGroup()
local integer i = 0
local unit u
call BJDebugMsg("Next Level Condition Runs")
call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,Condition(function NextLevel_Filter))
loop
set u = FirstOfGroup(g)
exitwhen u == null
set i = i + 1
call GroupRemoveUnit(g,u)
endloop
call BJDebugMsg("There are " +I2S(i) + " units")
call DestroyGroup(g)
set g = null
set u = null
return ( i < 1)
endfunction
function Trig_NextLevel_Actions takes nothing returns nothing
call BJDebugMsg("Next Level Runs")
call TimerStart(SpawnTimer,30,false,null)
call DestroyTimerDialog(TD)
set TD = CreateTimerDialog(SpawnTimer)
call TimerDialogSetTitle(TD,"Level " + I2S(Level) + " starts in: ")
call TimerDialogDisplay(TD,true)
endfunction
//===========================================================================
function InitTrig_NextLevel takes nothing returns nothing
set gg_trg_NextLevel = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent( gg_trg_NextLevel, Player(11), EVENT_PLAYER_UNIT_DEATH,null )
call TriggerAddCondition( gg_trg_NextLevel, Condition( function Trig_NextLevel_Conditions ) )
call TriggerAddAction( gg_trg_NextLevel, function Trig_NextLevel_Actions )
endfunction
What it should do is run the actions when there are no living units owned by Brown. However, what it does do is checks conditions, both BJDebugMsg's show, but the actions never run. I can't figure out why, when I test this the units are clearly dead and this looks like it should work.
Thanks for any help I might get.