- Joined
- Feb 25, 2009
- Messages
- 2,004
Elapsed Time v1.0
In this tutorial I will teach you how make an proper trigger that will trackdown the elapsed time in real-time.
In this tutorial I will teach you how make an proper trigger that will trackdown the elapsed time in real-time.
What I need?
- Warcraft 3 Frozen Throne - World Editor
- Basics knowledge of working with triggers
- Open your map and procced to the Trigger Editor (you can press F4)
- Open the specified "Category" where you want to put the trigger
- Create a new trigger and name it how ever you want
4. Look at the trigger below and assign it to your newly created trigger (you can read the trigger comments for better understanding):
-
Game Time
-
Events
-
Time - Every 1.00 seconds of game time
-
-
Conditions
-
Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- Setting the seconds to +1 every 1 second --------
-
-------- ---------------------------------------------------------------- --------
-
Set Time_Seconds = (Time_Seconds + 1)
-
-------- ---------------------------------------------------------------- --------
-
-------- Checking if the seconds are hit 10 --------
-
-------- ---------------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Time_Seconds Equal to 10
-
-
Then - Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- If so, settings seconds back to 0 --------
-
-------- ---------------------------------------------------------------- --------
-
Set Time_Seconds = 0
-
-------- ---------------------------------------------------------------- --------
-
-------- Setting the "Ten_Seconds" to +1 --------
-
-------- This occur everytime the veriable "Time_Seconds" hits the value 10 --------
-
-------- ---------------------------------------------------------------- --------
-
Set Ten_Seconds = (Ten_Seconds + 1)
-
-------- ---------------------------------------------------------------- --------
-
-------- Checking if the veriable "Ten_Seconds" is 6 --------
-
-------- ---------------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Ten_Seconds Equal to 6
-
-
Then - Actions
-
-------- ---------------------------------------------------------------- --------
-
-------- If so, then 1 minute is expired and the veriable "Time_Minutes" will be 1 --------
-
-------- Also setting the "Ten_Seconds" back to 0 --------
-
-------- ---------------------------------------------------------------- --------
-
Set Ten_Seconds = 0
-
Set Minutes = (Minutes + 1)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-------- ---------------------------------------------------------------- --------
-
-------- At the end, we make a string veriable that will display the current elapsed time --------
-
-------- The string will be in this order: Elapsed time is: #color(Time_Minutes) + and + #color(Time_Ten_Seconds)+(Time_Seconds) + seconds. --------
-
-------- ---------------------------------------------------------------- --------
-
Set Time_String = ((Elapsed time is: |cffffcc00 + (String(Minutes))) + (|r minutes and |cffffcc00 + ((String(Ten_Seconds)) + ((String(Time_Seconds)) + |rseconds.))))
-
-
- I've added an action that will run once every 1 second.
- So, every one second the variable "Time_Seconds" will be increased by 1 - this variable will track the elapsed SECONDS
- Once the variable "Time_Seconds" hits a value of 10 my other variable called "Time_Ten_Seconds" will be increased by 1 - this variable will track every 10 elapsed seconds (10-20-30-40-50) and will make it look like (1(10), 2(20), 3(30), 4(40), 5(50)).
- After that, when my variable "Time_Ten_Seconds" hits the value of 6(60) it will make the variable "Time_Minutes" to increase by 1 - this variable will track the elapsed MINUTES. Please notice that the variable "Time_Ten_Seconds" will never show a value of 6 in a string, because it will become 0 again after it hits the both variables hits the maximum supported value.
- After all, we need to store the elapsed time in a string using our variable "Time_String"
What I need for this trigger?
- You need to create 4 variables via the "Variables Editor" - to open it, click onto the "X" mark into the Trigger Editor or simply press CTRL+B. Here is an screenshot where it is located:
- Variables that you need are:
- Time_Seconds [Type: Integer]
- Time_Ten_Seconds [Type: Integer]
- Time_Minutes [Type: Integer]
- Time_String [Type: String]
Now you can make a second trigger to test your tracking trigger like this:
-
Check the time
-
Events
-
Player - Player 1 (Red) skips a cinematic sequence
-
-
Conditions
-
Actions
-
Game - Display to (All players) the text: Time_String
-
-
- Each time you hit the ESC key you will display a text showing the variable "Time_String" thus, the Time_String will show the elapsed game time (check the screenshot below):
Test map
View attachment Elapsed Time v1.0.w3x
Editor Notes
This is my first try to make an tutorial, thus it might be not explained very well. If you think its not, please show me where is the mistakes and probably how to fix them. In time I will try to improve this tutorial using JASS/vJass to track down the elapsed time.
Credits
Feel free to edit and use as long as you give credits to me.
Attachments
Last edited: