• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Upwards Counting Timer

Level 8
Joined
Jun 30, 2010
Messages
259
Upwards Counting Timer

Okay, so in this tutorial, I am going to show you how to make a countdown timer that increases in time instead of decreasing. This type of timer can be used in several games such as survivals or in any map that displays game time.

Requirements:

  • Knowledge about countdown timers
  • Knowledge about the trigger editor
  • Warcraft III World Editor

The Variables

  • A Timer variable to be able to update the timer we are working with. Make it an array-variable if you need more then one timer. (For more than one player).
  • A Timer Window variable to remove leaks, if we need to. Again, make it an array-variable if you have more than one timer.
  • A Real variable to count seconds. This is the variable which lets us set what the timer should display. Make it an array-variable if you need more than one. (If you have more than one timer, you don't need to make this an array, if you are, for example, making a survival timer which stops when a unit dies, then you can simply turn off the trigger that makes that specific timer count. Otherwise, ff you have more than one trigger, make it an array)

Okay, I am naming my Timer variable "Time", my Timer Window variable "Time_Window", and my Real variable "Seconds".

The Triggers

Okay, time to start triggering!
First things first, we need to make a Timer Window where the time is displayed.

  • Time Window
    • Events
      • Time - Elapsed game time is 1.00 seconds.
    • Conditions
    • Actions
      • Countdown Timer - Create a timer window for Time with title Time Elapsed:
      • Set Time_Window = (Last created timer window)
Now we have a timer window, but it is stuck at zero, so we need a trigger where each second updates the timer with a new number. It should look something like this:

  • Time Update
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Seconds = (Seconds + 1)
      • Countdown Timer - Start Time as a one-shot timer that will expire in Seconds seconds
      • Countdown Timer - Pause Time
That's it! Now you have an upward counting countdown timer.
If you wanted one timer for each player, make sure you set all your timers to update, and not only the first one.

Some things you might want to think about when making an upward counting countdown timer is that it CAN be used to trigger events.

For example, when one minute has passed, you want a tome to become available at the center of the map. Then, just add a new piece to the "Time Update" trigger.

  • Time Update
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Seconds = (Seconds + 1)
      • Countdown Timer - Start Time as a one-shot timer that will expire in Seconds seconds
      • Countdown Timer - Pause Time
      • If (All conditions are True) then do (Then actions) else do (Else actions)
        • If - Conditions
          • Seconds Equal to 60.00
        • Then - Actions
          • Set TomeLocation = Center of (Playable map area)
          • Item - Create Tome of Power at TomeLocation
          • Custom script: call RemoveLocation(udg_TomeLocation)
This can be used in almost any way. Use it wisely!
 
Last edited by a moderator:
Top