Jump to content
Sign in to follow this  
Kydoimos

AI Sitting on chairs

Recommended Posts

Hi, seen a couple of threads for this but not many for Arma 3 and not many with any good answers. How can I make a unit sit on a chair? I've tried disabling AI and running a sitting animation on a waypoint just ahead of the unit. But for some reason, they hover above the chair, rather than on it. I think I might need to turn the collision off? Or add another command? It's probably something quite simple, I know. Thanks in advance! Oh, and simple terms please - I'm a newbie at this editing lark (but learning more everyday!)

Share this post


Link to post
Share on other sites

Hi!

After many tries I've managed to sit the player down.

I have unit name p1

I have bench name b1

I have put waypoint and in waypoint on act.:

p1 setBehaviour "SAFE"; p1 switchMove "InBaseMoves_SittingRifle2"; p1 disableAI "anim"; p1 attachTo [b1,[0,0.7,-0.15]];

Share this post


Link to post
Share on other sites

Thank you both! Very nearly there. Just trying to set the azimuth? Can't get the unit to face the direction I want? Doesn't seem to reflect the direction of the unit's azimuth or the direction of the set waypoint. Is there a command? I've tried setdirection but I don't think it's the right one? Thanks again!

Share this post


Link to post
Share on other sites

Thanks as always Killzone. It looks complicated but I'll sit down and give it a good go!

Share this post


Link to post
Share on other sites
Thanks as always Killzone. It looks complicated but I'll sit down and give it a good go!

Yeah man, it "looks" complicated but once you figured it out it is pretty simple.

Share this post


Link to post
Share on other sites

Looking at the diagram on your blog, Killzone, can you set the azimuth by using the setVectorDirAndUp command? I've fiddled around with it a bit and can see that it works in other ways. If you can set the azimuth, I'll keep playing until I get it. I'm impressed with all the work you've put in!

Share this post


Link to post
Share on other sites
Looking at the diagram on your blog, Killzone, can you set the azimuth by using the setVectorDirAndUp command? I've fiddled around with it a bit and can see that it works in other ways. If you can set the azimuth, I'll keep playing until I get it. I'm impressed with all the work you've put in!

try changing ratio between x and y

setVectorDirAndUp [[x,y,0],[0,0,1]];

Share this post


Link to post
Share on other sites

Brilliant! Finally have it working. Thanks!

Share this post


Link to post
Share on other sites

try BIS_fnc_ambientAnim

See here for the full explanation

it is still a work in progress with lining stuff up to get them to fit just right.

Share this post


Link to post
Share on other sites
try BIS_fnc_ambientAnim

See here for the full explanation

it is still a work in progress with lining stuff up to get them to fit just right.

Thanks

Share this post


Link to post
Share on other sites

Is it possible at all the get the AI to sit in the chair but if fired at get out of the chair and fire back? ATM you can fire at it and it doesn't react at all.

Share this post


Link to post
Share on other sites

I have seen the correct call or variable for this but having problems finding it right now.

Will do more research and get back to you.

EDIT:

Knew it wasn't far away.

BIS_fnc_ambientAnimCombat

/*	Author: Jiri Wainar


Description:
Play set of ambient animations on given unit AND allows the unit to leave the ambient state and engage enemy or move away.


Remarks:
* Function controls BIS_fnc_ambientAnim; check that function [Remarks] section for more info of how to use it.
* Unit automatically leaves the animation loop if there is an enemy in 300m he knows about.


Parameter(s):
0: OBJECT - unit the anim & gear changes are going to be applied to
1: STRING (optional, default "STAND") - animation set id, describing what the unit's action looks like.
   > "STAND" 		- standing still, slightly turning to the sides. Needs a rifle!
   > "WATCH"		- standing and turning around, good for soldier on watch. Needs a rifle!
   > "GUARD"		- standing still, like on guard with hands behing the body.
   > "SIT_LOW"		- sitting on the ground, with weapon.
   > "KNEEL"		- kneeling, with weapon.
   > "LEAN"		- standing while leaning (on wall)


2: STRING (optional, default "RANDOM") - equipment level id, describing how heavily is the unit equipped.
   > "NONE"  		- no goggles, headgear, vest, weapon
   > "LIGHT"  		- no goggles, headgear, vest
   > "MEDIUM" 		- no goggles, headgear
   > "FULL"  		- full gear = no touches
   > "RANDOM" 		- gear is randomized according to the animation set


3: CODE or STRING (optional, default {false}) - condition that if true frees the unit from the animation loop


4: STRING (optional, default "COMBAT") - behaviour the unit should go to, when freed.


Returns:
-


Example:
[this,"STAND","FULL",{(player distance _this) < 5}] call BIS_fnc_ambientAnimCombat;
*/

Remember captials for the combat mode.

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites

As another thread today mentioned, to animate then have them respond you can use BIS_fnc_ambientAnimCombat however that function doesn't appear to be working properly (it never releases the animations).

Share this post


Link to post
Share on other sites

Just want to add: If you want to setDir the unit that is attached to the object, there is one major thing you have to remember.

A Unit that is not attachTo anything relies on the world for his direction. That means 0 = North, 180 = South relative to the game world.

A Unit that IS attachTo anything relies on the object it is attached to for its direction.

Lets say a chair (obviously).

Placing a chair down facing 90 = East relative to the game world.

When you attach the unit to the chair, his direction will be relative to the chair, starting at 0 = North (or 90 = East relative to game world).

Remember the chair is facing 90 = EAST, in the game world, the unit attached to the chair will be facing EAST, but his relative direction is 0 = NORTH.

If you turn the chair around whilst the unit is still attached to it, the unit will always be facing NORTH, unless you setDir unit obviously.

Share this post


Link to post
Share on other sites
Hi!

After many tries I've managed to sit the player down.

I have unit name p1

I have bench name b1

I have put waypoint and in waypoint on act.:

p1 setBehaviour "SAFE"; p1 switchMove "InBaseMoves_SittingRifle2"; p1 disableAI "anim"; p1 attachTo [b1,[0,0.7,-0.15]];

Where did you find "inBaseMoves_SittingRifle2";????

All i did was this "[this,"SIT"] call BIS_fnc_ambientAnim;" and it works fine

  • Like 1

Share this post


Link to post
Share on other sites
Where did you find "inBaseMoves_SittingRifle2";????

All i did was this "[this,"SIT"] call BIS_fnc_ambientAnim;" and it works fine

the "inbasemoves_sittingrifle2" is the name of the animation that plays.

The function makes this easier as it means you don't have to search through the animations to have the same effect.

In essence the OP in this thread has done exactly what the function does, but he did it the hard way.

Thanks ArmASalt3 good to know that...

Share this post


Link to post
Share on other sites

How is it that no one had said anything about the guy in the field toilet in the sample mission?

Share this post


Link to post
Share on other sites

It appears BIS_fnc_ambientAnimCombat has been fixed in the latest stable release.

The feedback tracker page shows fixed.

---------- Post added at 08:53 ---------- Previous post was at 07:27 ----------

I will update example mission (when I get time) and include a couple of bis_fnc_ambientAnimCombat examples.

Share this post


Link to post
Share on other sites
It appears BIS_fnc_ambientAnimCombat has been fixed in the latest stable release.

The feedback tracker page shows fixed.

---------- Post added at 08:53 ---------- Previous post was at 07:27 ----------

I will update example mission (when I get time) and include a couple of bis_fnc_ambientAnimCombat examples.

How bout that sample mission ;P

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  

×