This is a short guide to get you started with using timers and timer windows. It is aimed for moderate level modders, but will require little or no previous knowledge, so any level mapper can use this guide for a jump start with timers.
Contents
I. Setting your Variables
II. Creating a Standard Timer
III. Creating Multiple Timers
I. Setting your Variables
To get started, first we will need to create some variables. We will need one for the timer itself, and one for the timer window.
Once you are in the trigger editor, hit control+b to bring up the variables window. Now that we have the variable window open, press the button with a
green X, this will open the menu to create our first new variable.
For the box labeled variable name enter LevelEnds. For the second box labeled variable type, scroll down and select Timer. We have now created our timer variable. Next we need a variable for the Timer Window. Create is just as we created our first variable, but this time name the variable LevelEndsWindow, and for the type, scroll down and select Timer window.
Easy right? Now we will move on and create our first basic timer.
II. Creating a Standard Timer
Now that we have our variables set up, we can begin triggering our first timer.
The first thing to decide is when you would like your timer to start. In this expample I will be using an event of Elapsed time = 60 seconds. This is essentially giving the players 60 seconds before the game starts and the level timer begins.
First Action; Creating the timer window. This is creating the timer window and naming the window for our timer that the players will see in game. You will have to select our Timer variable in this action which is LevelEnds.
Trigger:
Countdown Timer - Create a timer window for LevelEnds with title Level Ends
Second Action; Setting our timer window to be displayed. In this action we must set our Timer window variable, so that the game will know which window is to be displayed for this timer. This action is found under the "Set Variable" option in the action scroll down.
Trigger:
Set LevelEndsWindow = (Last created timer window)
Third Action; Configuring our Timer. Now we must tell the game to start our timer, how long it will last, and whether or not we want it to repeat itself.
For this expample we will use a one-shot timer, with a length of 45 seconds.
This means the timer will only count down once. The reason we are doing it this way is because a repeating timer never stops, it will loop endlessly making it useless for most applications. We will expand on this more in Chapter 3.
Trigger:
Countdown Timer - Start LevelEnds as a One-shot timer that will expire in 45.00 seconds
Fourth Action; Setting the title color for our Timer window. This is pretty simple, just choose the color you would like the window title for the players to be. Your values here are Red,Green and Blue, you can add and subract % of each color to make the final combined color choice. Or you can download a color picker program from here at Wc3campaigns to customize it further.
Trigger:
Countdown Timer - Change the color of the title for LevelEndsWindow to (100.00%, 0.00%, 0.00%) with 0.00% transparency
Final Action; Last but not least, we must tell the game which players to show our timer window to. In this case we want all players to see it. So we will do a simple pick every player action.
Trigger:
Player Group - Pick every player in (All players) and do (Countdown Timer - Show LevelEndsWindow for (Picked player))
Ok! we should now have our completed first timer.
Congrats! The final combined trigger should look like;
Feel free to save and test the map to see that the timer is working properly. If all is well then we shall proceed to chapter 3, and apply our previous lesson to linking multiple timers.
III. Creating Multiple Timers
Now that you are starting to grasp the basics of timers, Chapter 3 will be a breeze. I will now show you how to link the timer you created in Chapter 2 with another timer. The end result will be two linked timers that will allow your players prep-time between rounds. When you implement your timers into your map, its up you to decide lengths and what events will be happening in response to your timers.
Moving on. We need to create two more variables for our new timer. This time, name your timer NextLevel, and your timer window NextLevelWindow.
With your variables complete, creat a new trigger and name it Nextlevel.
The changes in the new trigger are very small so I will go over the new actions, then post the completed trigger.
Event; We are adding a new event to this trigger. This time, instead of a time lapse, we are using a timer expired event. The expiring timer is the LevelEnds timer from Chapter 2.
First Action; Now to get rid of the first timer window. We will now tell the game to destroy the old timer (LevelEndsWindow)
Trigger:
Countdown Timer - Destroy LevelEndsWindow
That's it for the new actions, with exception of changing the timer length for the new timer. For the rest of this trigger create a new timer as we did in Chapter 2 for NextLevel, but this time set the length of the timer to 15 seconds. Here is how your completed trigger should look.
Almost Done; Now we are simply creating one more new trigger, which is going to alternate our two timers. Name this trigger LevelEnd and create it exactly as you did NextLevel, only this time swap out LevelEnd in all instances of NextLevel. In fact you can do this quickly by copying and pasting Nextlevel and renaming it LevelEnd.
Here is how LevelEnd should look;
And that completes today's tutorial. You should now have a finished, basic linked timer that clearly indicates the time until the current level ends and the time until the next level begins. You should also understand the basics of using timers and thier possible uses. Be sure to save and test.
As a final bit of advice to all map makers;
Save and save often, and always back up your work. Good Luck!
~Zwan