KHShox
Junior Member
Posts: 28
Threads: 11
Joined: Apr 2011
Reputation:
0
|
I want the player to react to a door that closes.
I have been trying to get my player to react when a door closes. The door closes perfectly, and I have tried looking at many forums, videos, and the wiki. None of which really helped me. Here is the current code that I have.
Yes, I also added a scream to the script.
Quote:////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "DoorClose", "CollideScript", true, 1);
}
void CollideScript(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_2", true, true);
AddEntityCollideCallback("Player", "DoorClose", "ScriptArea_2", true, 1);
}
void DoorClose(string &in asParent, string &in asChild, int alStates)
{
AddTimer("Timer", 6.0f, "ScriptArea_2_Trigger");
}
void Scream_Trigger(string &in asTimer)
{
PlaySoundAtEntity("ScriptArea_2", "12_girl_scream.snt", "ScriptArea_2", 0, false);
PlaySoundAtEntity("ScriptArea_2", "react_scare.snt", "ScriptArea_2", 0, false);
StartPlayerLookAt("ScriptArea_2", 2, 2, "");
AddTimer("Timer", 6.0f, "ScriptArea_2_Trigger");
}
void ScriptArea_2_Trigger(string &in asParent, string &in asChild, int alStates)
{
StopPlayerLookAt();
}
|
|
04-03-2011, 09:01 PM |
|