Tom Jones
N/A
- Reaction score
- 437
No wonder, your destroying the triggers.
Also that code is a mess, please clean it up. For example:
And there's a whole bunch of those excessive calls. If I were you, I would put everything in three functions: Initialization function, trigger actions function, and timer actions function. It may be hard with your current jass knowledge, but it'll definitely teach you a lot. You should make your main trigger register all the events, and then determine the eventid of a instance in the trigger actions function:
Also that code is a mess, please clean it up. For example:
JASS:
private function Trig_AimTimer_Actions takes nothing returns nothing
call Exec(AimStop) //Why not simply ExecuteTrigger(AimStop)
call DestroyTimer(GetExpiredTimer())
endfunction
JASS:
function SomeFunction ...
if GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_EFFECT then
//Perform actions, etc. starting a timer.
elseif GetTriggerEventId() == EVENT_PLAYER_UNIT_SPELL_ENDCAST then
//Perform actions, etc. stopping a timer.
endif
endfunction
function InitTrig_...
local integer i = 0
local integer a = GetPlayers()
set SomeTrigger = CreateTrigger()
loop
exitwhen i > a
call TriggerRegisterPlayerUnitEvent(SomeTrigger,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
call TriggerRegisterPlayerUnitEvent(SomeTrigger,Player(i),EVENT_PLAYER_UNIT_SPELL_ENDCAST,null)
set i = i+1
endloop
call TriggerAddAction(SomeTrigger,function SomeFunction)
endfunction