- Joined
- Dec 12, 2012
- Messages
- 1,007
Hi,
well the title basically says it all.
Why does this work:
but this not?
Is anything known about that strange behaviour?
lfh
well the title basically says it all.
Why does this work:
JASS:
library LifeChangeEvent initializer i
globals
private trigger LifeChangeEvent
endglobals
private function LifeChangeEvent_Actions takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0.0, 0.0, 10.0, "Unit life changed!")
endfunction
private function MapInit_Actions takes nothing returns nothing
call TriggerRegisterUnitStateEvent(LifeChangeEvent, GetEnumUnit(), UNIT_STATE_LIFE, GREATER_THAN, GetWidgetLife(GetEnumUnit()))
endfunction
private function i takes nothing returns nothing
local group g = CreateGroup()
set LifeChangeEvent = CreateTrigger()
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
call ForGroup(g, function MapInit_Actions)
call TriggerAddAction(LifeChangeEvent, function LifeChangeEvent_Actions)
call DestroyGroup(g)
set g = null
endfunction
endlibrary
but this not?
JASS:
library LifeChangeEvent initializer i
globals
private trigger LifeChangeEvent
endglobals
private function LifeChangeEvent_Actions takes nothing returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0.0, 0.0, 10.0, "Unit life changed!")
endfunction
private function MapInit_Actions takes nothing returns nothing
// Here is the only difference
call TriggerRegisterUnitStateEvent(LifeChangeEvent, GetEnumUnit(), UNIT_STATE_LIFE, LESS_THAN, GetWidgetLife(GetEnumUnit()))
endfunction
private function i takes nothing returns nothing
local group g = CreateGroup()
set LifeChangeEvent = CreateTrigger()
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
call ForGroup(g, function MapInit_Actions)
call TriggerAddAction(LifeChangeEvent, function LifeChangeEvent_Actions)
call DestroyGroup(g)
set g = null
endfunction
endlibrary
Is anything known about that strange behaviour?
lfh