Frictional Games Forum (read-only)
Trying to open and close a door with a lever - 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: Trying to open and close a door with a lever (/thread-6213.html)



Trying to open and close a door with a lever - GraphicsKid - 01-15-2011

Closing part is pretty easy, but the darned thing won't open. As soon as it's closed, it sort of latches shut. SetSwingDoorClosed("blah blah, false, true") does nothing. If I put a force on the door body, it just looks like someone is throwing themselves against it from the other side... it sort of bucks for a second, but stays shut. This is a prison door btw, not one of the usual wooden ones.

Also, I'd like to make it so the door cannot be moved by the player other than by using the lever.


RE: Trying to open and close a door with a lever - Andross - 01-15-2011

There does not seem to be an elegant way of opening doors. AddPropForce() works, however. See this thread.
Edit: I see you already tried AddPropForce(). Are you sure you applied the force in the correct direction? If so, in the main game they use SetSwingDoorLocked(), SetSwingDoorClosed() and SetSwingDoorDisableAutoClose() before they apply a PropForce. I don't know exactly what each of them does, but I copied it and it works. Look it up in the rainy_hall.

As for your second request, I don't think that there is an appropriate switch. What might work is to use SetPropStaticPhysics(string &in asEntity, bool abStatic) for making the door dynamic before you apply the PropForce and making it static again afterwards. But that would be a total hack Wink.


RE: Trying to open and close a door with a lever - GraphicsKid - 01-15-2011

I've figured out how I'm going to do it. One door is shut, with static physics, one is open, also with static physics, and also there's one with normal physics I call the "transition door". Here's what happens: pull the lever up, the door flies open. Closer look: pull the lever up, closed door disappears, replaced with the identical "transition door", which is given a force, timer activates, and in .25 seconds the transition door disappears and is replaced with the "open door". and vice versa for closing the door.

The idea is you lock a monster inside a room, then later come back and realize the door has been busted down and the monster is once again... loose!


RE: Trying to open and close a door with a lever - Andross - 01-15-2011

Wow, that's actually pretty clever. Smile


RE: Trying to open and close a door with a lever - jens - 01-15-2011

The easiest way to make a lever control a door is to make a special door that is a move object. For examples of this look in the game at for example the secrect passage in the second level, where a shelf rotates open and part of the wall behind it slides up.

What you basically needs is a special entity (look at above entities for examples) and special scripts (check the script file for level 2).


RE: Trying to open and close a door with a lever - GraphicsKid - 01-15-2011

(01-15-2011, 05:01 PM)jens Wrote: The easiest way to make a lever control a door is to make a special door that is a move object. For examples of this look in the game at for example the secrect passage in the second level, where a shelf rotates open and part of the wall behind it slides up.

What you basically needs is a special entity (look at above entities for examples) and special scripts (check the script file for level 2).

lol yea that sounds MUCH easier than what I was trying to get to work. I'll give that a shot.

One thing I need to know though: if I make a special entity, how do I redistribute that with my custom story? Do I drop that straight into the directory, or does it have to go into the "\amnesia the dark descent\entities" folder somewhere?


RE: Trying to open and close a door with a lever - DIGI Byte - 01-16-2011

it will most likely need to be sent with your mod to be placed in the '\entities\' directory
include installation instructions
Note; make sure the entity and the folder are named after your custom story so there are no conflicts


RE: Trying to open and close a door with a lever - jens - 01-16-2011

I think you can make an entities folder in your custom story folder and save it there.


RE: Trying to open and close a door with a lever - Frontcannon - 01-16-2011

(01-16-2011, 11:45 AM)jens Wrote: I think you can make an entities folder in your custom story folder and save it there.

That's right, though you should know that, not only think Wink

The game sorta emulates the folder structure in its redist-folder in your custom story, so you can have folders for entities, sounds, particles etc in you Custom Story-folder.


RE: Trying to open and close a door with a lever - GraphicsKid - 01-17-2011

Yup that works! I just made an "entities" folder in my custom story.