Countdown Timer Tutorial

jonadrian619

-___-
Reaction score
240
Countdown Timers
by jonadrian619

Actually a basic tutorial for people looking further in making basic countdown timers.....
---------------------------------------------------------------------------------
Countdown Timer Introduction
Timers are only created through the use of Triggers. Timers are used to time or count down specific actions to change the perspectives of playing a game. Often, timers are used in Missions, Campaigns or Custom Maps created by other users. The expiry of the timer is what makes the timer useful. When the timer has expired, triggers with the event of the expiry of a timer will fire. Either it will fail the mission when it has expired or it will do another action like Next Wave (Useful in TDs), Wait, etc. There are various trigger actions of Timers. Most actions create a timer, or create a window, or even destroy a timer. You can even change the title of the Timer through triggers. What is good is that you can create multiple timers at the same time, but you'll need a dozen triggers to complete that task.

Creating the Core Essentials of a Timer
Always, when you create a timer, you have to need two Variables to make the timer function properly. Select the Variables button in the Trigger Editor (with the X), and select New Variable (Ctrl + N). In the dialog, type CountdownTimer (For an example, you can type any if you want), set it's Type to Timer. Then click Ok. Now you have a new Timer variable. Afterwards, create another variable for the timer window. Same as above, click the New Variable button, type only MyFirstTimerWindow.

NOTE: To avoid confusion, you need to add a 'Window' text after the name of a Timer Window variable (Ex. CountdownTimer + Window = CountdownTimerWindow)

Then set the variable type to 'Timer Window' this time. Click Ok, now you have 2 variables of timer and timer window. Afterwards, you'll be teached in how to create the timer in the trigger editor.

Creating the Timer
Now, go to the Trigger Editor, select the New Action button (Ctrl + R) and then create the action 'Countdown Timer - Start Timer'. Set it's expiry time and it's type, either a One Shot or Repeating timer. The rest will be shown...

NOTICE: Timer Windows can't show in map initialization. It is good to use events like 'Elapsed Game Time'.

Timer Type Fields:
One Shot Timer - When the timer expires, the timer will no longer repeat and in some cases the timer will be gone
Repeating Timer- When the timer expires, it will repeat back to it's initial expiry time.

Here's a sample Trigger in creating timers:
Code:
Countdown Timer Creation
          Events:
               Elapsed Game time is 1.00 seconds
          Conditions:
          Actions:
               Countdown Timer - Start CountdownTimer as a One-shot timer that will expire in 60.00 seconds
               Countdown Timer - Create a timer window for CountdownTimer with title Time Left
               Set CountdownTimerWindow = (Last created timer window)

That should create the timer. Always take note that when creating a timer, make sure that the event 'Map Initialization' is not used, or else the timer will not show.

You can also add a trigger that fires when the timer expires.
Code:
Countdown Timer Expiry
          Events:
               Time - CountdownTimer expires
          Conditions:
          Actions:
               ----------------Do anything here-----------------
               Game - Display to (All players) the text: You have failed the mission

Appendix of Countdown Timer Triggers
Here, the actions in the trigger editor that run a timer are shown here, along with useful information about that action.

1) Countdown Timer - Start Timer
Creates a timer and starts the timer in either One Shot or Repeating timer. This function will not fire at map initialization. You can set it's expiry date and the timer to start in this action.
Sample
Countdown Timer - Start CountdownTimer as a One-Shot timer that will expire in 60.00 seconds

2) Countdown Timer - Pause/Resume Timer
Stops the Timer, preventing it from expiring further and stopping it to the time it was paused. You can also resume it in the Resume field.
Sample:
1) Countdown Timer - Pause CountdownTimer
2) Countdown Timer - Resume CountdownTimer

3) Countdown Timer - Create Timer Window
Creates a timer window for the said timer. Timer windows cannot show at map initialization.
Sample
Countdown Timer - Create a timer window for CountdownTimer

HINT: After this action add a 'Set Variable' action to set the Timer Window variable into the last created timer window

Ex. Set CountdownTimerWindow = (Last Created Timer Window)

4) Countdown Timer - Destroy Timer Window
Destroys the timer window of the timer. Does destroy the timer window, but the timer still runs. In order to stop the timer, use the 'Pause Timer' action.
Sample:
Countdown Timer - Destroy CountdownTimerWindow

5) Countdown Timer - Show/Hide Timer Window for Player
Shows or hides the timer window of a particular player. Does not hide the timer windows of other players.
Sample:
1) Countdown Timer - Hide CountdownTimerWindow for Player 1 (Red)

2) Countdown Timer - Show CountdownTimerWindow for Player 1 (Red)

6) Countdown Timer - Show/Hide Timer Window
This time, the timer window will Show or Hide for all players.
Sample:
1) Countdown Timer - Show CountdownTimerWindow
2) Countdown Timer - Hide CountdownTimerWindow
7) Countdown Timer - Change Timer Window Title
Changes the title of a particular timer window.
Sample:

Countdown Timer - Change the title of CountdownTimerWindow to Bonus Time
8) Countdown Timer - Change Timer Window Title Color
Sets the color of the title of the timer window in three fields, RGB (Red Green Blue) and also sets the transparency of the timer window title.
Sample
Countdown Timer - Change the color of the title for (Last created timer window) to (100.00%, 0.00%, 75.00%) with 0.00% transparency

