Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quick Question.
Author Message
GreyFox Offline
Member

Posts: 162
Joined: Jul 2011
Reputation: 2
Post: #1
Quick Question.

Just a quick question.

I Have this hallway that you walk into and then you click a door a monster spawns (in the room that you tried opening) and I want it so if you do run away at then end of the hallway the door slams shut in your face. (Only when leaving though)

Don't you write the line of code

AddEntityCollideCallback("Player", "DoorSlam_5", "CollideDoorSlam_5", true, -1);

And Put -1 Instead of 1? 1= walking into it, 2= both ways, -1= walking into oppisite way? Is this correct? If it's not correct do you mind just helping me how to make the door close while running away?

Thank you
-Grey Fox

Current Project
Forgotten
07-26-2011 01:22 AM
Find all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #2
RE: Quick Question.

-1 is for when you leave the area. If "DoorSlam_5" is a small area in front of the door, then you'll want it to be set to 1 so when the player walks into it, the door slams shut.
07-26-2011 01:27 AM
Find all posts by this user Quote this message in a reply
GreyFox Offline
Member

Posts: 162
Joined: Jul 2011
Reputation: 2
Post: #3
RE: Quick Question.

So I was Correct with the -1 thing what about the 2 thing?

Also You don't quite understand how my level is setup

[Image: 11v4ai0.jpg]

I Just want this to be clear if you run through the trigger the opposite way or when leaving or whatever it'll slam the door if the doors open correct?

Current Project
Forgotten
07-26-2011 01:56 AM
Find all posts by this user Quote this message in a reply
Obliviator27 Offline
Posting Freak

Posts: 801
Joined: Jul 2011
Reputation: 65
Post: #4
RE: Quick Question.

The way you have it set up is so when the player leaves the area in front of the door, it slams shut. If you want it to slam in the player's face, then you should set it to 1 so when the player enters, the door shuts. If you want to to shut behind the player, extend the area to the other side of the door so when the player leaves the area you've designated, the door shuts.

There is no 2 value for this script. If you leave it at 0, the callback will play when the player enters AND leaves the area you've designated. 1 is enter only, 0 is enter and exit, -1 is exit only.
07-26-2011 03:00 AM
Find all posts by this user Quote this message in a reply
GreyFox Offline
Member

Posts: 162
Joined: Jul 2011
Reputation: 2
Post: #5
RE: Quick Question.

Alright I tested it and even if its -1 or 1 it still shuts when I'm walking towards the door that activates the monster not when i'm running away

Current Project
Forgotten
07-26-2011 05:36 AM
Find all posts by this user Quote this message in a reply
Wonderbread Offline
Junior Member

Posts: 19
Joined: May 2011
Reputation: 0
Post: #6
RE: Quick Question.

(07-26-2011 05:36 AM)GreyFox Wrote:  Alright I tested it and even if its -1 or 1 it still shuts when I'm walking towards the door that activates the monster not when i'm running away

What you can do is that the Script box is deactived at first, when the player interacts with the door and the monster is activated, the Script box is also activated, so if the player runs back, the door slams in front of their face.
07-26-2011 06:20 AM
Find all posts by this user Quote this message in a reply
MrCookieh Offline
Member

Posts: 157
Joined: Jul 2011
Reputation: 0
Post: #7
RE: Quick Question.

OnStart(){
SetEntityPlayerInteractCallback("yourmonsterspawndoor", "SpawnMonster", true);
}

void SpawnMonster(string &in asEntity){
//Add your monster spawning stuff here
AddEntityCollideCallback("Player", "yourescapedoorarea", "CloseDoor", true, 1);
}

void CloseDoor(string &in asParent, string &in asChild, alState){
SetSwingDoorClosed("yourescapedoor", true, true);
}

1 is when you enter your area, -1 when you leave it, and 0 for both.

So what the script does:
When you touch the door, you add your monster stuff, like spawning.
After that it activates an entity collide callback, which triggers, when
the player enters your escapearea in front of your escapedoor.
Then it closes, and the payer lost some seconds Smile

The Well: Descent - Take a look at it!
07-26-2011 10:57 AM
Find all posts by this user Quote this message in a reply
GreyFox Offline
Member

Posts: 162
Joined: Jul 2011
Reputation: 2
Post: #8
RE: Quick Question.

Thank you it works perfectly fine and Oblivator I added you on steam (Unless it was the wrong one obiously)

-Grey Fox

Current Project
Forgotten
07-26-2011 03:54 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: