Jump to content
Sign in to follow this  
mech

How to move a sitting player "backwards"?

Recommended Posts

Hi,

I'm using the following script by 7xCore for sit people on chairs but for the toilet, I need to move the person "backwards" after sitting him down.

// By [FEC] 7xCore
// Version 1.4

_fch = _this select 0;
_player_id = _this select 1;

_arrayAnim = ["HubSittingChairA_idle1",
"HubSittingChairA_idle2",
"HubSittingChairA_idle3",
"HubSittingChairA_move1",
"HubSittingChairB_idle1",
"HubSittingChairB_idle2",
"HubSittingChairB_idle3",
"HubSittingChairB_move1",
"HubSittingChairC_idle1",
"HubSittingChairC_idle2",
"HubSittingChairC_idle3",
"HubSittingChairC_move1",
"HubSittingChairUA_idle1",
"HubSittingChairUA_idle2",
"HubSittingChairUA_idle3",
"HubSittingChairUA_move1",
"HubSittingChairUB_idle1",
"HubSittingChairUB_idle2",
"HubSittingChairUB_idle3",
"HubSittingChairUB_move1",
"HubSittingChairUC_idle1",
"HubSittingChairUC_idle2",
"HubSittingChairUC_idle3",
"HubSittingChairUC_move1"
];

_random_anim = floor(random 23);
_string_animext = _arrayAnim select _random_anim;

//Funktion damit es bei BIS_fnc_MP geht

[[_player_id,_string_animext],"execChAnimGlobal"] spawn BIS_fnc_MP;
_player_id setPos (getPos _fch);
_player_id setDir ((getDir _fch) - 180);
_player_id setpos [ (getPos _fch select 0), (getPos _fch select 1), -0.6];

_action = _player_id addaction ["Aufstehen", "chairup.sqf"];

Share this post


Link to post
Share on other sites

I wish I knew how. I've run into this problem before. Setpos doesn't work very well. You might could try putting an invisible marker on the exact spot you want him to move back.

Share this post


Link to post
Share on other sites

To move objects relative to their direction/model coordinates, you can use modelToWorld.

The command takes a 3D offset to the objects center, so if you want the object (the player for example) to move "backwards", you just supply a negative value for the y-part:

_worldCoords = player modelToWorld [0, -1.5, 0];
player setPos _worldCoords;

The above code would reposition the player 1.5m behind the former position.

Share this post


Link to post
Share on other sites

Great, thx a lot! Now my soldiers can poop more realistically.

Next: Smell simulation.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×