Frictional Games Forum (read-only)
I want the player to react to a door that closes. - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: I want the player to react to a door that closes. (/thread-7187.html)



I want the player to react to a door that closes. - KHShox - 04-03-2011

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



RE: I want the player to react to a door that closes. - Russ Money - 04-03-2011

What do you mean by react? Stifled breath? The sanity damage effect?


RE: I want the player to react to a door that closes. - KHShox - 04-03-2011

(04-03-2011, 09:33 PM)Russ Money Wrote: What do you mean by react? Stifled breath? The sanity damage effect?

I mean by having sanity damage and stifled breath.


RE: I want the player to react to a door that closes. - Russ Money - 04-03-2011

GiveSanityDamage(float afAmount, bool abUseEffect);

Make sure the bool is true.

And also,

PlaySoundAtEntity("ScriptArea_2", "react_scare.snt", "ScriptArea_2", 0, false);

If you wanted to play that so it seems like it's coming from the player, change it to

PlaySoundAtEntity("ScriptArea_2", "react_scare.snt", "Player", 0, false);


RE: I want the player to react to a door that closes. - KHShox - 04-03-2011

Ahh thanks man! This really helped a TON!