Jump to content
Sign in to follow this  
OmniMax

Making a whole group sit down

Recommended Posts

I can get an individual soldier to sit down, but when they're in a group the leader must tell them to do something, even on careless.

I do this action ["sitDown", this] but they don't sit down, they get up and wander around no matter waypoint I use (dismissed, script, etc).

Stupid question. Can't figure it out. :(

Share this post


Link to post
Share on other sites

Try this:

{doStop _X; _X action ["SITDOWN",_X]} forEach (units group this)

Just make sure to use doFollow to return them to formation if you want them to get up and do stuff (as a group).

Share this post


Link to post
Share on other sites

It makes them stop, but they won't sit down. Instead they look around.

Apparently action ["SitDown", this] doesn't work anymore, can anyone confirm? Instead

switchMove "amovpsitmstpsraswrfldnon_weaponcheck1" works, but it's not the same.

switchMove sits them down, but they do this animation where they check their weapon and wave it a bit.

Any ideas?

Edited by OmniMax

Share this post


Link to post
Share on other sites

Yea, the exact action names tend to change from game to game... try "SIT DOWN" (with a space).

Share this post


Link to post
Share on other sites

Ok, I wrote up some quick code in the editor to keep an AI unit sitting while he's in safe mode:

sitDown = {_this setBehaviour "SAFE"; _this disableAI "ANIM"; _this action ["SITDOWN",_this]; sleep 5; waitUntil{if(animationState _this != "amovpsitmstpsraswrfldnon")then{sleep 8+random(3); _this action ["SITDOWN",_this]; waitUntil{animationState _this == "amovpsitmstpsraswrfldnon"}}; behaviour _this != "SAFE"}; _this enableAI "ANIM"}

Then simply call it on your unit:

this spawn sitDown

He'll remain seated until under attack. He might stand up to salute you if you greet him, in which case he'll sit down right afterwards, but other than that he won't move until he's no longer in "SAFE".

Share this post


Link to post
Share on other sites

So where does the above code go? In the init, or a .sqf?

Share this post


Link to post
Share on other sites

Any global space, be it an init field or script, as long as the sitDown code gets executed before you spawn it on a unit.

Share this post


Link to post
Share on other sites

OK, I can't figure this one out. I've put the long line of code in an .sqf and execVM it in the init.sqf. But how do I get it on a unit, the init field won't accept the "this spawn sitdown". Cheers for the continuing help.

Share this post


Link to post
Share on other sites

I know how you feel Uzii, I've been asking questions here and there and people have tried to be helpful but they're only giving part of the answers. For some of us who are new or returning to OFP/Arma after many years away it's very confusing.

Thanks all for trying to help but we need it all.

Share this post


Link to post
Share on other sites

If you're gonna put in a script, copy/paste this into an .sqf file:

_this setBehaviour "SAFE";
_this disableAI "ANIM";
_this action ["SITDOWN",_this];
sleep 5;
waitUntil{
    if(animationState _this != "amovpsitmstpsraswrfldnon")then{
         sleep 8+random(3);
         _this action ["SITDOWN",_this];
         waitUntil{animationState _this == "amovpsitmstpsraswrfldnon"}
    };
    behaviour _this != "SAFE"
}; 
_this enableAI "ANIM";

Then call it with 'this execVM "scriptname"' in unit's init field.

Share this post


Link to post
Share on other sites

Outstanding, thank you for this, its much appreciated.

Share this post


Link to post
Share on other sites

How have you got it to work?

all I get are errors in the rpt file

Error in expression <ions\sitdown.utes\sitdown.sqf"
_this setBehaviour "SAFE";
_this disableAI "AN>
 Error position: <setBehaviour "SAFE";
_this disableAI "AN>
 Error setbehaviour: Type Array, expected Object,Group
File D:\Documents and Settings\Sel\My Documents\ArmA 2\missions\sitdown.utes\sitdown.sqf, line 4

either I'm still not calling it correct or there is something missing.

Share this post


Link to post
Share on other sites

'this execVM "scriptname"' isn't quite right. I think I used something like null = [] execVM "scriptname"

Try that.

Share this post


Link to post
Share on other sites

Nope that didn't work either, I get the same errors as before.

Did you add anything to the script posted by Big Dawg or did you just cut and paste then save.

I've tried loads of different scripts today and only about two have actually worked, I've done alot of scripting with OFP and ARMA but not for a year or two and I've never had this many problems with the simplest things.

Share this post


Link to post
Share on other sites

