• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Local Timers

Status
Not open for further replies.
Level 14
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