- Joined
- Sep 19, 2006
- Messages
- 152
I've gotten a great deal of outdated or even conflicting information regarding timers. To date I've been using the PolledWait function, but am trying to correct my work-in-progress to the timer function instead. Even my JassCraft program allows commands that the World Editor refuses to recognize.
Basically, I'm looking for a working example of a way to carry either the triggering unit (or even just the player number of the triggering unit) from the base trigger to the function activated by the expiring trigger. I've been flooded with links to various tutorials; I really think I could learn the most effectively from an actual example of what the working trigger should look like. In other words, I'd like someone to write in the few lines needed to transfer the pertinent information from Action01 of the trigger to Action02. Thanks!
Basically, I'm looking for a working example of a way to carry either the triggering unit (or even just the player number of the triggering unit) from the base trigger to the function activated by the expiring trigger. I've been flooded with links to various tutorials; I really think I could learn the most effectively from an actual example of what the working trigger should look like. In other words, I'd like someone to write in the few lines needed to transfer the pertinent information from Action01 of the trigger to Action02. Thanks!
JASS:
function SorceressAbilities_Action02 takes nothing returns nothing
local timer T = GetExpiredTimer ()
local unit caster // <---- this is the unit I need to define
//
if GetUnitAbilityLevel (caster, 'BEfn') == 0 then
call DestroyTimer (T)
call SetUnitAbilityLevel (caster, 'A08C', 1)
endif
set T = null
endfunction
function SorceressAbilities_Action01 takes nothing returns nothing
local integer abil = GetSpellAbilityId ()
local unit caster
local timer T
//
if abil == 'A08D' or abil == 'A0A3' then
set caster = GetSpellAbilityUnit ()
else
return
endif
call SetUnitAbilityLevel (caster, 'A08C', 2)
set T = CreateTimer ()
call TimerStart (T, 0.50, true, function SorceressAbilities_Action02)
set T = null
set caster = null
endfunction
function InitTrig_SorceressAbilities takes nothing returns nothing
set gg_trg_SorceressAbilities = CreateTrigger ()
call TriggerRegisterPlayerUnitEvent (gg_trg_SorceressAbilities, Player (1), EVENT_PLAYER_UNIT_SPELL_FINISH, null)
call TriggerRegisterPlayerUnitEvent (gg_trg_SorceressAbilities, Player (2), EVENT_PLAYER_UNIT_SPELL_FINISH, null)
call TriggerRegisterPlayerUnitEvent (gg_trg_SorceressAbilities, Player (3), EVENT_PLAYER_UNIT_SPELL_FINISH, null)
call TriggerAddAction (gg_trg_SorceressAbilities, function SorceressAbilities_Action01)
endfunction