IADScript Documentation

From DCS World Wiki - Hoggitworld.com

Integrated Air Defense Script (IADScript) or (IADS) is a script using the DCS Simulator Scripting Engine and MIST to manipulate ground air defense groups to behave like an Integrated Air Defense System. This manipulation helps make air defenses less predictable and more intelligent than default behavior.

Current release versions: v1 rev35

Setup

MIST 2.0 or greater needs to be initialized

Do Script(Copy/paste of iads file) or Do Script File(iads_v1_r35)

Do Script(iads.add() and iads.addByPrefix())


Settings

This script relies on numerous settings to define default values for how the air defense network is organized and for enabling debugging messages. The table is defined at the top of the iadScript lua file.

level

Integer (Non decimal): 1, 2, 3, 4, 5

1: (oo) -- Sams are all forced to search. Will lock and engage if target is within range.

2: (o|0) -- Pure randomization. All sams will be given random orders to turn off, search, or actively lock and engage targets. Radars are approx 50% off, 50% on/locking

3: (O_^) -- More intelligent randomization. Larger sams will generally search while smaller sams will generally be shut down. Sams can use more advanced tactics.

4: [*]_[*] -- Sams will more likely be on or off depending on the radar search area of nearby sams. Sams will use more advanced tactics and exert some control over nearby sams.

5: (╯°□°)╯︵ ┻━┻) -- Not implemented and to be determined. Even more advanced tactics and logic can be employed.

linked

String 'coalition' or 'country'

Selects the default relationship for a sam if the relationship information is not present when the sam is added.

radarSim

Boolean true or false

If true each sam will be checked based on the sams radar dish scan speed

refreshRate

Any positive number If radarSim is false all sams will be checked at this constant refresh rate.


addDuplicate

String 'replace' (only option currently)

debug

boolean true or false

If true status messages will be displayed on screen and allows for debug files to be written

debugMsgFor

Follows mist.message.add rules for message for. Limited to coalition {'all'}, {'blue'}, or {'red'}

debugWriteFiles

Boolean true/false

Utilizes mist.debug.writeData and desantiized io and lfs to write lua files to your savedgames/DCS/logs folder.

timeDelay

Specifies the start time of the script after mission start. (Allows for script to populate a few tables before giving orders)


addDuplicate

String 'replace' or 'ignore'

Dictates what will happen if a sam is added twice to the script.

samTypesDB

This is a DB of all land based sams currently in the sim. DB contains custom data for specific use by the IADS script and generic radar data which is used by the mission editor to display range data. Modification of the values will impact performance and sorting of sams by type. Future iterations may grab data from the sim if applicable.

Tips and Tricks

One sam type per group.

 The script is not setup to handle multiple sam types per group yet. An S-300 mixed with a SA-15 may result in the S-300 acting like it had the range of a SA-15.

IR and AAA do NOT need to be added

 IR and AAA units are supported by the script but generally do not need to be added to the IADS. Doing so can bog down the IADScript or delay expected engagement behavior from the air defenses. 

Do not use with "normal" ground forces

 The script functions through altering AI ROE and Alarm State to engage air threats. This modification will likely screw up expected AI ground force behavior. Additionally the script has the capability to move a group to a random location.

Ships not supported

 I did not want to remove ships capability to fire at point or monitor ROE for self defense against missiles and engaging other ships.

Modification Guide

This script was built with end user modification of files in mind. As a result most of the "AI" behavior functions are defined outside of the iads member functions. This allows for users to write their own logic to define sam behavior.

Global table iads_AI contains 3 functions: iads_AI.main, iads_AI.monitorV1, iads_AI.monitorNet

iads_AI.main. Main function, iterated at a high rate. Periodically runs iads_AI.monitorNet. If debug messages are allowed, this function will periodically update the messages and files.

 Runs two co-routines:
   checkSams -- 
      monitors when each sam needs to perform a radar check, populates parent and child tables
      runs iads_AI.monitorV1 for each sam as needed
   update_targets_units -- populates iad_targets table with all airborne planes and helicopters currently in mission

iads_AI.monitorV1. Reason why it is called "AI"

 Gets sam status and populates table of tracked enemy aircraft. 
 If a potential target exists it analyzes the situation and personal settings to randomly choose a course of action. 
 If no targets are within range to warrant a new action the script, depending on settings, will randomly select an idle action. 
 Runs  taskMonitor which is capable of selecting random actions.


iads_AI.monitorNet.

 Iterates through each sam network
 Removes tracks if the target isn't detected for 15 seconds
 More advanced logic planned for future improvements

IADS Class

This script creates an object class called iads with numerous member functions. These functions can be used to create your own air defense script logic using the data structure of the IADScript as a basis.

Table Format

Member Functions

Below is a list of iads member functions. Many of these require an Iads object as an input variable and will return data or do a specific action on that sam.

Creation/Removal
add, addAllByPrefix, destroy, create
Tasks
setTask, popTask, addTimeToCurrentTask, matchTasks, getTasks
Relationships
childMatch, findChild, findParent
General Data
getIndex, getByIndex, getByName
Actions
goDark, search, shoot, setRadar, engage, blink, displace, displaceNearPoint, getTracks, getNetworkTracks, findNearestTrack, findNearestTarget findNearestLink, findNearestLinkToTrack, getStatus, getMissiles, getMissileRange, getSearchRange, getRangeToTarget, checkToEngage, taskMonitor, updateStats