Jump to content
Sign in to follow this  
zonkovic

Making AI disengage from combat

Recommended Posts

Hello all,

I've been playing around with the editor since ArmA, but never made anything complex, and I am trying to make missions with more interesting interactions.

The mission I am making is basically "Players (BLUFOR) defend the village". The problem is that the AI will keep fighting until they all die, or individually run away. I don't know of any real military that orders soldiers to fight to the death in each and every mission! It's not very tactical to continue when you are beaten.

I want to script the AI to give up the fight if they take heavy casualties. I don't mean individual soldiers retreating because their squad dies, but a trigger that says "okay, OPFOR have taken 75% casualties trying to take this one stupid village, time to go home". Ideally they would withdraw tactically i.e. bounding + deploying smoke, but I'll settle for just making them run off too.

To test it I've been using four AI in a squad set to "search and destroy" my position. This is synchronized to a "switch" trigger, which goes off if they have less than 3 men alive. The next waypoint tells them to move "full speed" "careless" to a distant point. But once they are in combat, they just don't disengage. The last man will keep firing at me surrounded by his dead comrades.

The only solution I have found online is to use "disableAI" but I'd rather if I could find a more intelligent solution!

Any suggestions?

  • Like 1

Share this post


Link to post
Share on other sites

That is definitely helpful, but from what I have read, it has some drawbacks. If I understand correctly, units who flee will regroup at their starting position and then resume their previous waypoints. In any case it gives me something to play around with - thanks very much.

I might see if it works to use fleeing = true on a trigger to change waypoints. That way if the unit flees, when they rally they'll go to a designated fall-back point instead of back into the fray.

EDIT - I was overthinking it! I just set it so that if the group takes xx% losses, it triggers the "switch" and then if they flee, they rally back to the next waypoint rather than the same one! I tested it, and it works just how I wanted. Thanks again.

Edited by zonkovic

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×