Frictional Games Forum (read-only)
Throwing Daniel Around - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Throwing Daniel Around (/thread-9375.html)

Pages: 1 2


Throwing Daniel Around - JenniferOrange - 07-25-2011

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?


RE: Throwing Daniel Around - Streetboat - 07-25-2011

Code:
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.



RE: Throwing Daniel Around - JenniferOrange - 07-25-2011

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?


RE: Throwing Daniel Around - DRedshot - 07-25-2011

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


RE: Throwing Daniel Around - Tanshaydar - 07-25-2011

They're World coordinates.


RE: Throwing Daniel Around - JenniferOrange - 07-25-2011

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'?


RE: Throwing Daniel Around - Tanshaydar - 07-25-2011

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


RE: Throwing Daniel Around - JenniferOrange - 07-25-2011

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?


RE: Throwing Daniel Around - Tanshaydar - 07-25-2011

Not true, set is false to use global coordinates.


RE: Throwing Daniel Around - JenniferOrange - 07-25-2011

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