Both sides previous revision Previous revision Next revision | Previous revision | ||
hpl2:tutorials:script:events [2011/07/14 13:45] xtron |
hpl2:tutorials:script:events [2011/07/14 13:48] (current) xtron |
||
---|---|---|---|
Line 77: | Line 77: | ||
- | <code cpp> | + | <code cpp>{ |
- | + | ||
- | { | + | |
SetSwingDoorClosed("door1", true, true); | SetSwingDoorClosed("door1", true, true); | ||
Line 96: | Line 94: | ||
- | <code cpp> | + | <code cpp>void OnStart() |
- | + | ||
- | + | ||
- | void OnStart() | + | |
{ | { | ||
- | addEntityCollideCallback("Player", "script_slam", "func_slam", true, 1); | + | AddEntityCollideCallback("Player", "script_slam", "func_slam", true, 1); |
- | + | ||
} | } | ||
- | + | ||
void func_slam(string &in asParent, string &in asChild, int alState) | void func_slam(string &in asParent, string &in asChild, int alState) | ||
- | + | { | |
- | + | SetSwingDoorClosed("door2", true, true); | |
- | { SetSwingDoorClosed("door2", true, true); | + | |
- | PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); GiveSanityDamage(5.0f, true); | + | PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false); |
- | + | ||
+ | PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); | ||
+ | |||
+ | GiveSanityDamage(5.0f, true); | ||
} | } | ||
</code> | </code> | ||
Line 126: | Line 120: | ||
It's almost like the slaming door but with a few modifications. | It's almost like the slaming door but with a few modifications. | ||
+ | |||
+ | |||
+ | ==== The Door ==== | ||
Line 132: | Line 129: | ||
Click on the door > Entity > Change OpenAmount to 0. So it's closed. | Click on the door > Entity > Change OpenAmount to 0. So it's closed. | ||
+ | |||
+ | |||
+ | ==== The Script ==== | ||
Line 137: | Line 137: | ||
- | <code cpp> | + | <code cpp>void func_slam(string &in asParent, string &in asChild, int alState) |
- | + | ||
- | void func_slam(string &in asParent, string &in asChild, int alState) | + | |
{ | { | ||
SetSwingDoorClosed("door2", true, true); | SetSwingDoorClosed("door2", true, true); | ||
Line 165: | Line 163: | ||
- | <code cpp> | + | <code cpp>void func_slam(string &in asParent, string &in asChild, int alState) |
- | + | ||
- | void func_slam(string &in asParent, string &in asChild, int alState) | + | |
{ | { | ||
SetPropHealth("door1", 0.0f); | SetPropHealth("door1", 0.0f); | ||
Line 174: | Line 170: | ||
PlaySoundAtEntity("", "react_scare", "Player", 0, false); | PlaySoundAtEntity("", "react_scare", "Player", 0, false); | ||
- | + | ||
+ | |||
PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); | PlaySoundAtEntity("", "close_door.snt", "Player", 0, false); | ||
Line 213: | Line 209: | ||
- | <code cpp> | + | <code cpp>void OnStart() |
- | + | ||
- | void OnStart() | + | |