Jump to content
Sign in to follow this  
jwllorens

Trouble forcing AI to change targets

Recommended Posts

I recently tried my hand at scripting for the first time and decided to do something that seemed simple and easy enough but could be expanded and improved upon as I learned my way around the scripting environment in ArmA.

I was unhappy with how the laser designators interacted with friendly AI units, for example, how a friendly BTR-K would immediately fire both missiles the moment you turned on a laser designator and how friendly attack helicopters would not use their cannons and would continuously fire missiles or CAS jets would fly in to about 20 yards from the target and then elevate sharply before dropping an LGB.

I thought it might be nice to play with the AI a bit and see what I could get them to do when I turned on the designator, so that in the future I could set up some additional user functionality where the player could request a diverse array of ordnance on the designated target rather than just turning on the laser and hoping that nearby AI would notice it.

So here is the problem. I wrote a quick script to test out how the AI responds to various ArmA scripting commands. The script simply checked every second whether the player had created a LaserTarget vehicle, and then if the player had, it then commanded a friendly AMV-7 Marshall to target the LaserTarget. I used the AimedAt command to determine when the marshall was aimed at the LaserTarget, and then forced the Marshall to fire its cannon.

The idea here is that the player could command the Marshall by using the laser designator to suppress enemy positions or engage buildings or something.

Everything seemed to work reasonably well, except for one problem. If there were any enemies present, say, a few enemy riflemen, then the Marshall would see them and engage them. If I then turned on the laser designator, the Marshall would apparently ignore the scripting commands to target the LaserTarget and would just continue firing at the riflemen. I tried disabling aspects of the Marshall's AI while the LaserTarget was active, I tried giving the command to the individual units inside the Marshall, and I tried all of the various commands to get a unit to look at, shoot at, or target an object and nothing. The Marshall would never aim at the LaserTarget if it was already engaging any enemy unit (though it was apparently "targetting" it when I used hints to see what the current target was after commanding it to target the LaserTarget, it just would not aim at it, period.) No matter what I tried, the Marshall would NOT stop aiming at the enemy infantry and aim at the LaserTarget.

How can you get a unit to aim at a specific object when it is already in combat?

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  

×