Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Door slams in your face.
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#1
Door slams in your face.

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
(This post was last modified: 06-26-2011, 11:55 PM by Angerpull.)
06-26-2011, 10:49 PM
Find
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#2
RE: Door slams in your face.

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

(This post was last modified: 06-26-2011, 11:28 PM by Rownbear.)
06-26-2011, 11:27 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: Door slams in your face.

use this:

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

And it will slam and lock it self.

[Image: 44917299.jpg]Dubstep <3
06-26-2011, 11:46 PM
Find
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#4
RE: Door slams in your face.

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:

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);
}
________________________________________________________
(This post was last modified: 06-27-2011, 12:01 AM by Angerpull.)
06-26-2011, 11:51 PM
Find
Rownbear Offline
Member

Posts: 157
Threads: 13
Joined: Apr 2011
Reputation: 2
#5
RE: Door slams in your face.

SetSwingDoorLocked("DOORNAME", false, true);
use true, true);

06-27-2011, 12:14 AM
Find
Angerpull Offline
Member

Posts: 88
Threads: 24
Joined: Jun 2011
Reputation: 0
#6
RE: Door slams in your face.

(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.
06-27-2011, 12:27 AM
Find




Users browsing this thread: 1 Guest(s)