Jump to content
Sign in to follow this  
cuel

Make AI sprint

Recommended Posts

This possible?

setSpeedMode "FULL" makes them run in the lower combat pace. Is there a way to make them sprint towards a target?

Share this post


Link to post
Share on other sites

They sprint some of the time, but it often depends on the terrain. They tend to slow down for brief periods when turning or running around obstacles, which for the AI may be anything. Try using forceSpeed as well (around 6 or 7).

Apart from that the only way I know to guarantee an AI will aprint from A to B is to force the animation on him.

Share this post


Link to post
Share on other sites

I was just gonna post the same thing brother. I hope there is an easy way and we didn't just add 1 more thing to BIS todo list :)

---------------- update --------------------

tried what ranger posted but it didn't do anything for the units speed.

Edited by Nimrod_Z

Share this post


Link to post
Share on other sites

try "forcespeed". but if i remember correctly this was always an issue in arma.

Share this post


Link to post
Share on other sites

I know this is an ancient thread, but has anyone figured out how to do this? Been almost a year and it doesn't appear there's any way to force an AI to sprint.

Share this post


Link to post
Share on other sites
I know this is an ancient thread, but has anyone figured out how to do this? Been almost a year and it doesn't appear there's any way to force an AI to sprint.

My friend made a mod that forces the AI to use the sprinting animation again. If you'd like I can get it to you...the downside is that it will become a requirement for anyone to play

Share this post


Link to post
Share on other sites

I've done a 'sprint animation' loop pretty easily with something like this.

while {true} do {
_dir = [_unit,_target] call BIS_fnc_DirTo;
_unit setdir _dir;
_unit playMove "AmovPercMevaSnonWnonDf";
sleep 0.6;
};

The playmove will play the animation and the unit will sprint forward for the duration of the animation, which is only a bit over a half a second. The problem is, it looks kludgey as heck and the AI gets 'hung' up all the time on objects, and sometimes just glitches out and sprints in place.

Share this post


Link to post
Share on other sites

doStop _unit;

_unit doMove _movePos;

_unit forceSpeed 6;

Makes him sprint fine for me.

Share this post


Link to post
Share on other sites
doStop _unit;

_unit doMove _movePos;

_unit forceSpeed 6;

Makes him sprint fine for me.

I have tried something like this before ... it doesn't seem to work for me at least :|

And having multiple units running an animation script doesn't seem very efficient to me... And it makes it rather difficult for pathing around building and etc.

Thank you!!

Edited by Genesis92x

Share this post


Link to post
Share on other sites

I made a mod for myself back in arma2 that I inserted into the menu which made my grunts sprint. I had to silently move them into a new group,disableAI everything,never fire, set a waypoint, tell them to run there, rejoin the players group and then reenable it all at the end of the run so they wouldnt get caught up looking at something. (they used to do this kind of chicken dance when someone was shooting at them). It worked well when you just needed them to stop mucking around and just run.

Share this post


Link to post
Share on other sites
I've done a 'sprint animation' loop pretty easily with something like this.

while {true} do {
_dir = [_unit,_target] call BIS_fnc_DirTo;
_unit setdir _dir;
_unit playMove "AmovPercMevaSnonWnonDf";
sleep 0.6;
};

The playmove will play the animation and the unit will sprint forward for the duration of the animation, which is only a bit over a half a second. The problem is, it looks kludgey as heck and the AI gets 'hung' up all the time on objects, and sometimes just glitches out and sprints in place.

I do some changes for this code, event handler replaces animations run on sprint. Now ai can sprint right or left.

_unit addEventHandler ["AnimChanged", 
{
_aunit = _this select 0;
_curanim = _this select 1; 
    if (_curanim == "AmovPercMrunSnonWnonDf") then {_aunit playmove "AmovPercMevaSnonWnonDf"};
    if (_curanim == "AmovPercMrunSnonWnonDfl") then {_aunit playmove "AmovPercMevaSnonWnonDfl"};
    if (_curanim == "AmovPercMrunSnonWnonDfr") then {_aunit playmove "AmovPercMevaSnonWnonDfr"};
}];

Share this post


Link to post
Share on other sites
I do some changes for this code, event handler replaces animations run on sprint. Now ai can sprint right or left.

_unit addEventHandler ["AnimChanged", 
{
_aunit = _this select 0;
_curanim = _this select 1; 
    if (_curanim == "AmovPercMrunSnonWnonDf") then {_aunit playmove "AmovPercMevaSnonWnonDf"};
    if (_curanim == "AmovPercMrunSnonWnonDfl") then {_aunit playmove "AmovPercMevaSnonWnonDfl"};
    if (_curanim == "AmovPercMrunSnonWnonDfr") then {_aunit playmove "AmovPercMevaSnonWnonDfr"};
}];

That's actually very clever. Doesn't look too bad aswell!

I added the new kneel sprint and the prone sprint to it, this is incredibly useful, thanks big time for sharing this!

:yay:

_unit addEventHandler ["AnimChanged", 
{
_aunit = _this select 0;
_curanim = _this select 1; 
    if (_curanim == "AmovPercMrunSnonWnonDf") then {_aunit playmove "AmovPercMevaSnonWnonDf"};
    if (_curanim == "AmovPercMrunSnonWnonDfl") then {_aunit playmove "AmovPercMevaSnonWnonDfl"};
    if (_curanim == "AmovPercMrunSnonWnonDfr") then {_aunit playmove "AmovPercMevaSnonWnonDfr"};

    if (_curanim == "AmovPknlMrunSnonWnonDf") then {_aunit playmove "AmovPknlMevaSnonWnonDf"};
    if (_curanim == "AmovPknlMrunSnonWnonDfl") then {_aunit playmove "AmovPknlMevaSnonWnonDfl"};
    if (_curanim == "AmovPknlMrunSnonWnonDfr") then {_aunit playmove "AmovPknlMevaSnonWnonDfr"};

    if (_curanim == "AmovPpneMrunSnonWnonDf") then {_aunit playmove "AmovPpneMsprSnonWnonDf"};
}];

  • Like 1
  • Thanks 1

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  

×