Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bang on the door scare script
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#2
RE: Bang on the door scare script

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.

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);
}

07-29-2011, 04:37 PM
Find


Messages In This Thread
Bang on the door scare script - by ObsidianLegion - 07-29-2011, 03:52 PM
RE: Bang on the door scare script - by Kyle - 07-29-2011, 04:37 PM
RE: Bang on the door scare script - by Elven - 08-30-2011, 11:40 AM
RE: Bang on the door scare script - by Elven - 08-30-2011, 12:09 PM



Users browsing this thread: 1 Guest(s)