Jump to content
Sign in to follow this  
Donald Flatulence

Forcing AI to run at full speed, ignoring hostile units?

Recommended Posts

So far I have been unable to do this; the reason behind my attempts is to force CSAT troops to rush a position in large numbers whilst it is defended by a small number of players - currently when they are in sight of the players they hold position to engage, or advance extremely slowly.

Obviously that is the sensible thing to do from a tactical perspective, hence their programmed behaviour, but is there any way around it?

I have tried using "dissableAI FSM" and "set capture" already, disabling FSM prevented them engaging but I could still not force them to run.

Setcaptive had a similar effect but I want friendly (BLUFOR) units to still open fire, hence I made BLUFOR hostile toward civilians (ergo they attacked CSAT "captives")

The problem is they also considered every empty vehicle and a number of objects in their base hostile, and while it was hilarious to watch them run around panicking and shouting "CONTACT!" in their own base it did detract from their ability to, you know, shoot at the enemy. :p

Thanks in advance for your help :)


SOLUTION (sort of...):

Place this in the init line of one unit in each group, this will force the group to prioritise movement and reduces the time they spend engaging - its not perfect but it makes a big difference.

{

_x doMove getpos Attack;

_x setspeedmode "FULL";

_x setbehaviour "SAFE";

_x setskill ["spotDistance",0.1];

_x setskill ["spotTime",0.1];

_x setskill ["courage",1];

_x setskill ["commanding",0.1];

_x setskill ["general",0.1];

}forEach units group this;

////Change the red word to the name of the object you wish the AI to move to (do not use a marker!)////

Edited by AwkwardEd

Share this post


Link to post
Share on other sites

Welcome to AI. xD

There's no way to do this currently. The closest I can think of is getting the units to rotate into freshly created groups but then it depends if swapping groups out messes up other parts of the game for you.

There's at least one thread in here, and some discussion in AI dev branch & another thread in there with more info.

Do a search and you'll find them, there's not much more to add to them unfortunately. :\

Share this post


Link to post
Share on other sites

Ah well, thanks for your replies anyway then!

With regard to forcespeed, the wiki describes it as a limit on speed, but ill be sure to have a look.

Share this post


Link to post
Share on other sites
Welcome to AI. xD

There's no way to do this currently. The closest I can think of is getting the units to rotate into freshly created groups but then it depends if swapping groups out messes up other parts of the game for you.

There's at least one thread in here, and some discussion in AI dev branch & another thread in there with more info.

Do a search and you'll find them, there's not much more to add to them unfortunately. :\

This.

Once the groups nearTargets array contains enemy, they can and usually will do their own thing, which generally includes ignoring most commands :)

One trick I found helps a little is to reduce the rating of their perceived enemies down to 0-2000.

Share this post


Link to post
Share on other sites

Seems like your situation is a tough one.

I think if you use

disableAI "FSM"

then it'll disable some danger checking routines and make them more impervious to danger.

You could also try setting their behaviour to careless as long as they don't need to be engaging the enemy, but I don't know how well that works.

Lastly you can also try to force it by disabling targeting routines for the ai and make them move at full speed until they're close enough that it can be reenabled.

---------- Post added at 09:50 ---------- Previous post was at 09:37 ----------

From running my own test, then out of all my suggestions disabling fsm on the units seems to be the most effective, but it did slow down their advance heavily as they were put under fire and started taking casualties, they also seemed to retreat as their squad got murdered by the HMG they were assaulting. Despite this, it fared better than the others.

---------- Post added at 09:57 ---------- Previous post was at 09:50 ----------

And running another test gives some interesting results. I placed three of these squads with no fsm and observed.

http://i.hizliresim.com/4g30v7.png

There's the blufor HMG to the left above the group that is charging.

To the very right is the first group who were immediately engaged and acted as a covering squad, suppressing the HMG as the others moved up.

To the left of that, we have a squad that was wiped out, except for the one soldier retreating.

Share this post


Link to post
Share on other sites

Hi all, thanks for your suggestions,

I will certainly investigate doMove and setBehaviour to see if that has an effect, thanks for the links

MDCCLXXVI could you explain modifying the rating in a little more detail? As I understood it the rating system was simply to ensure friendly AI fired on teamkillers once their rating dropped below -2000, but maybe there is more too it?

