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
AddBodyForce Cabinet Doors Script Problem
Mazl Offline
Junior Member

Posts: 5
Threads: 1
Joined: Jun 2013
Reputation: 0
#1
AddBodyForce Cabinet Doors Script Problem

Hello guys,

i want to get the two nice cabinet doors fast open with the BodyForce-Command. I dont know, whats the problem in this script Sad

SetSwingDoorDisableAutoClose("cabinet_nice_2", true);
  SetSwingDoorLocked("cabinet_nice_2",false,true);
  StartPlayerLookAt("lookatentitycabinet", 2, 2, "");
  SetMessage("Intro", "Intro11", 2.0f);
  AddEntityCollideCallback("Player", "Furniture_Shock_Area", "cabinetscare", true, 1);
}

void cabinetscare (string &in asParent, string &in asChild, int alState)
{  
  PlaySoundAtEntity("cabinetopensound","break_wood.snt","Player",0.1f,false);
  AddBodyForce("cabinet_nice_2_Body_1",0,0,-2000,"world");
  AddBodyForce("cabinet_nice_2_Body_2",0,0,-2000,"world");
  AddPlayerBodyForce(0, 0, -30000, false);          
  SetEntityActive("servant_grunt_1", true);
  SetPlayerSanity(0.4f);
  FadeOut(1.0f);
  ChangeMap("map_1", "PlayerStartArea_1","","");
}

I want to open it in the same direction like "AddPlayerBodyForce", which works correctly, but by the cabinet nothing happens, just a little bugging...

PS: sry for my bad english, i am german ^.^
PPS: its not the whole code, i just copied that, which is important ^-^
(This post was last modified: 06-16-2013, 05:22 PM by Mazl.)
06-13-2013, 01:45 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#2
RE: AddBodyForce Cabinet Doors Script Problem

I *think* that only works for the player.

Try using AddPropForce.

PHP Code: (Select All)
void AddPropForce(stringasNamefloat afXfloat afYfloat afZstringasCoordSystem);
//Name of the prop etc, force along X, Y, Z axes, and the coordinate system. "world" I think. 
(This post was last modified: 06-13-2013, 02:01 PM by Tomato Cat.)
06-13-2013, 02:00 PM
Find
Mazl Offline
Junior Member

Posts: 5
Threads: 1
Joined: Jun 2013
Reputation: 0
#3
RE: AddBodyForce Cabinet Doors Script Problem

No, i tried it already Sad

for Player its the AddPlayerBodyForce


I also tried Prop- and BodyImpulse. SetSwingDoorClosed is too low for my CS.
06-13-2013, 02:09 PM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#4
RE: AddBodyForce Cabinet Doors Script Problem

Perhaps you're doing it from the wrong direction. Also check if the cabinet is locked.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
06-13-2013, 02:18 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#5
RE: AddBodyForce Cabinet Doors Script Problem

The door and the body is actually two different models put together by the Body. You need to direct it to the door, not the body, which is impossible (I think).

"Veni, vidi, vici."
"I came, I saw, I conquered."
06-13-2013, 02:19 PM
Find
Mazl Offline
Junior Member

Posts: 5
Threads: 1
Joined: Jun 2013
Reputation: 0
#6
RE: AddBodyForce Cabinet Doors Script Problem

Quote: Perhaps you're doing it from the wrong direction. Also check if the cabinet is locked.
PHP Code: (Select All)
SetSwingDoorDisableAutoClose("cabinet_nice_2"true);
SetSwingDoorLocked("cabinet_nice_2",false,true); 

I already unlocked it Wink

and:

PHP Code: (Select All)
AddPropForce("cabinet_nice_2_Body_1",0,0,-2000,"world");  AddPropForce("cabinet_nice_2_Body_2",0,0,-2000,"world");  
AddPlayerBodyForce(00, -30000false); 


the AddPlayerBodyForce goes to the right direction, and i think this is the direction, were the cabinetdoors have to go (the player goes backwards)

