Countdown Timer Tutorial

Discussion in 'World Editor Help' started by jonadrian619, Dec 12, 2006.

  1. jonadrian619

    jonadrian619 -___-

    +238 / 0 / -0
    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:
    Countdown Timer Creation
                   Elapsed Game time is 1.00 seconds
                   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.
    Countdown Timer Expiry
                   Time - CountdownTimer expires
                   ----------------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.
    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.
    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

    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)

    Attached Files:

    • Like Like x 7
  2. Tinki3

    Tinki3 Special Member

    +418 / 0 / -0
    Its a good small tutorial, but I have things you can add to make it better:

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

    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.

        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?
    • Like Like x 1
  3. jonadrian619

    jonadrian619 -___-

    +238 / 0 / -0
    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
  4. Lanboy

    Lanboy New Member

    +22 / 0 / -0
    thanks it helped me
  5. ayumilove

    ayumilove Youtube account suspended!

    +110 / 0 / -0
    thanks jonad for creating this tutorial <3

    i have been waiting for such a tutorial lol

    countdown timers give me way too much bugs >_<
  6. Chocobo

    Chocobo White-Flower

    +410 / 0 / -0
    Confusing. :p It seems we can't recognize what is what exactly. ;)
    Bold and CODE tags should help.
  7. Master

    Master Thou shall be helped by...The Black Adder!

    +72 / 0 / -0
    It could be better.
    Mind some grammatical mistakes, like this:
    Also, it is a good thing to add a Demo :)

    ~Have a nice and comfortable day.
  8. Sim

    Sim Forum Administrator Staff Member

    +529 / 0 / -0
    CODE, not quote.
  9. Foomy

    Foomy Guest

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

            Time - Elapsed game time is 5.00 seconds
            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?
  10. Chocobo

    Chocobo White-Flower

    +410 / 0 / -0
    The countdown window is not updated for rounds name, so..

Share This Page