• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Local Timers

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
I want to use a local timer to set up a periodic event that does a random curse on any random unit in a unit group.

I don't really know how to do periodic timers though, nor am I entirely sure how to set up a local timer.

Here's the jist of it. Every 0.75 seconds after the spell is cast, a random unit that was in the unit group nearby the caster is selected to recieve either a debuff curse, or is issued some odd command like attacking it's ally or whatever. It's a Voodoo Curse. At 5.25 seconds, the spell concludes and every unit in the unit group is ordered to stop.

Now I just need to figure a way to set up a local timer or a local trigger using periodics to do this. I say locals because it has to be MUI.

Thanks for the help :D
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
JASS:
function callback takes nothing returns nothing 
// callback functions can't take nor return parameters

// put your actions here

endfunction

function caller takes <something> returns <something>
    local timer t = CreateTimer()

    // TimerStart(timer t, real delay, boolean periodic, function callback)
    call TimerStart(t,0.75,true,function callback)
    
    // notice that without calling the DestroyTimer function, the timer will continue
    // to run until you exit the game in case you set it to periodic
    set t = null;
endfunction
 
Status
Not open for further replies.
Top