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

[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
 
Level 9
Joined
Apr 26, 2011
Messages
403
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.
 
Level 2
Joined
Sep 1, 2011
Messages
20
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?
 
Level 8
Joined
Jan 8, 2010
Messages
493
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.
Top