Tinter, thanks for doing such thorough tests! Your results were very interesting, I mentioned in my first post i disabled FSM on each unit myself, however when set to careless behaviour they would walk too slow for it to be considered assaulting, and set to Alert they would walk at a similar pace with their weapons raised - in my tests any how.

That said I did not disable any targeting routines, perhaps I should include that too... I'm surprised even one soldier retreated as I thought such behaviour was handled by the FSM, but I don't consider that a problem at the moment.

As I cant be entirely sure form the screen shot, which behaviour mode were your troops in?

Put simply I would call any suggestion the resulted in either the AI continuing to advance at a reasonable speed and returning fire, or advancing at full speed while ignoring enemy fire, a temporary solution until the developers can add a new move command (see link)

http://feedback.arma3.com/view.php?id=22684

Share this post


Link to post
Share on other sites

Try disableAI "FSM" for all of them and a waypoint with Never Fire/Careless/Full speed.

Share this post


Link to post
Share on other sites

Thanks Outlaw, no joy on that one

BUT

I placed an object (the "device") on top of a hill and called it "target", then placed the following code in the initialization box of each unit (of 4 assault squads):

this doMove getpos target; 
this setspeedmode "FULL"; 
this setbehaviour "SAFE"; 
this setskill ["spotDistance",0.1]; 
this setskill ["spotTime",0.1]; 
this setskill ["courage",1]; 
this setskill ["commanding",0.1];

It seemed very effective to me, Ai continued to engage but still pushed forward pretty relentlessly, instead of being able to camp behind a low wall and pick them off one by one I was quickly overwhelmed - as far as I'm concerned it kind of worked as I hoped!

Could anyone try this out and verify if it works?

Share this post


Link to post
Share on other sites

MDCCLXXVI could you explain modifying the rating in a little more detail? As I understood it the rating system was simply to ensure friendly AI fired on teamkillers once their rating dropped below -2000, but maybe there is more too it?

AI also use rating for targeting/auto-targeting, and perhaps even in FSM though I do not know. The higher the rating, the more they treat you as a threat. If an enemy MBT rolls by which has gained a number of kills (crews rating increases), they enter 'hide/flee' state more quickly from my testing, than if a lowly rifleman with 0 rating is nearby they are less likely to enter the stop/lay down behavior.

oukej could probably explain better or correct any inaccuracies, we can't really see the code the AI is using so we have to walk backward toward solutions.

Further reading:

https://community.bistudio.com/wiki/ArmA:_Rating_Values

https://community.bistudio.com/wiki/rating

https://community.bistudio.com/wiki/addRating

Share this post


Link to post
Share on other sites

Thanks MDCCLXXVI, that's interesting to know, it's very true that we always have to work backward with these things but my previous post might be close to a solution.

I wonder if setting every friendly's rating to -1900 would minimise AI cowardice... Ill look into it using:

BNRG_fnc_setRating = {
  _setRating = _this select 0;
  _unit = _this select 1;
  _getRating = rating _unit;
  _addVal = _setRating - _getRating;
  _unit addRating _addVal;
};

[-1900,player] call BNRG_fnc_setRating//set player rating -1900

Share this post


Link to post
Share on other sites

Yeah it works as described on my end.

You could spare yourself some time and use forEach command when applying the same code over and over again.

Place in init field of one of the group's units.

{
_x doMove getpos target;   
_x setspeedmode "FULL";   
_x setbehaviour "SAFE";   
_x setskill ["spotDistance",0.1];   
_x setskill ["spotTime",0.1];   
_x setskill ["courage",1];   
_x setskill ["commanding",0.1];
}forEach units group this;

Share this post


Link to post
Share on other sites

Interesting script Günter, thanks for the link, by the sounds of it it didn't have the desired effect for the OP though so I guess it's a no-go. I had a look into forcing looped animation, but I can't afford to drop the pathfinding in the context I'm using.

Outlawz7 that's great, thanks for checking, and that's a much better code to use so thanks for that too!

Based on this I'll mark the thread solved as going on the number of views, there are a lot of people looking for this.

Its not a perfect solution but its a big improvement, hopefully BIS will have time to officially implement this soon.

Thanks all for your help, happy Arma-ing!

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  

×