Jump to content
swift39

Reverting AI to original position

Recommended Posts

Just a quick question...

 

Is there a way after setting a new direction of  AI to return to their original position?

 

I am using getDirVisual for an official they turn and face as he walks by

_dir = getDirVisual _official; //Find the direction of the official

then execute it

_x disableAI "ANIM";
_x setDir _dir;
_x lookAt _official;

which works, but when released from the script they continue their animation in the "new" direction which is messing things up. What I would like to do is save the AI's original position then change direction during the script, then upon completion return to original direction and animation.

 

Hope this makes sense

 

Cheers

Greg

Share this post


Link to post
Share on other sites

I would try spawning a script that has small delay and waits for the unit to stop and then set the direction and animation.

 

something like:

[_unit] spawn
{
 params ["_unit"];

sleep 2;


waituntil { (abs (speed _unit)) < 0.1 };


// Set anim and direction here

};

 

Share this post


Link to post
Share on other sites

Get the position and direction of the unit and store it first?

 

Share this post


Link to post
Share on other sites

Thanks to you both, I was overthinking this I just had to place the getDir before disableAI and it works fine or as well as the AI will let you.

 

Cheers

Greg 

 

orgPos = getDir _x;
_x disableAI "ANIM";
_x setDir _dir;
_x lookAt _official;

 

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

×