It probably is just that, the simplest thing. Check you've got the file name dead right, and in the right format, with the " " on either side. Here's the one I've got working:

in sitdown.sqf

_this setBehaviour "SAFE";
_this disableAI "ANIM";
_this action ["SITDOWN",_this];
sleep 5;
waitUntil{
    if(animationState _this != "amovpsitmstpsraswrfldnon")then{
         sleep 8+random(3);
         _this action ["SITDOWN",_this];
         waitUntil{animationState _this == "amovpsitmstpsraswrfldnon"}
    };
    behaviour _this != "SAFE"
}; 
_this enableAI "ANIM";

Now in the init line of the unit:

nul=this execVM "sitdown.sqf";

Ah, now I see, I typed in the wrong init line. That one should work. Sorry for the wrong info ;)

Share this post


Link to post
Share on other sites

Cheers I did eventually get it to work but in a different way.

I put this at the start of the script

_this = _this select 0

and called it with

null=[this] execVM "sitdown.sqf";

placed in the init space of the unit.

That's more the way I remember it being done.

I'm now stuck on my next item but that's for another day.

Yours also worked thanks.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

I've been playing around and noticed something odd.

I rewrote the script so that I could pass variables and have it do other stuff, as I didn't understand the script as it was I removed a lot of stuff and tried to make it work with a group.

I did get it to work but with a few odd results, if you set the behaviour of the unit to "safe" they do sit down but then get straight back up as mentioned in earlier posts but if you set it to "" ie nothing they all stay seated unless shot at or you walk right up to them, at which point the unit may stand and greet you with a salute.

;//grptwo=group this;null=[grptwo,"","sitdown"] execVM "sitdowngrp.sqf"


_grp     = _this select 0;
_status  = _this select 1;
_actions = _this select 2;

{
_x setBehaviour _status;
 _x action [_actions,  _x];
sleep random 4;
_x setBehaviour _status;
} forEach (units _grp );

Share this post


Link to post
Share on other sites

The disableAI "ANIM"/enableAI "ANIM" is the essential part to force AI to keep sitting. That your code works with default behaviour is not surprising, but it won't ensure that they will stay seated indefinately (lots of things can cause them to want to stand up, including the sit action simply ending over time). What's surprising is that in "SAFE" mode AI won't stay seated at all by themselves. It's not much of a problem I guess if you use disableAI, one thing I don't like about it though is that it disables them from looking around too.

Edit: Btw, my code can still be used on a whole group, just spawn it on each member with forEach.

Share this post


Link to post
Share on other sites

Your script is awesome Uzii, was looking for something else and found this. Nice addition.

Share this post


Link to post
Share on other sites

Does it work on dedicated server ? When I run the mission on my PC Ai sit down, but when I uploaded the mission to dedicated server all ai are standing ?

Edit: new ACE 0.220 problem

Edited by Rafalski

Share this post


Link to post
Share on other sites

This is working fine.. thanks Big Dawg KS for the code.. I have a question though..

this is the script I am using:

_this setBehaviour "SAFE";

_this disableAI "ANIM";

_this action ["SITDOWN",_this];

removeAllWeapons _this;

sleep 5;

waitUntil{

if(animationState _this != "amovpsitmstpsraswrfldnon")then{

sleep 8+random(3);

_this action ["SITDOWN",_this];

waitUntil{animationState _this == "amovpsitmstpsraswrfldnon"}

};

behaviour _this != "SAFE"

};

_this enableAI "ANIM";

and I am calling it by placing this in the units init line:

nul=this execVM "sitdown.sqf";

My question is how would I have the unit sit in a chair?

I tried placing a chair under the unit, but it basically goes throught he chair and just sits on the ground.

Edited by Meatball0311

Share this post


Link to post
Share on other sites

I think you must play around with either of

ActsPsitMstpSnonWnonDnon_varSittingDrinking

ActsPsitMstpSnonWnonDnon_varSittingOnTheWall

ActsPsitMstpSnonWnonDnon_varSittingSleeping01

ActsPsitMstpSnonWnonDnon_varSittingSleeping02

http://community.bistudio.com/wiki/ArmA2:_Moves

e.g.

YourSoldier switchMove "ActsPsitMstpSnonWnonDnon_varSittingOnTheWall";

You need to alter the z-axis also as when I tried this just now the soldier had his calf buried in the earth up to his knee caps.

Share this post


Link to post
Share on other sites

How can you make them move again (follow you) ?

I let a hostage sit down with this script but if i join them with my group they wont move.

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  

×