This wiki page will explain the advanced usage of timers.
Timers are set up to wait for the selected amount of time to pass before doing specific commands. In introductions for custom stories, I've seen some that are too quick. For example, the player is in his bed and gets up. Naturally, it should take a little more time unless purposely done so. Like if the player wakes up to the breaking of glass or strange sounds.
Here is what a simple timer could look like:
void OnStart() { SetPlayerCrouching(true); SetPlayerActive(false); FadeOut(0); FadeIn(3); AddTimer("", 3, "Intro"); } void Intro(string &in asTimer) { SetPlayerCrouching(false); SetPlayerActive(true); PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false); }
This script doesn't have any sort of “flavor” to it. An introduction is supposed to make the player feel interested or worried of what is to come ahead. I'm not trying to say that the people who script their custom story like this isn't experienced, I'm saying that they should try to take a risk with something bigger and better. This all leads to the advanced usage of timers.
This is what an advanced timer could look like:
void OnStart() { PlaySoundAtEntity("", "break_glass_bottle.snt", "Player", 0, false); SetPlayerActive(false); SetPlayerCrouching(true); FadeOut(0); FadeIn(3); AddTimer("T1", 3, "Intro"); AddTimer("T2", 6, "Intro"); AddTimer("T3", 8, "Intro"); AddTimer("T4", 10, "Intro"); AddTimer("T5", 12, "Intro"); } void Intro(string &in asTimer) { string x = asTimer; if (x == "T1") { PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false); FadeOut(3); } else if (x == "T2") { FadeIn(3); PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false); StartPlayerLookAt("ScriptArea_1", 2, 2, ""); } else if (x == "T3") { StopPlayerLookAt(); StartPlayerLookAt("ScriptArea_2", 2, 2, ""); } else if (x == "T4") { PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); StopPlayerLookAt(); } else if (x == "T5") { SetPlayerCrouching(false //