Frictional Games Forum (read-only)

Full Version: Bang on the door scare script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
What script do you use for when people bang on the doors?

Like if I'm walking down a hallway and I pass a door and for scares, something bangs on that door.
For an example, we'll have a hallways like this (the | is hallway, the / is Door01, and the - is ScriptArea_1):

|
|/
|
-
|

The door opens that way -->

Up and down is y, '^'(verticle) is x, '--->'(horizontal) is z.

So we add prop impulse to the door and sound when player collides with ScriptArea_1, also making him look at it for 2 seconds.

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_1", "Func01", true, 1);
}
void Func01(string &in asParent, string &in asChild, int alState)
{
     AddPropImpulse("Door01", 0, 0, 5, "World");
     PlaySoundAtEntity("", "21_bang_door.snt", "Door01", 0, false);
     StartPlayerLookAt("Door01", 2, 2, "");
     AddTimer("", 2, "TimerFunc");
}
void TimerFunc(string &in asTimer)
{
     StopPlayerLookAt();
     PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
}
Sorry to bring it up again Smile, but I have related question.

How to make like banging, not door closed or opened.

Just particle effect on door, make effect like people are trying to get out and banging the door. Just that effect. Thanks Kyle, I know you will help me Smile! (or someone else)
PlaySoundAtEntity("", "scare_slam_door.snt", "[doorname]", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "[door, or area in front of door]", false);

I simply used that.
thank you Obliviator27 Smile
Anytime, good sir.