DCS task engageTargets

From DCS World Wiki - Hoggitworld.com

Task: engageTargets Added with: 1.2.4
Hierarchy: Scripting Root > Tasks > enroute task > engageTargets
Tasking Type: enroute task
For: Airplanes, Helicopters
Available Under: CAP, CAS, SEAD, Anti-ship, Fighter Sweep, AFAC
Description: Assigns the controlled group to engage targets that have a specific attribute. Group will only engage detected targets.

When placing a flight with the role of CAP, CAS, SEAD, Anti-ship, or Fighter Sweep in the mission editor an enroute task of the same name will automatically be generated for said group on their first waypoint. Theses tasks are available as an option in the enroute listing. Within the mission file itself these tasks are actually a engageTargets tasking with pre-defined target attributes.

Within the mission editor the task role selection filters the list of valid attributeNames to be relevant to this task. In reality that doesn't matter and you can assign whatever attribute you want for an aircraft to attack.

Format: This task needs to be in the following format.
EngageTargets ={ 
  id = 'EngageTargets', 
  params = { 
    maxDist = Distance, 
    maxDistEnabled = boolean, -- required to check maxDist
    targetTypes = array of AttributeName, 
    priority = number 

Required parameters:

targetTypes: array of attribute names that define valid targets.

Optional Parameters:

maxDist: Defines the maximum distant in meters the group will deviate from their route to engage a target.

maxDistEnabled : boolean, required to be true if maxDist value is to be used.

priority: The priority of the tasking, the lower the number the more important the objective is. Helps define the order in which AI will execute tasking. By default the value is 0.

Enumerators: N/A
Examples: The following task will allow an AI aircraft to attack radar sites and enemy fighters.
   local gpCon = Group.getByName("M-M-M-M-MultiRole"):getController()
   local seadAndFighters = {
       id = "EngageTargets", 
       params = {
           targetTypes = {"Fighters", "SAM SR", "SAM TR"},
           priority = 1, 
Notes: See article Mission Editor: AI Tasking for more information on how AI tasking is handled within DCS.
Task List: Task Wrappers: mission, ComboTask, ControlledTask, WrappedAction

Tasks: AttackGroup, AttackUnit, Bombing, Strafing, CarpetBombing, AttackMapObject, BombingRunway, orbit, refueling, land, follow, followBigFormation, escort, Embarking, fireAtPoint, hold, FAC_AttackGroup, EmbarkToTransport, DisembarkFromTransport, CargoTransportation, goToWaypoint, groundEscort, RecoveryTanker

En-route Tasks: engageTargets, engageTargetsInZone, engageGroup, engageUnit, awacs, tanker, ewr, FAC_engageGroup, FAC

Commands: script, setCallsign, setFrequency, setFrequencyForUnit, switchWaypoint, stopRoute, switchAction, setInvisible, setImmortal, setUnlimitedFuel, activateBeacon, deactivateBeacon, activateICLS, deactivateICLS, eplrs, start, transmitMessage, stopTransmission, smoke_on_off, ActivateLink4, deactivateLink4, activateACLS, deactivateACLS, LoadingShip

Options: ROE, Reaction To Threat, Radar Using, Flare Using, Formation, RTB On Bingo, silence, Disperse on Attack, Alarm State, RTB on Out of Ammo, ECM Using, Prohibit AA, Prohibit Jettison, Prohibit Afterburner, Prohibit AG, Missile Attack Range, Prohibit WP Pass Report, Engage Air Weapons, Option Radio Usage Contact, Option Radio Usage Engage, Option Radio Usage Kill, AC Engagement Range Restriction, jett tanks if empty, forced attack, Altitude Restriction for AAA Min, restrict targets, Altitude Restriction for AAA Max, Prefer Vertical