Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Throwing Daniel Around
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#1
Throwing Daniel Around

So what I'd like is that when the player approaches an open door, he walks into a script area & activates it, then is pushed forward through the door, and the door slams closed behind him. Smile

I'm fine with script areas, I just need to know how to push Daniel through the door, (possibly also having him fall over too?) and then how to slam the door shut. Any help?

Ba-da bing, ba-da boom.
07-25-2011, 07:13 PM
Find
Streetboat Offline
Posting Freak

Posts: 1,099
Threads: 40
Joined: Mar 2011
Reputation: 56
#2
RE: Throwing Daniel Around

void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
Pushes the player into a certain direction. Note that you need values above ~2000 to see any effects.

afX - amount along the X-axis
afY - amount along the Y-axis
afZ - amount along the Z-axis
abUseLocalCoords - If true, axes are based on where the player is facing, not the world.

[Image: signature-2.png]
07-25-2011, 07:15 PM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#3
RE: Throwing Daniel Around

AddPlayerBodyForce, okay, but do I have to play around with X Y Z values or can you give me an example?
Any ideas on pushing the door shut?

Ba-da bing, ba-da boom.
07-25-2011, 07:17 PM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#4
RE: Throwing Daniel Around

play around with the X Y Z values, you should only need either X or Z. as for the door, put an area at the other side of the door, so when he hits it, the door slams, using

SetSwingDoorClosed("Door" , true , true);

or

AddPropForce("Door" , float afX, float afY, float afZ, bool abUseLocalCoords);

to close it Smile

07-25-2011, 07:26 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#5
RE: Throwing Daniel Around

They're World coordinates.

07-25-2011, 07:26 PM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#6
RE: Throwing Daniel Around

Alright I'll do that, but for the X Y Z values, are they special or can I just write plain old '6' or'12'?

Ba-da bing, ba-da boom.
07-25-2011, 07:28 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#7
RE: Throwing Daniel Around

I'd suggest writing 5000 or bigger as Daniel is stronger and heavier than doors Smile

07-25-2011, 07:29 PM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#8
RE: Throwing Daniel Around

So I have it set to
AddPlayerBodyForce(9000, 0, 0, true);
and when I walk into the script area nothing happens. Do I have to disable the player controls for it to work?

Ba-da bing, ba-da boom.
07-25-2011, 07:48 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#9
RE: Throwing Daniel Around

Not true, set is false to use global coordinates.

07-25-2011, 08:08 PM
Website Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#10
RE: Throwing Daniel Around

I changed that, and I think there was a little push but I couldn't tell. I'm going to try and disable player controls..

Ba-da bing, ba-da boom.
07-25-2011, 08:59 PM
Find




Users browsing this thread: 1 Guest(s)