Door slams in your face. - 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 Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Door slams in your face. (/thread-8827.html) |
Door slams in your face. - Angerpull - 06-26-2011 How can I make it so when I walk towards a door and when I get really close, it SLAMS and makes a huge slamming noise and then locks itself. Any possible way to do this? I know I just posted a thread about something else, but I will need all the help I can get. Here is my script (I just need to know where to place the door script.) void OnStart() { AddEntityCollideCallback("Player" , "Monsterscare" , "MonsterFunc1" , true , 1); AddEntityCollideCallback("Player" , "Monsterscare2" , "MonsterFunc2" , true , 1); } void MonsterFunc1(string &in asParent , string &in asChild , int alState) { SetEntityActive("Monster_scare" , true); ShowEnemyPlayerPosition("Monster_scare"); GiveSanityDamage(200, true); } void MonsterFunc2(string &in asParent , string &in asChild , int alState) { SetEntityActive("Monster_scare2" , true); ShowEnemyPlayerPosition("Monster_scare2"); GiveSanityDamage(10, true); } Also how do I make a door start in a open position? I tried to rotate it and place it but that didn't work. Any help would be much appriciated! Angerpull. RE: Door slams in your face. - Rownbear - 06-26-2011 For the slam part: ////////SCARY DOOR//////////// First, add AddEntityCollideCallback("Player", "trigger_area", "OpenDoor", true, 1); your function to call will be void OpenDoor(string &in asParent, string &in asChild, int alState) { AddPropImpulse("Door", X, Y, Z, "World"); //red is x axis, blue is z axis, green is y axis. (Play with numbers til you get it right, maybe around 50 on the X or Z axis, as I believe the Y is up/down.) } For door starting open look at the entity options when you click on the door, there's a "open amount" there RE: Door slams in your face. - xtron - 06-26-2011 use this: Code: SetSwingDoorClosed("DOORNAME", true, true); And it will slam and lock it self. RE: Door slams in your face. - Angerpull - 06-26-2011 Thank you for the help, but it doesn't work. I just get the "Unexpected Token" Error. Doesn't seem wrong to me. ////////SCARY DOOR//////////// //The Door { AddEntityCollideCallback("Player", "DoorScare", "OpenDoor", true, 1); } void OpenDoor(string &in asParent, string &in asChild, int alState) { AddPropImpulse("Door", 50, 0, 50, "World"); } //////////////////////////// Any Errors? (06-26-2011, 11:46 PM)xtron Wrote: use this: Thank you! But the door doesn't Lock itself. It's still open. Anything wrong? ___________________________________________________________ void OnStart() { AddEntityCollideCallback("Player" , "Monsterscare" , "MonsterFunc1" , true , 1); AddEntityCollideCallback("Player" , "Monsterscare2" , "MonsterFunc2" , true , 1); AddEntityCollideCallback("Player", "DoorScare", "OpenDoor", true, 1); } void MonsterFunc1(string &in asParent , string &in asChild , int alState) { SetEntityActive("Monster_scare" , true); ShowEnemyPlayerPosition("Monster_scare"); GiveSanityDamage(20, true); } void MonsterFunc2(string &in asParent , string &in asChild , int alState) { SetEntityActive("Monster_scare2" , true); ShowEnemyPlayerPosition("Monster_scare2"); GiveSanityDamage(10, true); } void OpenDoor(string &in asParent, string &in asChild, int alState) { SetSwingDoorClosed("ScaryDoor", true, true); SetSwingDoorLocked("ScaryDoor", false, true); } ________________________________________________________ RE: Door slams in your face. - Rownbear - 06-27-2011 SetSwingDoorLocked("DOORNAME", false, true); use true, true); RE: Door slams in your face. - Angerpull - 06-27-2011 (06-27-2011, 12:14 AM)Rownbear Wrote: SetSwingDoorLocked("DOORNAME", false, true); Thank you so much, my door works as it should now, and I learned much from this . |