| Next revision | Previous revision | ||
|
hpl2:tutorials:script:advancedtimers [2011/07/13 15:58] kyle Under Contruction |
hpl2:tutorials:script:advancedtimers [2011/07/13 16:06] (current) kyle |
||
|---|---|---|---|
| Line 11: | Line 11: | ||
| - | <code cpp> | + | <code cpp>void OnStart() |
| - | + | ||
| - | + | ||
| - | void OnStart() | + | |
| { | { | ||
| SetPlayerCrouching(true); | SetPlayerCrouching(true); | ||
| Line 37: | Line 34: | ||
| - | <code cpp> | + | <code cpp>void OnStart() |
| - | + | ||
| - | + | ||
| - | void OnStart() | + | |
| - | + | ||
| { | { | ||
| - | + | PlaySoundAtEntity("", "break_glass_bottle.snt", "Player", 0, false); | |
| - | + | SetPlayerActive(false); | |
| - | PlaySoundAtEntity("", "break_glass_bottle.snt", "Player", 0, false); | + | SetPlayerCrouching(true); |
| - | + | FadeOut(0); | |
| - | + | FadeIn(3); | |
| - | SetPlayerActive(false); | + | AddTimer("T1", 3, "Intro"); |
| - | + | AddTimer("T2", 6, "Intro"); | |
| - | + | AddTimer("T3", 8, "Intro"); | |
| - | SetPlayerCrouching(true); | + | AddTimer("T4", 10, "Intro"); |
| - | + | AddTimer("T5", 12, "Intro"); | |
| - | + | } | |
| - | 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) | void Intro(string &in asTimer) | ||
| - | |||
| - | |||
| { | { | ||
| - | + | string x = asTimer; | |
| - | + | if (x == "T1") | |
| - | string x = asTimer; | + | { |
| - | + | PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false); | |
| - | + | FadeOut(3); | |
| - | if (x == "T1") | + | } |
| - | + | else if (x == "T2") | |
| - | + | { | |
| - | { | + | FadeIn(3); |
| - | + | PlaySoundAtEntity("", "react_breath.snt", "Player", 0, false); | |
| - | + | StartPlayerLookAt("ScriptArea_1", 2, 2, ""); | |
| - | PlaySoundAtEntity("", "react_sigh.snt", "Player", 0, false); | + | } |
| - | + | else if (x == "T3") | |
| - | + | { | |
| - | FadeOut(3); | + | StopPlayerLookAt(); |
| - | + | StartPlayerLookAt("ScriptArea_2", 2, 2, ""); | |
| - | + | } | |
| - | } | + | else if (x == "T4") |
| - | + | { | |
| - | + | PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); | |
| - | else if (x == "T2") | + | StopPlayerLookAt(); |
| - | + | } | |
| - | + | else if (x == "T5") | |
| - | { | + | { |
| - | + | SetPlayerCrouching(false); | |
| - | + | SetPlayerActive(true); | |
| - | 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); | + | |
| - | + | ||
| - | + | ||
| - | SetPlayerActive(true); | + | |
| - | + | ||
| - | + | ||
| - | } | + | |
| - | + | ||
| } | } | ||
| </code> | </code> | ||
| Line 174: | Line 84: | ||
| This advanced timer helps organize timers under one function instead of many. | This advanced timer helps organize timers under one function instead of many. | ||
| + | |||
| + | |||
| + | == This wiki entry has been made by Kyle S. If you have any comments or need help with this, send me a private message on the Frictional Games Forum. (My name on there is Kyle) == | ||