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
Making cupboard doors fly open?
DrMelon Offline
Junior Member

Posts: 3
Threads: 1
Joined: Sep 2010
Reputation: 0
#1
Making cupboard doors fly open?

I've had a good look at the Choir East script, and I can see how they got the doors there to fly open - they applied an impulse to the bodies attached to the iron maiden entity.

However, I want to do something similar to a cabinet_nice entity, and in the model editor it shows the doors as being called "Body_1" and "Body_2". However, no matter which directions I put into the X,Y,Z fields in the AddBodyImpulse field in my script, the doors refuse to move. I've tried making the impulses stronger, and longer, but all to no avail. The cabinet's doors just stay closed.

Any help?
09-15-2010, 01:01 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#2
RE: Making cupboard doors fly open?

First add a AddDebugMessage("Push Doors!", false); to the function where you are trying to do the AddBodyImpulse and make sure that the message is displayed, so you know it actually calls it.

I think you then should first try to give some impulse to a simple object, like a one of the small boxes that you can carry and throw around. Because the models with doors can be a bit tricky to get right.

When you have managed to do that, then go back to the cabinet and try that again.
09-15-2010, 01:50 PM
Website Find
DrMelon Offline
Junior Member

Posts: 3
Threads: 1
Joined: Sep 2010
Reputation: 0
#3
RE: Making cupboard doors fly open?

(09-15-2010, 01:50 PM)jens Wrote: First add a AddDebugMessage("Push Doors!", false); to the function where you are trying to do the AddBodyImpulse and make sure that the message is displayed, so you know it actually calls it.

I think you then should first try to give some impulse to a simple object, like a one of the small boxes that you can carry and throw around. Because the models with doors can be a bit tricky to get right.

When you have managed to do that, then go back to the cabinet and try that again.

Thanks for the reply. In answer to the first section of that post, I know this function works because the sanity-drain and the radial blur I turn on during this event happen as they should.

I'll try applying impulse to a box (during the same event), and I'll get back to you on how it goes.

EDIT: Okay, so I managed to make a box leap into the air just fine. So I wonder why I can't get those doors to just... open? I'll try fiddling with the values some more, see if I'm maybe making it too weak or too strong.

EDIT2: Aha! I feel so stupid now! I forgot to set the auto-close off, and set the doors as not being closed! So now the doors open as they should because they aren't auto-closing as soon as they move a little bit past what I like to call the "deadzone".
09-15-2010, 01:56 PM
Find
Mina Darsh Offline
Member

Posts: 227
Threads: 24
Joined: Sep 2010
Reputation: 0
#4
RE: Making cupboard doors fly open?

I'm no coding expert, but I had a feeling it could've been that. Smile Sorry I didn't say earlier, you beat me to it. :o I noticed how doors and such all have this auto-close state when they're almost in closing position, probably to prevent them from bouncing back open when closed too hard.
09-15-2010, 03:58 PM
Find
Armored Cow Offline
Member

Posts: 72
Threads: 3
Joined: Sep 2010
Reputation: 0
#5
RE: Making cupboard doors fly open?

On a slightly related note, I am having problems keeping a desk door fully shut when locked.

The desk door is supposed to be locked (which it is) but you can open it about an inch and grab the things inside without actually opening it the proper way (with a key). Does anyone know how to fix this?
09-16-2010, 01:38 AM
Find
theDARKW0LF Offline
Member

Posts: 150
Threads: 17
Joined: Sep 2010
Reputation: 0
#6
RE: Making cupboard doors fly open?

(09-16-2010, 01:38 AM)Armored Cow Wrote: On a slightly related note, I am having problems keeping a desk door fully shut when locked.

The desk door is supposed to be locked (which it is) but you can open it about an inch and grab the things inside without actually opening it the proper way (with a key). Does anyone know how to fix this?

I have the same issue, but my workaround was to simply stack books infront of the item in it.

Check out my custom stories(1)(2)!
09-16-2010, 01:49 AM
Find
Marein Offline
Junior Member

Posts: 2
Threads: 0
Joined: Oct 2010
Reputation: 0
#7
RE: Making cupboard doors fly open?

Hey,

I've only just started playing around with the editor, but I came across a problem that seems relevant to this topic.

I'm trying to see whether the doors to a cabinet are closed, and act accordingly.

With my cabinet being called cabinet, I tried GetSwingDoorState("cabinet_Body_1") == -1, but that didn't seem to work (neither did using just cabinet). Is there a possibility for this?

Thanks in advance!
10-18-2010, 03:08 AM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#8
RE: Making cupboard doors fly open?

The SwingDoor entity is only for objects that have 1 door, not 2 like the cabinet. While it works it does not have 100% support for everything that a 1 door entity have. So GetSwingDoorState does not work I think.

Add two areas instead and then check collision between entity and areas as doors move in/out of them.
10-18-2010, 04:51 AM
Website Find
Marein Offline
Junior Member

Posts: 2
Threads: 0
Joined: Oct 2010
Reputation: 0
#9
RE: Making cupboard doors fly open?

(10-18-2010, 04:51 AM)jens Wrote: The SwingDoor entity is only for objects that have 1 door, not 2 like the cabinet. While it works it does not have 100% support for everything that a 1 door entity have. So GetSwingDoorState does not work I think.

Add two areas instead and then check collision between entity and areas as doors move in/out of them.
Thanks for the reply! I'm still having trouble, though. I tried the following, with an area just in front of the cabinet called DoorsArea:

AddEntityCollideCallback("cabinet", "DoorsArea", "CollideClosetDoors", true, 0);

And ran the function CollideClosetDoors with a debug message in it, but it didn't show when I opened the doors into the area. I also tried it with cabinet_Body_1. Is this the correct way of referencing part of an object? If not, perhaps the correct way will fix it?

Edit: Answered my question about referencing Body_1 by looking in the Amnesia levels Smile Still not really figuring it out though. Think I'll take a different approach to solving the situation for now, though a solution is still welcome! Smile
10-18-2010, 06:17 AM
Find




Users browsing this thread: 1 Guest(s)