Difference between revisions of "HPL3/Scripting/Scripting Guide/Timers"
Line 1: | Line 1: | ||
− | |||
{{Hpl3ScriptingGuideMenuBasic}} | {{Hpl3ScriptingGuideMenuBasic}} | ||
{{shortPageTitle}} | {{shortPageTitle}} | ||
Line 5: | Line 4: | ||
Timers are set up to wait for a selected amount of time before executing code. It can be very useful if you want to wait a specified amount of time for something to happen in the level, such as intense countdown or to spawn / despawn particles in a dynamic way. | Timers are set up to wait for a selected amount of time before executing code. It can be very useful if you want to wait a specified amount of time for something to happen in the level, such as intense countdown or to spawn / despawn particles in a dynamic way. | ||
− | In order to add timer to a map, we need to use Map_AddTimer | + | == Creating Timers == |
+ | In order to add timer to a map, we need to use <code>Map_AddTimer</code>. Let's see an example: | ||
− | + | s | |
− | |||
− | |||
− | |||
− | |||
We can do more than just create a timer, we can remove timers as well, or check if a timer is already running. For example, if we enter this area, create a timer of 5 seconds. However, if a timer has already been created, we don’t need to create that timer again, right? So we can use Map_TimerExists for that. | We can do more than just create a timer, we can remove timers as well, or check if a timer is already running. For example, if we enter this area, create a timer of 5 seconds. However, if a timer has already been created, we don’t need to create that timer again, right? So we can use Map_TimerExists for that. |
Revision as of 22:13, 13 August 2020
Timers are set up to wait for a selected amount of time before executing code. It can be very useful if you want to wait a specified amount of time for something to happen in the level, such as intense countdown or to spawn / despawn particles in a dynamic way.
Creating Timers
In order to add timer to a map, we need to use Map_AddTimer
. Let's see an example:
s
We can do more than just create a timer, we can remove timers as well, or check if a timer is already running. For example, if we enter this area, create a timer of 5 seconds. However, if a timer has already been created, we don’t need to create that timer again, right? So we can use Map_TimerExists for that.
Timers are very easy to use as you can see, and it will help us to understand the concept of Sequences in the next episode.