9) Countdown Timer - Change Timer Window Time Color
Same functions as of above, but in this action, the color and transparency of the Time is affected.
Sample
Countdown Timer - Change the color of the time for (Last created timer window) to (100.00%, 14.00%, 75.00%) with 0.00% transparency

Techniques:
The tutorial is not yet complete, so I added a few techniques derived from some World Editor users
I've added also this special technique, probably a basic but spectacular one. Easy needs only 1 trigger and a few functions: Here's the technique

Simultaneous Changing of Color
Maybe every 1 second the color of the timer title changes with different RGB colors. Just use this trigger

Color Change Evry 1 Second
Events:
Time - Every 3.00 seconds of game time
Conditions:
Actions:
Countdown Timer - Change the color of the title for CountdownTimerWindow to (100.00%, 0.00%, 0.00%) with 0.00% transparency
Wait 1.00 seconds
Countdown Timer - Change the color of the title for CountdownTimerWindow to (0.00%, 100.00%, 0.00%) with 0.00% transparency
Wait 1.00 seconds
Countdown Timer - Change the color of the title for CountdownTimerWindow to (0.00%, 0.00%, 100.00%) with 0.00% transparency

TIP: You can add as many colors as you want and even change their color changing interval...
NOTE: Notice why the Every [] seconds, has 3 seconds instead of 1, because it must change into 3 colors and one color per second.


Tutorial Conclusion
All of those basic techniques of making and managing Timers are all compiled in the demo map below. Download by clicking the attached w3x file.
---------------------------------------------------------------------------------
:rolleyes: Click here to comment on this tutorial... (Post Reply)
 

Attachments

  • CountdownTimerDemo.w3x
    61 KB · Views: 449

Tinki3

Special Member
Reaction score
418
Its a good small tutorial, but I have things you can add to make it better:

1) Countdown Timer - Start Timer
Creates a timer and starts the timer in either One Shot or Repeating timer. This function will not fire at map initialization. You can set it's expiry date and the timer to start in this action.

2) Countdown Timer - Pause/Resume Timer
Stops the Timer, preventing it from expiring further and stopping it to the time it was paused. You can also resume it in the Resume field.

3) Countdown Timer - Create Timer Window
Creates a timer window for the said timer. Timer windows cannot show at map initialization.

4) Countdown Timer - Destroy Timer Window
Destroys the timer window of the timer. Does destroy the timer window, but the timer still runs. In order to stop the timer, use the 'Pause Timer' action.

5) Countdown Timer - Show/Hide Timer Window for Player
Shows or hides the timer window of a particular player. Does not hide the timer windows of other players.

6) Countdown Timer - Show/Hide Timer Window
This time, the timer window will Show or Hide for all players.

7) Countdown Timer - Change Timer Window Title
Changes the title of a particular timer window.

8) Countdown Timer - Change Timer Window Title Color
Sets the color of the title of the timer window in three fields, RGB (Red Green Blue) and also sets the transparency of the timer window title.

9) Countdown Timer - Change Timer Window Time Color
Same functions as of above, but in this action, the color and transparency of the Time is affected.

For all of the above, you should put examples of using that function below them.

Example:
8) Countdown Timer - Change Timer Window Title Color
Sets the color of the title of the timer window in three fields, RGB (Red Green Blue) and also sets the transparency of the timer window title.

EG:
Code:
Actions
    Countdown Timer - Change the color of the title for (Last created timer window) to (100.00%, 0.00%, 75.00%) with 0.00% transparency

Do you think this would make your tutorial slightly better or not?
 

jonadrian619

-___-
Reaction score
240
Yeah, im still planning some improvements for the tutorial

I'm just starting out this tutorial, Indeed i'll make it better. Thanks for the sample anyway

i'll give a sample of each timer action and add a few tips about timers..

Anyway thanks for the improvements...<3
 

ayumilove

Youtube account suspended! youtube.com/ayumilove8
Reaction score
110
thanks jonad for creating this tutorial <3

i have been waiting for such a tutorial lol

countdown timers give me way too much bugs >_<
 

Master

Thou shall be helped by...The Black Adder!
Reaction score
72
It could be better.
Mind some grammatical mistakes, like this:
Color Change Evry 1 Second
Also, it is a good thing to add a Demo :)

~Have a nice and comfortable day.
 

Sim

Forum Administrator
Staff member
Reaction score
534
Quote:
Color Change Evry 1 Second
Events:
Time - Every 3.00 seconds of game time
Conditions:
Actions:
Countdown Timer - Change the color of the title for CountdownTimerWindow to (100.00%, 0.00%, 0.00%) with 0.00% transparency
Wait 1.00 seconds
Countdown Timer - Change the color of the title for CountdownTimerWindow to (0.00%, 100.00%, 0.00%) with 0.00% transparency
Wait 1.00 seconds
Countdown Timer - Change the color of the title for CountdownTimerWindow to (0.00%, 0.00%, 100.00%) with 0.00% transparency

CODE, not quote.
 
F

Foomy

Guest
I'd like to see how you do a repeating timer.
That starts over.
Is it just to ad.

Code:
Timer
    Events
        Time - Elapsed game time is 5.00 seconds
    Conditions
    Actions
        Countdown Timer - Start CountdownTimer as a Repeating timer that will expire in 20.00 seconds
        Countdown Timer - Create a timer window for CountdownTimer with title ((Round  + (String(Rounds))) + starts in: )
        Set CountdownTimerWindow = (Last created timer window)

This will show a new X Round every time it expires?
(Ofcourse I have a trigger that adds +1 to the rounds variable :)=)

But will the rest work?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top