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
Detecting when a door is closed?
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#1
Detecting when a door is closed?

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.
01-01-2011, 09:31 PM
Find
ModManDann Offline
Member

Posts: 61
Threads: 6
Joined: Dec 2010
Reputation: 0
#2
RE: Detecting when a door is closed?

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.

Current project: Mind Trap
01-01-2011, 10:44 PM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#3
RE: Detecting when a door is closed?

(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).
(This post was last modified: 01-04-2011, 12:32 AM by GraphicsKid.)
01-04-2011, 12:32 AM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#4
RE: Detecting when a door is closed?

You could try

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


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
01-04-2011, 02:59 PM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#5
RE: Detecting when a door is closed?

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

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.
01-05-2011, 01:23 AM
Find
Equil Offline
Member

Posts: 94
Threads: 8
Joined: Sep 2010
Reputation: 0
#6
RE: Detecting when a door is closed?

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.
01-05-2011, 08:25 AM
Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#7
RE: Detecting when a door is closed?

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

Which makes the script look like this in my mind:

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.


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
(This post was last modified: 01-05-2011, 04:36 PM by Frontcannon.)
01-05-2011, 04:35 PM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#8
RE: Detecting when a door is closed?

Is there a callback to trigger this? Or how can I constantly check this?
01-06-2011, 07:50 AM
Find
ModManDann Offline
Member

Posts: 61
Threads: 6
Joined: Dec 2010
Reputation: 0
#9
RE: Detecting when a door is closed?

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

Current project: Mind Trap
(This post was last modified: 01-06-2011, 12:46 PM by ModManDann.)
01-06-2011, 12:45 PM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#10
RE: Detecting when a door is closed?

Huh... that's not doing it.
01-20-2011, 05:25 AM
Find




Users browsing this thread: 1 Guest(s)