Jump to content
gossamersolid

AI Ignoring orders after forced out of vehicle

Recommended Posts

A little bit of background - I'm fairly knowledgeable in SQF, but this is my first foray into working heavily with AI. My usual AI usage was either infantry remaining as infantry or vehicles with crew that stayed inside - never got in/out.

I'm working on a mission where groups of AI are meant to be autonomous. They should be able to issue orders themselves and when necessary - drive to their object when they're too far.

 

So here's where the problem comes in. I had a hell of a time getting the AI squads to disembark their vehicle and have them not get back in. I found the winning combination so far is something along these lines:

{
    _x action["engineOff", _groupVehicle];
    _x leaveVehicle _groupVehicle;
    _x action ["eject", _groupVehicle];
} forEach (units _group);

It appears to work great until after they've fulfilled their objective, chose another and must drive to it. After getting out at their next objective, it seems one, some or all of the group will seemingly walk backwards on an angle while repeating "negative" as the squad leader repeats their orders (every few seconds). I literally can't get them to stop until they die (when they respawn they don't have the issue until their second time mounting/dismounting).

 

I spent all day trying to figure out what the cause was and I've got it pinpointed down to something relating to them getting in/out of the vehicle. I've temporarily removed the logic to create a vehicle, move them into it (using moveInAny) and then dismount them from it using the snippet above. With this code removed, there is no longer an issue.

 

So I must be clearly missing something here. Either they are somehow not understanding that they are unassigned to their vehicle (the vehicle also gets deleted via deleteVehicle after they're all out of it) or it has something to do with the fact that their waypoint is holding some information related to the vehicle.

 

Again, I'm not very experienced with AI manipulation, waypoints and all that jazz.

 

Any help would be much appreciated. I can also provide the full source if somebody really wants to see it happen (it takes about 10 - 15 minutes in for it to happen, usually).

Share this post


Link to post
Share on other sites

With the help from a member on r/armadev, I've managed to resolve this issue.

The solution is to never use moveInAny (or any of the moveIn commands) if you ever want your autonomous AI (not player led group) to act normally after getting in/out of vehicles. Assign group members to positions with the vehicle and issue an OrderGetIn command.

Share this post


Link to post
Share on other sites

Not really seeing an issue, I moved units in using moveinany they drive off and stop.

I ran your eject script and then tried to get them to get in another vehicle they did so without an issue.

 

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, f2k sel said:

Not really seeing an issue, I moved units in using moveinany they drive off and stop.

I ran your eject script and then tried to get them to get in another vehicle they did so without an issue.

 

 

 

Weird.

Well, regardless, it has now been solved as per my 2nd post.

Share this post


Link to post
Share on other sites
46 minutes ago, dyrmoon said:

I do not know if it will help you, but you can use more commands for work with vehicles and AI. For example:

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

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

:satisfied:

 

Thanks for the pointer on allowGetIn, but the issue has been resolved :)

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

×