Jump to content
MacRae

Simple Sitting Script [Download Included]

Recommended Posts

Hmmm, I could give it a try?

If i find out how to do it for you, ill Post it here!

Share this post


Link to post
Share on other sites
Hey man, Thankyou for the feedback,

At the moment im not sure why this is happening for you,

Because currently i have only used this script on the Camping chairs,

(Found at Tents>Camping Chair)

And i have tested the script with multiple people joining, and it has worked for me...

But i will try and fix your problem for you tonight,

Sorry this is happening to you!

Hey mate, just wanted to check if you had figured anything out about my error?

I had another look at it yesterday, and it seems like its related to players being unarmed.

I could not replicate it with an armed player, but didnt take long with unarmed :)

Share this post


Link to post
Share on other sites

Hey McRae,

the sitting script is working fine. Thank you for this ambiente script.

I only noticed one way to improve it :) Is there any way to disable movement while sitting on a chair and only allow head movement?

regards,

ian

Share this post


Link to post
Share on other sites

Hey nice script i tryed it out in arma 2 when i scrol to sit soldier like just stands on chair and slide back down to ground. Do you know what is problem?

Share this post


Link to post
Share on other sites

can anyone tell me if there somthing like this for arma 2

Share this post


Link to post
Share on other sites

Thank's for the script but I have a problem in the editor when I push the buttom sit down I have this message : [bIS]_fnc_MPexec] Fonction "MAC_fnc_switchMOVE" does not exist.

Share this post


Link to post
Share on other sites

Ok this script works good. I tryed a lot now to put the distance to the addaction at least of < 3 meters. It didn't work yet. Someone with a solution?

Share this post


Link to post
Share on other sites

The error with unarmed players sitting down and then going prone is happening still, any fix for this please?

Share this post


Link to post
Share on other sites

@dale0404

It isnt only unarmed.

We are experiencing it on MP, completely random tbh.

It just kinda happens when it wants to, regardless of your weapon, stance or anything else really. We did extensive testing on this to try and find a "source", to no avail.

Sometimes you can even see yourself sitting, while other people see you on your belly, and the other way around aswell.

Do anybody have any ideas, if its possible to make this script sync 100% in MP?

MacRea? Anyone else?

Share this post


Link to post
Share on other sites

This script doesn't work. Player will not actually sit down. Get the option to stand up, but you are already standing up. Never actually sits down. Is this broken due to arma update? If so, is there a fix?

EDIT: NVM I fixed it, it's all good.

Edited by EEEMB

Share this post


Link to post
Share on other sites
This script doesn't work. Player will not actually sit down. Get the option to stand up, but you are already standing up. Never actually sits down. Is this broken due to arma update? If so, is there a fix?

EDIT: NVM I fixed it, it's all good.

Can you tell me what did you do to fix it?

Share this post


Link to post
Share on other sites

Just stumbled on this, I use this in one of my missions and this is how I got it to work

init.sqf

MAC_fnc_switchMove = {
   private["_object","_anim"];
   _object = _this select 0;
   _anim = _this select 1;

   _object switchMove _anim;

};
switchMoveEverywhere = compileFinal " _this select 0 switchMove (_this select 1);";

From my experience if this is closer to the top of the init.sqf the better.

I don't know as much as some people on here but this is what I have used. Hope it helps.

Share this post


Link to post
Share on other sites
Does it work anymore?

Here you go.

The original script was designed to work in SP only (switchMove function does not broadcast across network by itself, therefore no one else would see the animation change). It also had an issue whereby once you were seated, you could choose to sit again on another chair, causing irreversible issues with the addActions.

This is a tweak for MP and stability in respect to those issues:

//============================ 'onPlayerRespawn.sqf' and 'initPlayerLocal.sqf'

player setVariable ['QS_seated',FALSE];

//============================ 'sitdown.sqf'

/*
Script Made By  MacRae    
Modded by [KH]Jman
Tweaked by Quiksilver for the addAction shit and MP compatibility
*/
private ["_chair","_unit"];
_chair = _this select 0; 
_unit = _this select 1; 

