Plot:Set timer

From OHRRPGCE-Wiki
Jump to: navigation, search

set timer (id, count, speed, trigger, string, flags)Changes the settings for a given timer, and starts it. id should be one of the 16 timers for you to use, numbered 0 to 15. All other parameters are optional, or you can pass timer:default as any of them. This will leave the parameter unchanged (from the last time you set it or from the default initial value), it will NOT cause that timer setting to be reset to the default initial value. Count is the length of the timer. While it's running, the count will go down by one every speed game ticks (frames). I.e., if you set speed to 18, it will count down once every 18 ticks, close to one second. Use a speed of 1 to count down in ticks. Changing the timer's count (as opposed to passing timer:default as the second argument) will cause the timer to restart from the new value.


trigger is what happens when the timer runs out. You can use the constant timer:gameover to indicate that the game should end, or specify a plotscript (in the form "@my script") to have that run. A plotscript will get passed the id of the timer that triggered it as its first argument, if it has one. If the timer runs out during a battle then the effect happens after the battle ends.


You can bind a timer to a string using the string parameter to create a countdown that shows up on screen. Pass it the id of a string, and that string will be updated every time the timer counts down. You are responsible for displaying and positioning the string.


A timer also has a few other options in the form of flags. You can pass any combination of these flags (by oring or adding them together):

  • timerflag:battle to have it count down during battles (not including menus which pause the battle)
  • timerflag:menu to have it count down even while the player is in a menu which pauses the game (e.g. the status menu), the in-battle pause button doesn't count
  • timerflag:critical to have the timer end a battle or exit a menu if it runs out during it


Plotnote.png
Timers start counting down not from the current game 'tick', but from next one. So if you want to trigger something next tick (eg. run a script every frame) you need to pass count as 0 and speed as 1. A timer count set to 1 would counter-intuitively trigger in 2 ticks time.
Plotnote.png
Timer settings are not saved in game saves.

[edit] Examples

#this starts a 300 second (5 minute) timer that counts down once every 18 ticks (a second). If
#it runs out during battle, the battle won't end but a game-over will happen afterwards.
set timer (0, 300, 18, timer: game over, 0, timerflag: battle)

[edit] See Also

Personal tools