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