_chair setVectorUp [0,0,1];
[[_unit,"Crew"],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;
player setVariable ['QS_seated',true];
_unit setPos (getPos _chair); 
_unit setDir ((getDir _chair) - 180);
[[_unit,"Crew"],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;		// again!
standup = _unit addaction [
"Stand Up",
"scripts\standup.sqf",
[],
10,
true,
true,
'',
'(player getVariable 'QS_seated')'
];
_unit setPos [getPos _unit select 0, getPos _unit select 1,((getPos _unit select 2) +1)];


//============================ 'standup.sqf'

/*
Script Made By  MacRae    
Modded by [KH]Jman
Tweaked by Quiksilver for MP compatibility
*/

player setVariable ['QS_seated',false];
[[player,""],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;
player removeAction standup;

//============================ On the chair in editor init field

this addAction ["Sit Down","sitdown.sqf",[],10,true,true,'','(!(player getVariable 'QS_seated')) && ((speed player) < 1) && ((speed player) > -1)'];

Share this post


Link to post
Share on other sites

the version does not work...

use this one:

//============================ 'onPlayerRespawn.sqf' and 'initPlayerLocal.sqf'

player setVariable ['QS_seated',FALSE];

//============================ 'sitdown.sqf'

/*
Script Made By  MacRae    
Modded by [KH]Jman
Tweaked by Quiksilver for the addAction shit and MP compatibility
*/
private ["_chair","_unit"];
_chair = _this select 0; 
_unit = _this select 1; 

_chair setVectorUp [0,0,1];
[[_unit,"Crew"],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;
player setVariable ['QS_seated',true];
_unit setPos (getPos _chair); 
_unit setDir ((getDir _chair) - 180);
[[_unit,"Crew"],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;		// again!
standup = _unit addaction [
"Stand Up",
"scripts\standup.sqf",
[],
10,
true,
true,
"",
"(player getVariable 'QS_seated')"
];
_unit setPos [getPos _unit select 0, getPos _unit select 1,((getPos _unit select 2) +1)];


//============================ 'standup.sqf'

/*
Script Made By  MacRae    
Modded by [KH]Jman
Tweaked by Quiksilver for MP compatibility
*/

player setVariable ['QS_seated',false];
[[player,""],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;
player removeAction standup;

//============================ On the chair in editor init field

this addAction ["Sit Down","sitdown.sqf",[],10,true,true,'',"(!(player getVariable 'QS_seated')) && (abs(speed player) < 1)"];

Edited by Coding
  • Like 1

Share this post


Link to post
Share on other sites

Is there any way to live the player from spinning around in the chair and it not being oriented properly with the player?

  • Like 2

Share this post


Link to post
Share on other sites

I have a Altis lIfe server and want to add this where are im putting the code

MAC_fnc_switchMove = {
    private["_object","_anim"];
    _object = _this select 0;
    _anim = _this select 1;

    _object switchMove _anim;
    
};

i have 2 init.sqf 1 in my mpmission and 1 in mpmission\core\

Share this post


Link to post
Share on other sites

I added this to the beggining of the first script to disable addition addactions
 

player removeaction sitdown;
player removeaction standup;

Share this post


Link to post
Share on other sites

seems a bit necro to post here but it does relate to this script:

 

the edit by 'coding' above works a treat apart from if the chair is off ground level e.g. if i place the chair on the top floor of a military tower or first storey of house and sit down the player reverts to ground level after doing the action. the chair is still up on the roof and i'm sat on the ground floor directly underneath!

 

so far i've tested the script using getpos ATL, ASL and found no change

 

i've done alot of reading on sitting scripts today but not sure i've seen anything for this problem, any one come across this or knows what causes it?

Share this post


Link to post
Share on other sites

@lordfrith:  To solve your issue you could change those scripts to use setPosAtl and getPosAtl instead of setPos and getPos.

Share this post


Link to post
Share on other sites

Thanks for answer Jboy

 

heh, yeah i thought that would be the simple fix as well. i replaced the getpos setpos line with:

 

_unit setPosATL (getPosATL _chair);

 

it made no difference for some reason?

Share this post


Link to post
Share on other sites

odd...try getposasl / setposasl also.

 

And if that doesn't work, instead of setpos/getpos, use attachTo in sitdown, and detach in standup (after executing switchmoves).  You will have to monkey with the the attachTo relative position until unit is perfectly placed in chair.  And do the setdir after the attachTo to insure unit facing correct dir.  AttachTo will definitely work.

 

Then post your solution so next guy can benefit!  :)

Share this post


Link to post
Share on other sites

So...  AttachTo does work but also behaves as if the chair is on the lowest point. It seems like whichever floor i put the chair arma thinks its on ground level! Very strange but at least trying it with attachTo has shown that the script is working fine, its just the chair itself, or the game engine not properly recognising what floor its on.

 

not sure what to try now, might just sit on the ground before this does my head in entirely :D

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

×