Jump to content
MacRae

Simple Sitting Script [Download Included]

Recommended Posts

Here's a simple example.  I placed a player, and a unit named "dude", and a chair named "chair1" on top of a tower object, and through the console ran this code:

dude switchmove "Crew";  
dude attachTo [chair1,[0,-.2, -.5]]; 
dude setdir 180; 

Works every time.  Note that you use setDir after attachTo, and the setDir value is then relative to the object it is attached to.  You can tweak your script to follow this example.  Remove all setpos/getpos stuff.

chair_On_Tower.jpg

Here's an example of chair on 2nd floor of navigable building:

chair2nd_Story.jpg

 

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

thanks for your help, yeah i get it working with the simple version no problems for ai and myself. I created a test mission and commented out the main "sitdown.sqf" and replaced it with:

 

Spoiler

 

private ["_chair","_unit"];
_chair = _this select 0;
_unit = _this select 1;

 

_unit switchmove "Crew";  
//_unit attachTo [_chair,[0,-.2, -.5]];
_unit setPosATL (getPosATL _chair);
_unit setDir ((getDir _chair) - 180);
standup = _unit addaction ["Stand Up","scripts\standup.sqf",[],10,true,true,"","true"];

 

attachTo works better for ai, setpostATL for player. so i can get it working, i was hoping to use the MP friendly edit above by Quicksilver et al but i can't see whats causing it to not work same as the simple version.

 


as far as i can tell from adding line by line the original script to the test above things only start going wierd once i start using BIS_fnc_mp, i'm unable to find the problem so will revert back to the basic SP script

 

 

 

Edited by lordfrith
words all wrong order and stuff

Share this post


Link to post
Share on other sites

Major necroposting here, but I hope it will help other people looking up this stuff:

I have been trying to run the scripts offered above for my mission - attachTo was completely locking up characters preventing them to move. I've came up with this (also with a script line preventing firing from the weapon):

 

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];
_chairPos = (getPosATL _chair);
_unit setPosATL (_chairPos);
_unit setDir ((getDir _chair)-180);
[[_unit,"Crew"],"switchMove",TRUE,FALSE] spawn BIS_fnc_MP;		// again!
standup = _unit addaction ["Stand Up","standup.sqf",[],10,true,true,"","true"];
_unit setPosATL [getPosATL _unit select 0, getPosATL _unit select 1,((getPosATL _unit select 2) +1)];

weaponSafety = player addAction ["Weapon safety on", {hintSilent "HELL NO";}, [], 0, false, false, "DefaultAction", ""];
_unit 

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;
player removeAction weaponSafety

Should work for chairs indoors and outside.

  • Like 2

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

×