Frictional Games Forum (read-only)
Quick Question. - 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: Quick Question. (/thread-9379.html)



Quick Question. - GreyFox - 07-26-2011

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



RE: Quick Question. - Obliviator27 - 07-26-2011

-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.


RE: Quick Question. - GreyFox - 07-26-2011

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?


RE: Quick Question. - Obliviator27 - 07-26-2011

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.


RE: Quick Question. - GreyFox - 07-26-2011

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


RE: Quick Question. - Wonderbread - 07-26-2011

(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.



RE: Quick Question. - MrCookieh - 07-26-2011

Code:
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


RE: Quick Question. - GreyFox - 07-26-2011

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

-Grey Fox