Author: Blakeace
Author Website:

Requirements: No addons required

Version: 1.00

Short description: Creates a base for adding AI artillery

Date: 2009-11-22 09:26

Comments: (0)


4-aiarty1.jpg 4-aiarty2.jpg

AI Artillery Framework
[ZSU]Blake aka Blakeace

One thing I like to achieve when designing missions is a sence of realism, and rather than focus on fog and mirrors, for some reason rather try a get something even of only a little realistic.

So I wanted to be able to use artillery by the ai against the player. Or against themselves, or using ai artillery to support a player. Ideally I wanted a forward observer or the like, so that it is possible to destroy the eyes of the artillery. I wanted real guns and the like firing so that the source was also an option to destroy to stop the artillery. Artillery takes a long time to transit from firing point to impact, so I wanted that as well. One problem with that is that targets can move a long way in a minute, which in arma is a medium flight time generally. As such their needs to be some sort of predictive to calculate where the target is going to be when the rounds arrive. Then because we are predicting movement we need to check to make sure that the impact point isn't where friendly troops are.

Now I don't claim to be a guru at scripting, and this grew out of a small script to create some ai arty. After I wrote the first routine, I realised their a many different ways inwhich you might want to employ the script. Attached to a soldier, and firing on only targets he can see. Use a trigger to cover a zone you wish to restrict the strike to. So I thought about trying to make it a little modular. Keep the core aspects in one script, and leave the ability to build complexity around it without reinventing the core processes every time.

As such I use the existing artillery module, so that it is as close to drop and play as possible.

Eg created a battery of any type, synch the artillery module to it. create an forward observer character, drop the scripts in the mission folder. Pick the right script and add it the the init line of the forword observer. Or take the core aspect and build your own custom implementation, it might even just be dropping in a trigger and calling the core script from it once you set the parameters that are passed to the script bang instant arty!

So I have created the core script aifiremission.sqf, and included three other scripts which call the core script.

    Creates a fire mission using the passed parameters to define the resulting mission. It has a basic predictive calculation, a limiting value to stop fast vehicles creating impacts miles away. It has a simple check for friendly units withing 50m of the impact point. Though depending on the despersion values that isn't always safe. It also doesn't protect friendly units that may move into the area after the shots have been fired.
    Uses a trigger centred on a marker to define a zone for artillery, uses detected by for finding targets, meaning any friendly units feed information for prosecuting targets. This is placed in the init area of a unit and this unit becomes a psuedo FO, he doesn't find the targets but if killed the artillery stops. I have place so very non effective code to try and make him seem more like an FO by using his binoculars every now and then.
    Similar to above but is designed to lay smoke rounds ahead of friendly troops in the defined trigger area. Uses friendly units present.
    Ths is designed to be the most realistic where it uses the unit the script is run from, to detect and prosecute targets.
Sample Mission:
I included a sample mission. Drop the folder in your arma 2 mission folder, the one you use for editing missions and take a look.

Now this hasn't had a lot of testing and there are to may options to fully do that. I see it more as a proof of concept, to see what the feedback is like and whether further progress is required or desired. I have run it on a dedicated server and it seemed fine. Two ways use can use this, utilise the included scripts, or build on the core elements to custom for your missions.

Credits & Thanks:
Tophe of Östgöta Ops [OOPS] Simple Vehicle Respawn Script v1.7, where I got the idea of default values.
SPhoenix who's reporting_enemies script showed me how to read nested arrays
Norrin who's awesome scripts have taught me so must.
To all thank have posted in the forums that I sift through constantly.
To the ZSU rabble who are the reason I bash my head against the wall doing this.

Enable javascript to be able to download from Armaholic please!

Tags: No tags