• 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.

Timer Events and Using Variables

Status
Not open for further replies.
Level 3
Joined
Feb 25, 2007
Messages
22
So I'm attempting to create a periodic timer event that sends a message every X seconds. However, I want X to be adjustable. How would I go about doing this?

I tried using different unit properties (acquisition range, movement speed, custom value) because they can all be adjusted using trigger actions, but when using them in an event they all turned out a value of 0.000 and crashed Warcraft. I know I could do this with several different versions of the same trigger, but once again, it just seems like there should be an easier way.

Any help would be appreciated, thanks.
 
Level 10
Joined
Jan 21, 2007
Messages
576
Sadly i dont think you can change the periodic time ingame, it cant be done with variables, i was gona suggest doing the movement speed idea but you already dismissed that, this might be possible in jass though. Im not very versed in jass so >.> try and pm a mod, or someone you know knows jass.
 
Just create a trigger with the event of the map initialisation and create a wait action at the end with your value ( which can be changed ) before you run the same trigger again
( sth like this : )
  • Game - Display to (All players) the text: Huhu
  • Wait (Random real number between 0.00 and 100.00) seconds
  • Trigger - Run (This trigger) (checking conditions)
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
I think this trigger might work... didn't test it yet (and it might not be accurate to 1 second), have never done such a trigger before, but whatever:

These are my variables:
Game_Timer = Integer (default : 0)
Adjustable_Timer = Integer (default : Whatever number should be the default)

Events:
Every 1 second of game time
Conditions:
none
Actions:
Set Game_Timer = (Game_Timer + 1)
If:
Game_Timer equals Adjustable_Timer
then:
Game - display to all players the message "blabla"
Set Game_Timer = 0
else: Do nothing

In a 2nd trigger, whenever you want the periodic event time to change, do:

Events:
whatever
Actions:
Set Adjustable_Timer = X (choose X)

If you want to reduce possible lag, change the event in Trigger 1 to "every 2 seconds" and "set Game_timer = Game_Timer + 2", but then accuracy will be lowered ofcourse
 
Status
Not open for further replies.
Top