- Joined
- Feb 28, 2007
- Messages
- 3,479
I've made a trigger that runs when the time becomes 6.00. It should change the level of an ability for a non-hero unit, but the level doesn't change. What've I done wrong this time?
JASS:
scope Day initializer Init
private function TypeFilter takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 'n003'
endfunction
private function Actions takes nothing returns nothing
local group g = CreateGroup()
local unit u
call GroupEnumUnitsOfPlayer(g,Player(0),Condition(function TypeFilter))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call SetUnitAbilityLevel(u,'A004',2)
call SetUnitAbilityLevel(u,'A00I',2)
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterGameStateEvent(t,GAME_STATE_TIME_OF_DAY,EQUAL,6.)
call TriggerAddAction(t,function Actions)
endfunction
endscope