Frictional Games Forum (read-only)
Detecting when a door is closed? - 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 (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: Detecting when a door is closed? (/thread-6003.html)



Detecting when a door is closed? - GraphicsKid - 01-01-2011

There's a part in my level where there's a monster lurking around, and you have to lure it into a cell-block and lock it in. When the cell block is sealed, I want the monster to come running at the door and start beating on it so the player has to barricade it. How can I detect when the door has been shut?

I assume there's a callback type for this... is there a list of these things somewhere? Or is it just the 3 in the editor tooltip: OnPickup, Break, OnIgnite.


RE: Detecting when a door is closed? - ModManDann - 01-01-2011

You can use the ConnectionStateChangeCallback for that, it calls the function when the state is changed. and in your function you can check what state it has changed to.


RE: Detecting when a door is closed? - GraphicsKid - 01-04-2011

(01-01-2011, 10:44 PM)ModManDann Wrote: You can use the ConnectionStateChangeCallback for that, it calls the function when the state is changed. and in your function you can check what state it has changed to.

Hey thanks for the response. Could you please expand on this a little bit? I'm still very new to Amnesia modding (and scripting).


RE: Detecting when a door is closed? - Frontcannon - 01-04-2011

You could try

Code:
if(bool  GetSwingDoorLocked("door") == true)
{
    stuff
}



RE: Detecting when a door is closed? - GraphicsKid - 01-05-2011

(01-04-2011, 02:59 PM)Frontcannon Wrote: You could try

Code:
if(bool  GetSwingDoorLocked("door") == true)
{
    stuff
}

Does that detect if the door is closed? The door is never locked, I mean the player can open it. It's an indestructible door, so the monster is trapped inside if you slide a crate in front of it. (of course it frees itself at a very inconvenient time! Tongue ) Problem is, the monster doesn't seem to realize it's trapped, so it just keeps patrolling the cells, happy with ignorance.


RE: Detecting when a door is closed? - Equil - 01-05-2011

Use Frontcannon's script, but use "GetSwingDoorClosed" instead, it's also a valid function.

As for the monster trying to break the door.. I suppose you could make it so it adds a patrol node outside the room when the door is shut, therefore making it try to escape and attack the door? Haven't really tried anything like that before, so I guess you'll need to experiment.


RE: Detecting when a door is closed? - Frontcannon - 01-05-2011

Oh sorry, I have no idea why I used GetSwingDoorLocked :/

Which makes the script look like this in my mind:

Code:
if(bool GetSwingDoorClosed("door") == true)
{
    ShowEnemyPlayerPosition("enemy");
}

This should make it try to escape the room and catch you, but I don't know for how long.


RE: Detecting when a door is closed? - GraphicsKid - 01-06-2011

Is there a callback to trigger this? Or how can I constantly check this?


RE: Detecting when a door is closed? - ModManDann - 01-06-2011

ConnectionStateChangeCallback, I'm pretty sure it calls everytime when you change the state of the door (opening, closing it)


RE: Detecting when a door is closed? - GraphicsKid - 01-20-2011

Huh... that's not doing it.