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
Trying to open and close a door with a lever
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#1
Trying to open and close a door with a lever

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.
01-15-2011, 02:25 AM
Find
Andross Offline
Junior Member

Posts: 38
Threads: 1
Joined: Oct 2010
Reputation: 0
#2
RE: Trying to open and close a door with a lever

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.
(This post was last modified: 01-15-2011, 03:50 AM by Andross.)
01-15-2011, 03:47 AM
Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#3
RE: Trying to open and close a door with a lever

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!
01-15-2011, 09:15 AM
Find
Andross Offline
Junior Member

Posts: 38
Threads: 1
Joined: Oct 2010
Reputation: 0
#4
RE: Trying to open and close a door with a lever

Wow, that's actually pretty clever. Smile
01-15-2011, 04:56 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#5
RE: Trying to open and close a door with a lever

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).
01-15-2011, 05:01 PM
Website Find
GraphicsKid Offline
Senior Member

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#6
RE: Trying to open and close a door with a lever

(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?
01-15-2011, 10:18 PM
Find
DIGI Byte Offline
Senior Member

Posts: 376
Threads: 20
Joined: Dec 2010
Reputation: 1
#7
RE: Trying to open and close a door with a lever

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
(This post was last modified: 01-16-2011, 09:46 AM by DIGI Byte.)
01-16-2011, 09:45 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#8
RE: Trying to open and close a door with a lever

I think you can make an entities folder in your custom story folder and save it there.
01-16-2011, 11:45 AM
Website Find
Frontcannon Offline
Senior Member

Posts: 538
Threads: 10
Joined: Jul 2010
Reputation: 2
#9
RE: Trying to open and close a door with a lever

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


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

Posts: 258
Threads: 34
Joined: Dec 2010
Reputation: 3
#10
RE: Trying to open and close a door with a lever

Yup that works! I just made an "entities" folder in my custom story.
01-17-2011, 01:57 AM
Find




Users browsing this thread: 1 Guest(s)