Frictional Games Forum (read-only)
Scripting Answers - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Articles (https://www.frictionalgames.com/forum/forum-40.html)
+---- Thread: Scripting Answers (/thread-7929.html)

Pages: 1 2


RE: Scripting Answers - HumiliatioN - 07-26-2011

(07-26-2011, 01:34 PM)Kyle Wrote: Try this:

Code:
void OnStart()
{
AddEntityCollideCallback("Player", "BlowDoor", "BlowDoorFunction", true, 1);
}
void BlowDoorFunction(string &in asParent, string &in asChild, int alState)
{
AddTimer("aha", 0.1, "OpenDoor");
AddTimer("aso", 0.3, "OpenDoor");
StartPlayerLookAt("blow_door", 3, 1, "");
}
void OpenDoor(string &in asTimer)
{
     if(asTimer == "aha"){
          AddPropImpulse("blow_door", -0.5f, 0, 0.5f, "World");
          GiveSanityDamage(20.0f,true);
          PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, true);
     }
     if(asTimer == "aso"){
          PlaySoundAtEntity("", "react_breath.snt", "Player", 0, true);
          StopPlayerLookAt();
     }
}

Now it works. Thanks! Big Grin