Frictional Games Forum (read-only)

Full Version: Door slams in your face.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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. Angel
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
use this:

Code:
SetSwingDoorClosed("DOORNAME", true, true);
SetSwingDoorLocked("DOORNAME", false, true);

And it will slam and lock it self.
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:

Code:
SetSwingDoorClosed("DOORNAME", true, true);
SetSwingDoorLocked("DOORNAME", false, true);

And it will slam and lock it self.

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);
}
________________________________________________________
SetSwingDoorLocked("DOORNAME", false, true);
use true, true);
(06-27-2011, 12:14 AM)Rownbear Wrote: [ -> ]SetSwingDoorLocked("DOORNAME", false, true);
use true, true);

Thank you so much, my door works as it should now, and I learned much from this Wink.