• Check out the results of the Techtree Contest #19!
  • 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 void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Solved] Elapsed Game Timer

Status
Not open for further replies.
My bad I forgot for a second how timers work and they only work by counting down xD.
Here's how to do it.
  • Elapse time
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Second = (Second + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Second Equal to 60
        • Then - Actions
          • Set Second = 0
          • Set Minute = (Minute + 1)
        • Else - Actions
 
This is best way I seen :

1, make a timer variable call "Time".
2, after game start, created a timer that expired in 9999 seconds (this timer is "Time".)
3, you can read elapsed time on "Time" variable at any time, and use it as "time passed" in your game.
 
My bad I forgot for a second how timers work and they only work by counting down xD.
Here's how to do it.
  • Elapse time
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Second = (Second + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Second Equal to 60
        • Then - Actions
          • Set Second = 0
          • Set Minute = (Minute + 1)
        • Else - Actions

Ok, I need to know how the part: (Second +1) is put into the variables? From what i can see from this is that: Set Second = (Second +1), can i use two different variables for this? Example: make Set Second to Seconds?
 
the (Second + 1) part is an Arithmetic function. look for it in the scroll down when setting the variable. and why do you want to use 2 variables for it? if you want it to be Seconds then just use the variable Seconds instead of setting Second to Seconds (Set Seconds = Seconds + 1)
 
This is best way I seen :

1, make a timer variable call "Time".
2, after game start, created a timer that expired in 9999 seconds (this timer is "Time".)
3, you can read elapsed time on "Time" variable at any time, and use it as "time passed" in your game.
Actualy that is less efficient as it is triggering every .01 seconds instead of every 1 second.
 
Status
Not open for further replies.
Back
Top