Thanks for the tutorial. I just read the top and I will read the bottom later. But I have a question: I saw the first comment and it's was writted:
''Timers shouldn't be destroyed but recycled, really. It saves us of all the esoteric things about when to set timers to null.''
Does this mean I should always recycle it ( set t = null ) or I can destroy it ( call DestroyTimer(t) )?
Added (2009-01-17, 11:26 Pm)
---------------------------------------------
OMG!
I have no JASS error. BUT! when the timer is done, I have an acces violation ( that is the name in french ).
I think in english it's violation acces something like that. And I don't know why I have this stupid thing ( that close my wc3 ).
Can you help me? There is my code:
function cheese takes unit u ,real z returns nothing
call UnitAddAbilityBJ( 'Amrf', u )
call SetUnitFlyHeightBJ( u, z, 200.00 )
endfunction
function thunder takes unit u, string s returns nothing
local timer t = GetExpiredTimer()
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 10
loop
call AddSpecialEffectTargetUnitBJ( "origin", u, s )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call TriggerSleepAction( 0.50 )
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyTimer( t)
set t = null
endfunction
function Trig_explosion_Actions takes nothing returns nothing
local string s = "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl"
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
call TimerStart( t, 0.50, FALSE, function thunder)
call cheese( u, 1000 )
set t = null
endfunction
Added (2009-01-17, 11:41 Pm)
---------------------------------------------
Woot. Sorry for the triple post, but I started a new trigger and i had no error with the timer. So question 2 is done.