Jump to content
johnnyboy

AI runs in place when run animation played on him

Recommended Posts

Via script, I'm forcing an AI to run at another unit (player or AI) for a melee attack.   Currently I'm using PlayActionNow to move the dude forward, but I have also used playmove and switchmove.   All these have the same problem sometimes:

//_slasher switchmove "AmovPercMrunSrasWpstDf";
//_slasher playmove "AmovPercMrunSrasWpstDf";
_slasher playActionNow "FastF";

The Problem:   Sometimes AI plays run animation, but is not moving forward.  He is running in place.  Is there a way to force forward movemet when a unit is playing running animation?

Share this post


Link to post
Share on other sites

I had trouble with this until I found a script by Phronk and I wrote something loosely based on that

https://github.com/AZCoder/AZC-LIB/blob/master/civilians/fn_CivRun.sqf

 

But in a nutshell, try forceWalk false and setSpeedMode "FULL". It could also be the specific animations. Check if "ApanPercMstpSnonWnonDnon_G01" works any better for you.

 

Oh yeah, you might try https://community.bistudio.com/wiki/setVelocityModelSpace to push them. Just watch the force applied or you'll kill the bugger.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks @AZCoder.   The code below (executed within a loop) now has these crazy AI basturds relentlessly chasing their prey.  They no longer get stuck running in place.

if (speed _slasher < 10) then 
{
	_slasher setPos (getPos _slasher vectorAdd [0,.1,0]);
	_slasher setVelocityModelSpace [0, 8, .2];
};
_slasher playActionNow "FastF";

It appears they need just enough velocity boost to overcome friction or something...

 

Edit:  I also had to add a setPos to bump dude forward a smidge to prevent them getting stuck.

  • 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

×