Quote: The door and the body is actually two different models put together by the Body. You need to direct it to the door, not the body, which is impossible (I think).
the 2 doors are two bodies (Body_1 and Body_2). Because that i think AddBodyForce, and when i take the value to 30000, the doors are bugging around -> something happens, but not that, what i want Big Grin
(This post was last modified: 06-13-2013, 02:29 PM by Mazl.)
06-13-2013, 02:28 PM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#7
RE: AddBodyForce Cabinet Doors Script Problem

This would be a bit roundabout, but you could try this: Make a new entity that is a move object, but is invisible. (You could just modify the blockbox and save it as a new entity)

Then place them in the level at the right angles so that when you move them (and move them rather fast but a short distance) they will "smack" the doors.

As I said, a bit roundabout but it should achieve what you want.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
06-13-2013, 02:30 PM
Find
Mazl Offline
Junior Member

Posts: 5
Threads: 1
Joined: Jun 2013
Reputation: 0
#8
RE: AddBodyForce Cabinet Doors Script Problem

Sorry, i dont understand much about entitys, modeleditor etc. Big Grin

I used this tutorial:

http://wiki.frictionalgames.com/hpl2/tut...hdoorsopen

Edit: Really no one know whats the problem ?? The Tutorials says, its going, but... I need it so much Sad
(This post was last modified: 06-13-2013, 03:30 PM by Mazl.)
06-13-2013, 02:56 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#9
RE: AddBodyForce Cabinet Doors Script Problem

(06-13-2013, 02:30 PM)DeAngelo Wrote: This would be a bit roundabout, but you could try this: Make a new entity that is a move object, but is invisible. (You could just modify the blockbox and save it as a new entity)

Then place them in the level at the right angles so that when you move them (and move them rather fast but a short distance) they will "smack" the doors.

As I said, a bit roundabout but it should achieve what you want.
Actually that's an awesome idea.
I don't know if applying it here it's the best solution but it's great for more complex stuff. So i'll keep it in mind in case i ever need it. +rep DeAngelo.

Mazl,

I always use BodyImpulse and is working for me.
I just put the cabinet in my map, wrote this line and it opened one door as it should.


AddBodyImpulse( "cabinet_nice_1_Body_1", 5, 0, 5, "" );





(This post was last modified: 06-15-2013, 03:59 AM by Daemian.)
06-15-2013, 03:41 AM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#10
RE: AddBodyForce Cabinet Doors Script Problem

(06-15-2013, 03:41 AM)Amn Wrote: Actually that's an awesome idea.
I don't know if applying it here it's the best solution but it's great for more complex stuff. So i'll keep it in mind in case i ever need it. +rep DeAngelo.

Mazl,

I always use BodyImpulse and is working for me.
I just put the cabinet in my map, wrote this line and it opened one door as it should.


AddBodyImpulse( "cabinet_nice_1_Body_1", 5, 0, 5, "" );





I've only been working with HPL for a few months and in that time I've had to learn the editor from scratch, scripting from scratch, and model editor from scratch (I was thinking about learning blender, but that's a can of worms I'm not gonna open till my first CS is done)

and the one thing I've learned about HPL, is no matter the scope of your custom story, you WILL run into a situation where the engine just can't do what you want. In these instances, you either cut your losses and move on, or you improvise.

For instance, I have a wedding flashback in my story, where I force the player to "walk down the aisle" but the normal "force player to walk" script I didn't like because of the head bobble. I could've cut my losses, but I had already spent about 4 hours building the church (4 hours on something the player will see for a 3 second flashback, story of the Amnesia CS creators life, am I right?) so what I did was took a painting, modified it to be a move object, turned it sideways and plopped the player on it. Now they glide beautifully during the scene. In essence I turned a work of art into a surf board. Amazing what you can do in HPL with some improvising. Smile

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
06-15-2013, 06:27 AM
Find




Users browsing this thread: 1 Guest(s)