Part 2

From Hoggit: DCS World Multiplayer
Jump to: navigation, search

Classes

Classes represent the types of object those may have multiple instances.

Object

Represents an object with body, unique name, category and type. Non-final class.

Types

Object.Category enum that stores object categories.

 Object.Category = {
   UNIT,
   WEAPON,
   STATIC,
   SCENERY,
   BASE
 }

Structures

 Object.Desc = extends Desc {
   life = number, --initial life level
   box = Box3 --bounding box of collision geometry
 }

object descriptor. Each object belongs to a type and each such type has its own descriptor. Descriptor format depends on object category, but always extends Object.Desc.

Member functions

 boolean function Object.isExist(Object self)

return if the object exist.

 function Object.destroy(Object self)

destroys the object without making damage to it and generation any event. The object just disappear. For now it is impossible to destroy remote objects.

 enum Object.Category Object.getCategory(Object self)

returns category of the object.

 TypeName Object.getTypeName(Object self)

returns type name of the object.

 Object.Desc Object.getDesc(Object self)

returns object descriptor.

 boolean function Object.hasAttribute(Unit self, AttributeName attributeName) 
 

attributeName

  • Attribute name to check.

returns true if the object belongs to the category.

 string Object.getName(Object self)

returns name of the object. This is the name that is assigned to the object in the Mission Editor.

 Vec3 function Object.getPoint(Object self) 

returns object coordinates for current time.

 Position3 function Object.getPosition(Object self) 

returns object position for current time.

 Vec3 function Object.getVelocity(Object self) 

returns the unit's velocity vector.

 boolean function Object.inAir(Object self) 

returns true if the unit is in air.

CoalitionObject

Represents all Objects those may belong to a coalition: units, airbases, static objects, weapon. Extends Object. Non-final class.

Member functions

 enum coalition.side CoalitionObject.getCoalition(CoalitionObject self)

returns coalition of the object.

 enum country.id CoalitionObject.getCountry(CoalitionObject self)

returns object country.

Weapon

Represents a weapon unit: shell, rocket, missile and bomb. Extends CoalitionObject. Final class.

Types

Weapon.flag enum stores weapon flags. Some of them are combination of another flags.

 Weapon.flag = {
   LGB, 
   TvGB, 
   SNSGB, 
   
   HEBomb, 
   Penetrator, 
   NapalmBomb, 
   FAEBomb, 
   ClusterBomb, 
   Dispencer, 
   CandleBomb, 
   ParachuteBomb, 
   
   GuidedBomb = LGB + TvGB + SNSGB, 
   AnyUnguidedBomb = HEBomb + Penetrator + NapalmBomb + FAEBomb + ClusterBomb + Dispencer + CandleBomb + ParachuteBomb, 
   AnyBomb = GuidedBomb + AnyUnguidedBomb, 
   
   LightRocket, 
   MarkerRocket, 
   CandleRocket, 
   HeavyRocket, 
   
   AnyRocket = LightRocket + HeavyRocket + MarkerRocket + CandleRocket, 
   
   AntiRadarMissile, 
   AntiShipMissile, 
   AntiTankMissile, 
   FireAndForgetASM, 
   LaserASM, 
   TeleASM, 
   CruiseMissile, 
   
   GuidedASM = LaserASM + TeleASM, 
   TacticASM = GuidedASM + FireAndForgetASM, 
   AnyASM = AntiRadarMissile + AntiShipMissile + AntiTankMissile + FireAndForgetASM + GuidedASM + CruiseMissile, 
   
   SRAAM, 
   MRAAM, 
   LRAAM, 
   
   IR_AAM, 
   SAR_AAM, 
   AR_AAM, 
   
   AnyAAM = IR_AAM + SAR_AAM + AR_AAM + SRAAM + MRAAM + LRAAM, 
   
   AnyMissile = AnyASM + AnyAAM,   
   AnyAutonomousMissile = IR_AAM + AntiRadarMissile + AntiShipMissile + FireAndForgetASM + CruiseMissile,
   
   GUN_POD, 
   BuiltInCannon, 
   
   Cannons = GUN_POD + BuiltInCannon, 
   
   AnyAGWeapon = BuiltInCannon + GUN_POD + AnyBomb + AnyRocket + AnyASM, 
   AnyAAWeapon = BuiltInCannon + GUN_POD + AnyAAM, 
   
   UnguidedWeapon = Cannons + BuiltInCannon + GUN_POD + AnyUnguidedBomb + AnyRocket, 
   GuidedWeapon = GuidedBomb + AnyASM + AnyAAM, 
   
   AnyWeapon = AnyBomb + AnyRocket + AnyMissile + Cannons, 
   
   MarkerWeapon = MarkerRocket + CandleRocket + CandleBomb, 
   ArmWeapon = AnyWeapon - MarkerWeapon
 }

Weapon.Category enum that stores weapon categories.

 Weapon.Category = {
   SHELL,
   MISSILE,
   ROCKET,
   BOMB
 }

Weapon.GuidanceType enum that stores guidance methods. Available only for guided weapon (Weapon.Category.MISSILE and some Weapon.Category.BOMB).

 Weapon.GuidanceType = {
   INS,
   IR,
   RADAR_ACTIVE,
   RADAR_SEMI_ACTIVE,
   RADAR_PASSIVE,
   TV,
   LASER,
   TELE
 }

Weapon.MissileCategory enum that stores missile category. Available only for missiles (Weapon.Category.MISSILE).

 Weapon.MissileCategory = {
   AAM,
   SAM,
   BM,
   ANTI_SHIP,
   CRUISE,
   OTHER
 }

Weapon.WarheadType enum that stores warhead types.

 Weapon.WarheadType = {
   AP,
   HE,
   SHAPED_EXPLOSIVE
 }

Structures

 Weapon.Desc = extends Object.Desc {
   category = enum Weapon.Category,
   warhead = {
     type = enum Weapon.WarheadType,
     mass = Mass,
     caliber = Distance,
     explosiveMass = Mass or nil, --for HE and AP(+HE) warheads only
     shapedExplosiveMass = Mass or nil, --for shaped explosive warheads only
     shapedExplosiveArmorThickness = Distance or nil ----for shaped explosive warheads only
   }
 }

weapon descriptor. This is common part of descriptor for any weapon. Some fields are actual only for HE and AP+HE warheads, some fields are actual only for shaped explosive warheads. Descriptor format depended on weapon category.

 Weapon.DescMissile = extends Weapon.Desc {    
   guidance = enum Weapon.GuidanceType,
   rangeMin = Distance,
   rangeMaxAltMin = Distance,
   rangeMaxAltMax = Distance,
   altMin = Distance,
   altMax = Distance,
   Nmax = number,
   fuseDist = Distance
 }

missile descriptor.

 Weapon.DescRocket = extends Weapon.Desc {
   distMin = Distance,
   distMax = Distance
 }

rocket descriptor.

 Weapon.DescBomb = extends Weapon.Desc {    
   guidance = enum Weapon.GuidanceType,
   altMin = Distance,
   altMax = Distance,
 }

bomb descriptor.

Member functions

 Unit Weapon.getLauncher(Weapon self)

returns the unit that launched the weapon

 Object Weapon.getTarget(Weapon self)

returns target of the guided weapon. Unguided weapons and guided weapon that is targeted at the point on the ground will return nil.

 Weapon.Desc Weapon.getDesc(Weapon self)

returns weapon descriptor. Descriptor type depends on weapon category.

Unit

Represents units: airplanes, helicopters, vehicles, ships and armed ground structures. Extends CoalitionObject. Final class. Units exist in groups.

Types

 Unit.ID

Identifier of an unit. It assigned to an unit by the Mission Editor automatically.

 Unit.Category

enum that stores unit categories

 Unit.Category = {
   AIRPLANE,
   HELICOPTER,
   GROUND_UNIT,
   SHIP,
   STRUCTURE
 }
 Unit.RefuelingSystem

enum that stores aircraft refueling system types.

 Unit.RefuelingSystem = {
   BOOM_AND_RECEPTACLE,
   PROBE_AND_DROGUE
 }
 Unit.SensorType

enum that stores sensor types.

 Unit.SensorType = {
   OPTIC,
   RADAR,
   IRST,
   RWR
 }
 Unit.OpticType

enum that stores types of optic sensors.

 Unit.OpticType = {
   TV, --TV-sensor
   LLTV, --Low-level TV-sensor
   IR --Infra-Red optic sensor
 }
 Unit.RadarType

enum that stores radar types.

 Unit.RadarType = {
   AS, --air search radar
   SS --surface/land search radar
 }

Structures

 Unit.Desc extends Object.Desc = {
   category = enum Unit.Category,
   massEmpty = Mass, --mass of empty unit
   speedMax = Distance / Time, --maximal velocity
 }

an unit descriptor. This is common part of unit descriptor. Its format depends on unit category.

 Unit.DescAircraft extends Unit.Desc = {
   fuelMassMax = Mass, --maximal inner fuel mass
   range = Distance, --operational range
   Hmax = Distance, --ceiling
   VyMax = Distance / Time, --maximal climb rate
   NyMin = number, --minimal safe acceleration
   NyMax = number, --maximal safe acceleration
   tankerType = enum Unit.RefuelingSystem, --refueling system type
 }

an aircraft descriptor.

 Unit.DescAirplane extends Unit.DescAircraft = {
   speedMax0 = Distance / Time, --maximal TAS at ground level
   speedMax10K = Distance / Time --maximal TAS at altitude of 10 km
 }

an airplane descriptor.

 Unit.DescHelicopter extends Unit.DescAircraft = {
   HmaxStat = Distance, --static ceiling
 }

a helicopter descriptor.

 Unit.DescVehicle extends Unit.Desc = {
   maxSlopeAngle = Angle, --maximal slope angle
   riverCrossing = boolean, --can the vehicle cross a rivers
 }

a vehicle descriptor.

 Unit.DescShip extends Unit.Desc = {
 }

a ship descriptor.

 Unit.AmmoItem = {
   desc = Weapon.Desc, --ammunition descriptor
   count = number --ammunition count
 }

ammunition item: "type-count" pair.

 Unit.Ammo = array of Unit.AmmoItem

an unit ammunition.

 Unit.Sensor = {
   typeName = TypeName,
   type = enum Unit.SensorType
 }

an unit sensor.

 Unit.Optic extends Unit.Sensor = {
   opticType = enum Unit.OpticType
 }

an optic sensor.

 Unit.Radar extends Unit.Sensor = {
   detectionDistanceRBM = Distance or nil, --detection distance for RCS=1m^2 in real-beam mapping mode, nil if radar doesn't support surface/land search
   detectionDistanceHRM = Distance or nil, --detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM
   detectionDistanceAir = { --detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search
     upperHemisphere = {
       headOn = Distance,
       tailOn = Distance
     },
     lowerHemisphere = {
       headOn = Distance,
       tailOn = Distance
     }
   }
 }

a radar.

 Unit.IRST extends Unit.Sensor = {
   detectionDistanceIdle = Distance, -- detection of tail-on target with heat signature = 1 in upper hemisphere, engines are in idle
   detectionDistanceMaximal = Distance, -- ..., engines are in maximal mode
   detectionDistanceAfterburner = Distance, -- ..., engines are in afterburner mode
 }

an IRST.

 Unit.RWR extends Unit.Sensor = {
 }

an RWR.

 Sensors = {
   [Unit.SensorType.OPTIC] = array of Unit.OpticSensor or nil,
   [Unit.SensorType.RADAR] = array of Unit.Radar or nil,
   [Unit.SensorType.IRST] = array of Unit.IRST or nil,
   [Unit.SensorType.RWR] = array of Unit.RWR or nil,
 }

table that stores all unit sensors.

Static functions

 Unit function Unit.getByName(string name) 

returns unit object by the name assigned to the unit in Mission Editor. If there is unit with such name or the unit is destroyed the function will return nil. The function provides access to non-activated units too.

Member functions

 boolean function Unit.isActive(Unit self) 

returns if the unit is activated.

 string function Unit.getPlayerName(Unit self)

returns name of the player that control the unit or nil if the unit is controlled by A.I.

 Unit.ID function Unit.getID(Unit self)

returns the unit's unique identifier.

 number function Unit.getNumber(Unit self) 

returns the unit's number in the group. The number is the same number the unit has in ME. It may not be changed during the mission. If any unit in the group is destroyed, the numbers of another units will not be changed.

 Controller function Unit.getController(Unit self) 

returns controller of the unit if it exist and nil otherwise

 Group function Unit.getGroup(Unit self) 

returns the unit's group if it exist and nil otherwise

 string function Unit.getCallsign(Unit self) 

returns the unit's callsign - the localized string.

 number function Unit.getLife(Unit self) 

returns the unit's health. Dead units has health <= 1.0

 number function Unit.getLife0(Unit self) 

returns the unit's initial health.

 number function Unit.getFuel(Unit self) 

returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks. If there are additional fuel tanks the value may be greater than 1.0.

 Unit.Ammo function Unit.getAmmo(Unit self)

returns the unit ammunition.

 Unit.Sensors function Unit.getSensors(Unit self)

returns the unit sensors.

 boolean function Unit.hasSensors(Unit self, enum Unit.SensorType sensorType = nil, ...)

returns true if the unit has specified types of sensors. This function is more preferable than Unit.getSensors() if you don't want to get information about all the unit's sensors, and just want to check if the unit has specified types of sensors.

  • sensorType

Sensor type.

  • ...

Additional parameters.

If sensorType is Unit.SensorType.OPTIC, additional parameters are optic sensor types. Following example checks if the unit has LLTV or IR optics:

 unit:hasSensors(Unit.SensorType.OPTIC, Unit.OpticType.LLTV, Unit.OpticType.IR)

If sensorType is Unit.SensorType.RADAR, additional parameters are radar types. Following example checks if the unit has air search radars:

 unit:hasSensors(Unit.SensorType.RADAR, Unit.RadarType.AS)

If no additional parameters are specified the function returns true if the unit has at least one sensor of specified type.

If sensor type is not specified the function returns true if the unit has at least one sensor of any type.

 boolean, Object function Unit.getRadar(Unit self)

returns two values:

  • first value indicates if at least one of the unit's radar(s) is on
  • second value is the object of the radar's interest. Not nil only if at least one radar of the unit is tracking a target.
 Unit.Desc function Unit.getDesc(Unit self)

returns unit descriptor. Descriptor type depends on unit category.

Airbase

Represents airbases: airdromes, helipads and ships with flying decks or landing pads.

Extends CoalitionObject.

Final class.

Types

 Airbase.ID

Identifier of an airbase. It assigned to an airbase by the Mission Editor automatically.

This identifier is used in AI tasks to refer an airbase that exists (spawned and not dead) or not.

 Airbase.Category = {
   AIRDROME,
   HELIPAD,
   SHIP
 }

enum contains identifiers of airbase categories.

Structures

 Airbase.Desc = extends Desc {
   category = Airbase.Category
 }

airbase descriptor. Airdromes are unique and their types are unique, but helipads and ships are not always unique and may have the same type.

category

  • Category of the airbase type.

Static function

 Airbase Airbase.getByName(string name)

returns airbase by its name. If no airbase found the function will return nil.

 Airbase.Desc Airbase.getDescByName(TypeName typeName)

returns airbase descriptor by type name. If no descriptor is found the function will return nil.

typeName

  • Airbase type name.

Member functions

 Unit Airbase.getUnit(Airbase self)

returns Unit that is corresponded to the airbase. Works only for ships.

 Airbase.ID Airbase.getID(Airbase self)

returns identifier of the airbase.

 string function Airbase.getCallsign(Airbase self) 

returns the airbase's callsign - the localized string.

 Airbase.Desc getDesc(Airbase self)

returns descriptor of the airbase.

StaticObject

Represents static object added in the Mission Editor. Extends CoalitionObject. Final class.

Types

 StaticObject.ID

Identifier of a static object. It is assigned to a static object by the Mission Editor automatically.

Structures

 StaticObject.Desc = Unit.Desc

Descriptor of StaticObject and Unit are equal. StaticObject is just a passive variant of Unit.

Static functions:

 StaticObject function StaticObject.getByName(string name)

returns static object by its name. If no static object found nil will be returned.

Member functions:

 StaticObject.ID function StaticObject.getID(StaticObject self)

returns identifier of the static object.

 StaticObject.Desc StaticObject.getDesc(StaticObject self)

return descriptor of the static object.

name

  • Name of static object to find.

SceneryObject

Extends Object. Final class. Has nothing that Object hasn't.

Structures

 SceneryObject.Desc = Unit.Desc

Descriptor of SceneryObject and Unit are equal. SceneryObject may have the same body StaticObject or Unit have.

Group

Represents group of Units.

Types

 Group.Category = {
   AIRPLANE,
   HELICOPTER,
   GROUND,
   SHIP
 }

enum contains identifiers of group types.

 Group.ID

Identifier of a group. It is assigned to a group by Mission Editor automatically.

Static functions

 Group function Group.getByName(string name) 

returns group by the name assigned to the group in Mission Editor.

Member functions

 boolean function Group.isExist(Group self)

returns true if the group exist or false otherwise.

 function Group.destroy(Group self)

destroys the group and all of its units.

 enum Group.Category function Group.getCategory(Group self)

returns category of the group.

 enum coalition.side function Group.getCoalition(Group self)

returns coalition of the group.

 string function Group.getName(Group self)

returns the group's name. This is the same name assigned to the group in Mission Editor.

 Group.ID function Group.getID(Group self)

returns the group identifier.

 Unit function Group.getUnit(number unitNumber)

returns the unit with number unitNumber. If the unit is not exists the function will return nil.

 number function Group.getSize(Group self)

returns current size of the group. If some of the units will be destroyed, As units are destroyed the size of the group will be changed.

 number function Group.getInitialSize(Group self)

returns initial size of the group. If some of the units will be destroyed, initial size of the group will not be changed. Initial size limits the unitNumber parameter for Group.getUnit() function.

 array of Unit function Group.getUnits(Group self)

returns array of the units present in the group now. Destroyed units will not be enlisted at all.

 Controller function Group.getController(Group self)

returns controller of the group.

Controller

Controller is an object that performs A.I.-routines. Other words controller is an instance of A.I.. Controller stores current main task, active enroute tasks and behavior options. Controller performs commands.

Please, read DCS A-10C GUI Manual EN.pdf chapter "Task Planning for Unit Groups", page 91 to understand A.I. system of DCS:A-10C.


 function Controller.setOnOff(Controller self, boolean value) 

enables and disables the controller.

Note: Now it works only for ground / naval groups!

value

  • Enable / disable.


Tasks

 function Controller.setTask(Controller self, Task task) 

resets current task and then sets the task to the controller. Task is a table that contains task identifier and task parameters.

 function Controller.resetTask(Controller self) 

resets current task of the controller

Common task format is:

Task = {
  id = string, 
  params = { 
  } 
} 
  • id

String task identifier.

 function Controller.pushTask(Controller self, Task task) 

pushes the task to the front of the queue and makes the task active. Further call of function Controller.setTask() function will stop current task, clear the queue and set the new task active. If the task queue is empty the function will work like function Controller.setTask() function.

 function Controller.popTask(Controller self) 

pops current (front) task from the queue and makes active next task in the queue (if exists). If no more tasks in the queue the function works like function Controller.resetTask() function. Does nothing if the queue is empty.

 boolean function Controller.hasTask(Controller self) 

returns true if the controller has a task.

Main Tasks

Tasks for airborne units/groups

1. NoTask

An empty task. It finished just being started.

 NoTask = { 
   id = 'NoTask', 
   params = { 
   } 
 } 

2. AttackGroup

Attacking the target group (airborne, ground or naval).

 AttackGroup = { 
   id = 'AttackGroup', 
   params = { 
     groupId = Group.ID,
     weaponType = number,
     expend = enum AI.Task.WeaponExpend,
     attackQty = number,
     directionEnabled = boolean,
     direction = Azimuth,
     altitudeEnabled = boolean,
     altitude = Distance,
     attackQtyLimit = boolean,
   } 
 }

groupId

  • Inner unique identifier of the group to attack.

weaponType (optional)

  • Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.

Weapon flags are enlisted in Weapon.flag table.

  • expend (optional)

Determines how much weapon will be released at each attack. If parameter is not defined the unit / group will choose expend on its own discretion.

  • attackQty (optional)

This parameter limits maximal quantity of attack. The aicraft/group will not make more attack than allowed even if the target group not destroyed and the aicraft/group still have ammo. If not defined the aircraft/group will attack target until it will be destroyed or until the aircraft/group will run out of ammo.

  • attackQtyLimit (optional)

The flag determines how to interpret attackQty parameter. If the flag is true then attackQty is a limit on maximal attack quantity for "AttackGroup" and "AttackUnit" tasks. If the flag is false then attackQty is a desired attack quantity for "Bombing" and "BombingRunway" tasks.

Note: this looks like not a good solution. It would be better to have two number parameters: required parameter attackQty for "Bombing" and "BombingRunway" tasks and attackQtyLimit for "AttackGroup" and "AttackUnit" tasks.

  • directionEnabled

Indicates ingress direction is defined.

  • direction (optional)

Desired ingress direction from the target to the attacking aircraft. Group/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain group/aircraft will choose another direction.

  • altitudeEnabled

Indicates attack start altitude is defined.

  • direction (optional)

Desired attack start altitude. Group/aircraft will make its attacks from the altitude. If the altitude is too low or too high to use weapon aircraft/group will choose closest altitude to the desired attack start altitude. If the desired altitude is defined group/aircraft will not attack from safe altitude.

3. AttackUnit

Attacking the target (airborne, ground or naval).

AttackUnit = { 
  id = 'AttackUnit', 
  params = { 
    unitId = Unit.ID, 
    weaponType = number, 
    expend = enum AI.Task.WeaponExpend
    attackQty = number, 
    direction = Azimuth, 
    attackQtyLimit = boolean, 
    groupAttack = boolean, 
  } 
} 

The task has the same parameters of AttackGroup, but has unitId parameter instead of groupId and additional parameter groupAttack.

  • unitId

Inner unique identifier of the unit to attack.

  • groupAttack (optional)

Flag indicates that the target must be engaged by all aircrafts of the group. Has effect only if the task is assigned to a group, not to a single aircraft.

4. Bombing

Delivering weapon at the point on the ground.

Bombing = { 
  id = 'Bombing', 
  params = { 
    point = Vec2,
    weaponType = number, 
    expend = enum AI.Task.WeaponExpend,
    attackQty = number, 
    direction = Azimuth, 
    groupAttack = boolean, 
  } 
} 

The task has the same parameters of AttackUnit task, but has parameters point instead of unitId, plus attackQty and minus attackQtyLimit parameters.

point

  • 2D-coordinates of the point to deliver weapon at.

attackQty

  • Desired quantity of passes. The parameter is not the same in AttackGroup and AttackUnit tasks.

5. AttackMapObject

Attacking the map object (building, structure, e.t.c).

AttackMapObject = { 
  id = 'AttackMapObject', 
  params = { 
    point = Vec2,
    weaponType = number, 
    expend = enum AI.Task.WeaponExpend,
    attackQty = number, 
    direction = Azimuth, 
    groupAttack = boolean, 
  } 
} 

The task has the same parameters AttackUnit task has, but has parameters point instead of unitId.

point

  • 2D-coordinates of the point the map object is closest to. The distance between the point and the map object must not be greater than 2000 meters.

Object id is not used here because Mission Editor doesn't support map object identificators.

6. BombingRunway

Delivering weapon on the runway.

 BombingRunway = { 
   id = 'BombingRunway', 
   params = { 
     runwayId = AirdromeId, 
     weaponType = number, 
     expend = enum AI.Task.WeaponExpend,
     attackQty = number, 
     direction = Azimuth, 
     groupAttack = boolean, 
   } 
 }

The task has the same parameters Bombing task has, but has parameter runwayId instead of point.

runwayId

  • Numeric identifier of the airdrome.

attackQty

  • Desired quantity of attack of the point. The parameter is not the same in AttackGroup and AttackUnit tasks.

7. Orbit

Flying orbit.

Orbit = { 
  id = 'Orbit', 
  params = { 
    pattern = enum AI.Task.OribtPattern,
    point = Vec2,
    point2 = Vec2,
    speed = Distance,
    altitude = Distance
  } 
}

pattern

  • String identifier of orbit pattern. Pattern constants: "Circle", "Race-Track".

point (optional)

  • 2D-coordinates of the orbit point. If not defined position of the current waypoint will be used.

speed (optional)

  • Desired aircraft(s) speed. If not defined 1.5 * stall velocity will be used.

altitude (optional)

  • Desired orbit altitude. If not defined altitude of the current waypoint will be used.

point2 (optional)

  • Second point for Race-Rrack orbit pattern. If not defined the next waypoint position will be used.

Orbit Patterns.

  • Circle. Aircraft will stay in left turn. The center of circle-shaped trajectory is anchored to point.
  • Race-Track. The trajectory consists of two parallel legs and 180-degrees left turns on each side of the legs. Race-track trajectory is defined by a two 2D-points those form the right leg. The first point is point, the second point is point2.

speed and altitude are an optional parameters. If not defined aircraft will fly orbit at altitude of first waypoint and with speed equal 1.5 of stall airspeed.

8. Refueling

Refueling from the nearest tanker. No parameters.

 Refueling = { 
   id = 'Refueling', 
   params = {} 
 }

9. Land

Landing at the ground. For helicopters only.

 Land = {
   id= 'Land',
   params = {
     point = Vec2,
     durationFlag = boolean,
     duration = Time
   }
 }

point

  • The point to land at.

durationFlag

  • The flag specifies is time on land is limited or not.

duration

  • Time on land. Has effect only if durationFlag is true.

10. Follow

Following another airborne group. The unit / group will follow lead unit of another group, wingmens of both groups will continue following their leaders. If another group is on land the unit / group will orbit around.

 Follow = {
   id = 'Follow',
   params = {
     groupId = Group.ID,
     pos = Vec3,
     lastWptIndexFlag = boolean,
     lastWptIndex = number
   }    
 }

groupId

  • Itendificator of the group to follow to.

pos

  • Position of the unit / lead unit of the group relative lead unit of another group in frame reference oriented by course of lead unit of another group. If another group is on land the unit / group will orbit around.

lastWptIndexFlag

  • The flag indicates the unit / group will follow another group until another group reach specified waypoint.

lastWptIndex

  • Detach waypoint of another group. Once reached the unit / group Follow task is finished.

11. Escort

Escort another airborne group. The unit / group will follow lead unit of another group, wingmens of both groups will continue following their leaders. The unit / group will also protect that group from threats of specified types.

 Escort = {
   id = 'Escort',
   params = {
     groupId = Group.ID,
     pos = Vec3,
     lastWptIndexFlag = boolean,
     lastWptIndex = number,
     engagementDistMax = Distance,
     targetTypes = array of AttributeName
   }
 }

The parameters are the same Follow task has, but plus 2 additional:

engagementDistMax

  • Maximal distance from escorted group to threat. If the threat is already engaged by escort escort will disengage if the distance becomes greater than 1.5 * engagementDistMax.

targetTypes

  • Array of AttributeName that is contains threat categories allowed to engage.

12. Mission

Mission is a complex task. Performing the Mission means flying the route and performing tasks at each waypoint of the route.

 Mission = { 
   id = 'Mission', 
   params = { 
     route = { 
       points = { 
         [1] = { 
           type = enum AI.Task.WaypointType, 
           airdromeId = Airbase.ID, 
           helipadId = Airbase.ID, 
           action = enum AI.Task.TurnMethod, 
           x = Distance, 
           y = Distance, 
           alt = Distance, 
           alt_type = enum AI.Task.AltitudeType, 
           speed = Distance, 
           speed_locked = boolean, 
           ETA = Time, 
           ETA_locked = boolean, 
           name = string, 
           task = Task 
         }, 
         [2] = { 
           ... 
         }, 
         ... 
         [N]= { 
           ... 
         } 
       } 
     }, 
   } 
 } 

route

  • Table that stores route data such as waypoints, destination airdrome. To understand route structure please, read DCS A-10C GUI Manual EN.pdf chapter "Group Route Planning", page 94.
points
  • Waypoints of the route.
type
  • Waypoint type.
airdromeId
  • identifier of the airdrome to land. Has effect only if waypoint type is "Land".
helipadId
  • Inner unique identifier of helipad or ship to land. Has effect only if waypoint type is "Land".
action
  • Turn method.
x, y
  • 2D-coordinates of the waypoint.
alt
  • Altitude assigned to the waypoint. The aircraft(s) will climb/descent to reach the waypoint at asigned altitude.
alt_type
  • Type of altitude assigned to the waypoint.
speed
  • True airspeed assigned to the waypoint. Has effect only if speed_locked is true.
speed_locked
  • Flag that means the true airspeed is assigned to the waypoint and the aircraft(s) will keep it on its way to the waypoint.
ETA
  • Time-On-Target of the waypoint. Has effect only if ETA_locked is true.
ETA_locked
  • Flag that means that the Time-On-Target is assigned to the waypoint and the aircraft(s) will adjust its airspeed to reach the waypoint at assigned time.
name
  • Helper in Mission Editor. Has no effect in simulator.
task
  • Task that must be performed when aircraft/air group will passed over the waypoint.

Tasks for ground units

1. FireAtPoint

Firing at point until there is ammo.

 FireAtPoint = { 
   id = 'FireAtPoint', 
   params = { 
     point = Vec2,
     radius = Distance, 
   } 
 }

point

  • 2-D coordinates of the point to fire at.

radius (optional)

  • Radius of the zone to fire at. If the radius is defined the vehicle group will fire at random places within the radius and fire at point otherwise.

2. Hold

Not moving. No parameters.

 Hold = { 
   id = 'Hold', 
   params = { 
   } 
 }

3. Mission

Mission is a complex task. Performing the Mission means following the route and performing tasks at each waypoint of the route.

 Mission = { 
   id = 'Mission', 
   params = { 
     route = { 
       points = { 
         [1] = {
           action = enum AI.Task.VehicleFormation,
           x = Distance, 
           y = Distance, 
           speed = Distance,
           ETA = Time,
           ETA_locked = boolean,
           name = string, 
           task = Task 
         }, 
         [2] = { 
           ... 
         }, 
         ... 
         [N]= { 
           ... 
         } 
       } 
     }, 
   } 
 }

route

  • Table that stores route data such as waypoints, destination airdrome. To understand route structure please read DCS A-10C GUI Manual EN.pdf chapter "Group Route Planning", page 94.

points

  • Waypoints of the route.
Waypoint
action
  • Vehicle formation:
x, y
  • 2D-coordinates of the waypoint.
speed
  • Speed assigned to the waypoint. Has effect only if speed_locked is true.
ETA
  • Required/estimated time of arrival. If ETA_locked is true ETA is required time of arrival and group will adjust its speed to arrive at the waypoint at the given time. Estimated time of arrival has sense only for Mission Editor.
ETA_locked
  • Indicates is ETA required or estimated time of arrival.
name
  • Helper in Mission Editor. Has no effect in simulator.
task
  • Task that must be performed when unit/group will passed the waypoint.

Tasks for airborne and ground units/groups

1. FAC_AttackGroup

The task makes the group/unit a FAC and orders the FAC to control the target (enemy ground group) destruction. The killer is player-controlled allied CAS-aircraft that is in contact with the FAC.

If the task is assigned to the group lead unit will be a FAC.

 FAC_AttackGroup = { 
   id = 'FAC_AttackGroup', 
   params = { 
     groupId = Group.ID,
     weaponType = number,
     designation = enum AI.Task.Designation,
     datalink = boolean
   } 
 }
  • groupId
  • Target group identifier.

weaponType (optional)

  • Bitmask of weapon types those allowed to use. If parameter is not defined that means no limits on weapon usage.

Weapon flags are enlisted in Weapon.flag table.

designation (optional)

  • Designation type.

datalink (optional)

  • Allows to use datalink to send the target information to attack aircraft. Enabled by default.

Enroute tasks

En-route tasks for airborne units/groups

1. EngageTargets

All enroute tasks have the priority parameter. This is a number (less value - higher priority) that determines actions related to what task will be performed first.

Engaging a targets of defined types.

 EngageTargets ={ 
   id = 'EngageTargets', 
   params = { 
     maxDist = Distance, 
     targetTypes = array of AttributeName, 
     priority = number 
   } 
 }

maxDist

  • Maximal distance from the target to a route leg. If the target is on a greater distance it will be ignored.

targetTypes

  • Array of target categories allowed to engage.

2. EngageTargetsInZone

Engaging a targets of defined types at circle-shaped zone.

 EngageTargetsInZone = { 
   id = 'EngageTargetsInZone', 
   params = { 
     point = Vec2, 
     zoneRadius = Distance, 
     targetTypes = array of AttributeName,  
     priority = number 
   }
 }

point

  • 2D-coordinates of the zone.

zoneRadius

  • Radius of the zone.

targetTypes

  • Array of target categories allowed to engage.

3. Engage Group

Engaging a group. The task does not assign the target group to the unit/group to attack now; it just allows the unit/group to engage the target group as well as other assigned targets.

 EngageGroup = { 
   id = 'EngageGroup', 
   params = { 
     groupId = Group.ID, 
     weaponType = number, 
     expend = enum AI.Task.WeaponExpend, 
     attackQty = number, 
     direction = Azimuth, 
     attackQtyLimit = boolean, 
     priority = number 
   } 
 } 

The task has same parameters of AttackGroup task, plus priority.

4. EngageUnit

Engaging an unit. By this task you do not assign the target to the unit/group to attack now, you just allow the unit/group to engage the target as well as other assigned targets.

 EngageUnit = { 
   id = 'EngageUnit', 
   params = { 
     unitId = UnitId, 
     weaponType = number, 
     expend = enum AI.Task.WeaponExpend, 
     attackQty = number, 
     direction = Azimuth, 
     attackQtyLimit = boolean, 
     groupAttack = boolean, 
     priority = number 
   } 
 }

The task has same parameters of AttackUnit task, plus priority.

5. AWACS

Aircraft will act as an AWACS for friendly units (will provide them with information about contacts). No parameters.

 AWACS = { 
   id = 'AWACS', 
   params = { 
   } 
 }

6. Tanker

Aircraft will act as a tanker for friendly units. No parameters.

 Tanker = { 
   id = 'Tanker', 
   params = { 
   } 
 }

En-route tasks for ground units/groups

1. EWR

Ground unit (EW-radar) will act as an EWR for friendly units (will provide them with information about contacts). No parameters.

 EWR = { 
   id = 'EWR', 
   params = { 
   } 
 }

En-route tasks for airborne and ground units/groups

1. FAC_EngageGroup

The task makes the group/unit a FAC and lets the FAC to choose the target (enemy ground group) as well as other assigned targets. The killer is player-controlled allied CAS-aircraft that is in contact with the FAC.

If the task is assigned to the group lead unit will be a FAC.

 FAC_EngageGroup = { 
   id = 'FAC_AttackGroup', 
   params = { 
     groupId = Group.ID,
     weaponType = number,
     designation = enum AI.Task.Designation,
     datalink = boolean,
     priority = number
   } 
 }

The parameters are the same FAC_AttackGroup task has plus priority.

2. FAC

The task makes the group/unit a FAC andlets the FAC to choose a targets (enemy ground group) around as well as other assigned targets. The killer is player-controlled allied CAS-aircraft that is in contact with the FAC.

If the task is assigned to the group lead unit will be a FAC.

 FAC = { 
   id = 'FAC', 
   params = { 
     radius = Distance,
     priority = number
   } 
 }

radius

  • The maximal distance from the FAC to a target.

Special Tasks

1. Controlled Task

This is a wrapper for a task that makes possible to assign special conditions to stop a task.

 ControlledTask = { 
   id = 'ControlledTask', 
   params = { 
     task = Task, 
     stopCondition = StopCondition, 
   } 
 }

StopCondition consists of several sub-conditions. Each sub-condition is optional. If at least one of the conditions has met, the task will be stopped. All the sub-conditions will being checked periodically.

 StopCondition = { 
   time = Time, 
   userFlag = string, 
   userFlagValue = boolean, 
   condition = string, 
   duration = Time, 
   lastWaypoint = number, 
 }

time (optional)

  • Time of the task finish. If the time is defined, the condition will be met if the current time is greater than the time.

or

User Flag (optional).

userFlag

  • Name of the user flag.

userFlagValue

  • Value of the user flag

The condition will be met only is the userFlag has value that equals to userFlagValue.

or

condition (optional)

  • Lua code that will be wrapped into the function that returns boolean type.
 function [generated name]() 
   return [Lua code] 
 end

The condition will be met when the function will return true.

or

duration (optional)

  • Limit on task duration. The condition will be met when the task duration will become greater than duration.

or

lastWaypoint (optional)

  • Last waypoint where the task will still active. Used for enroute tasks only. The condition will be met if the group/unit switched to the next waypoint after lastWaypoint.

2. Combo Task

Combo Task is a list of actions to run them in the order they are enlisted.

 ComboTask = { 
   id = 'ComboTask', 
   params = { 
     tasks = { 
       [1] = Task, 
       [2] = Task, 
       ... 
       [N] = Task 
     } 
   } 
 } 

The task may be useful if it is necessary to assign list of actions to the group/unit. For example, actions list created for the waypoint in Mission Editor is a Combo Task. It is only possible to fill Combo Task with tasks. To fill the Combo Task with Commands and Behavior Options you should use Wrapped Action task.

3. Wrapped Action

A command wrapped into task. This construction may be useful in ComboTask.

 WrappedAction = { 
   id = 'WrappedAction', 
   params = { 
     action = Command 
   }
 }

Commands

Commands are instant actions those required zero time to perform. Commands may be used both for control unit/group behavior and control game mechanics.

 function Controller.setCommand(Controller self, Command command) 

sets the command to perform by controller.

Command

 Table that contains command identifier and command parameters. 

Commands have following format

 Command = { 
   id = string, 
   params = { 
   } 
 }

id is a string identifier of the command

1. No Action

Empty action. No parameters.

 NoAction = { 
   id = 'NoAction', 
   params = { 
   } 
 }

2. Script

Runs Lua-script.

 Script = { 
   id = 'Script', 
   params = { 
     command = string  
   } 
 }

command

  • String that contains Lua code

3. Set callsign

Sets callsign to the group. It is only valid for western groups those have hierarchic callsigns: [group callname][flight number][aircraft number]. You can change [group callname][flight number] part of callsign for all aircraft in the group of for single aircraft.

 SetCallsign = { 
   id = 'SetCallsign', 
   params = { 
     callname = number, 
     number = number, 
   } 
 }

callname

  • Numeric group callname identifier. Note that the different group callnames can have same identifier, but there are no conflicts because these callnames cannot be used by unit of same type. Callnames are enlisted in ./Scripts/Database/db_callnames.Lua.

Aircrafts

Callname Identifier
Enfield 1
Springfield 2
Uzi 3
Colt 4
Dodge 5
Ford 6
Chevy 7
Pontiac 8
Hawg 9
Boar 10
Pig 11
Tusk 12

AWACS

Callname Identifier
Overlord 1
Magic 2
Wizard 3
Focus 4
Darkstar 5

Tanker

Callname Identifier
Texaco 1
Arco 2
Shell 3

Ground JTAC

Callname Identifier
Axeman 1
Darknight 2
Warrior 3
Pointer 4
Eyeball 5
Moonbeam 6
Whiplash 7
Finger 8
Pinpoint 9
Ferret 10
Shaba 11
Playboy 12
Hammer 13
Jaguar 14
Deathstar 15
Anvil 16
Firefly 17
Mantis 18
Badger 19

number

  • Flight number.

4. Set frequency

Sets frequency and modulation to the unit's radio or to the radio of each unit in the group.

 SetFrequency = { 
   id = 'SetFrequency', 
   params = { 
     frequency = number, 
     modulation = enum radio.modulation, 
   } 
 }

modulation

  • Modulation of the radio.

frequency

  • Frequency of the radio in Hz.

5. Switch waypoint

Switches current leg of the route. Has effect only if the "Mission" task is active.

 SwitchWaypoint = { 
   id = 'SwitchWaypoint', 
   params = { 
     fromWaypointIndex = number,  
     goToWaypointIndex = number, 
   } 
 } 

New leg is defined by a two parameters:

fromWaypointIndex

  • Index of the waypoint "from" of the new route leg.

goToWaypointIndex

  • Index of the waypoint "to" of the new route leg.


6. Stop route

Stops / resumes following the route. Has effect only if the "Mission" task is active.

 StopRoute = { 
   id = 'StopRoute', 
   params = { 
     value = boolean, 
   } 
 }

value

  • Stops (true) or resumes (false) following the route.

7. Switch action

Switches to an another action of the actions list of the waypoint. Has effect only if the "Mission" task is active.

 SwitchAction = { 
   id = 'SwitchAction', 
   params = { 
     actionIndex = number, 
   }   
 }

actionIndex

  • Index of the action to switch to. Actions are enumerated from 1 to N.

8. Invisible

Makes the unit/group invisible for enemy A.I.

 SetInvisible = { 
   id = 'SetInvisible', 
   params = { 
     value = boolean 
   } 
 }

value

  • Invisible status.

9. Immortal

Makes the unit/group immortal.

 SetImmortal = { 
   id = 'SetImmortal', 
   params = { 
     value = boolean 
   } 
 }

value

  • Immortal status

10. Activate beacon

Activates the beacon onboard the aircraft or onboard first aircraft of the group. Note that the only one beacon can be activate at the same time. If you activated new beacon having another beacon active that old beacon will be deactivated.

 ActivateBeacon = { 
   id = 'ActivateBeacon', 
   params = { 
     type = number, 
     system = number, 
     name = string, 
     callsign = string, 
     frequency = number, 
   } 
 }

type

  • Beacon type. The constants are enlisted in ./Scripts/World/Radio/BeaconTypes.Lua
 BEACON_TYPE_NULL = 0 
 BEACON_TYPE_VOR = 1 
 BEACON_TYPE_DME = 2 
 BEACON_TYPE_VOR_DME = 3 
 BEACON_TYPE_TACAN = 4 
 BEACON_TYPE_VORTAC = 5 
 BEACON_TYPE_RSBN = 32 
 BEACON_TYPE_BROADCAST_STATION = 1024 
 BEACON_TYPE_HOMER = 8 
 BEACON_TYPE_AIRPORT_HOMER = 4104 
 BEACON_TYPE_AIRPORT_HOMER_WITH_MARKER = 4136 
 BEACON_TYPE_ILS_FAR_HOMER = 16408 
 BEACON_TYPE_ILS_NEAR_HOMER = 16456 
 BEACON_TYPE_ILS_LOCALIZER = 16640 
 BEACON_TYPE_ILS_GLIDESLOPE = 16896 
 BEACON_TYPE_NAUTICAL_HOMER = 32776

system

  • Determines what device(s) will be used. System constants are enlisted in ./Scripts/World/Radio/BeaconSites.Lua in table SystemName.
 SystemName = { 
   PAR_10 = 1, 
   RSBN_5 = 2, 
   TACAN = 3, 
   TACAN_TANKER = 4, 
   ILS_LOCALIZER = 5, 
   ILS_GLIDESLOPE = 6, 
   BROADCAST_STATION = 7 
 }

name

  • Helper in Mission Editor. Has no effect in simulator.

callsign

  • Beacon identifier that will being broadcasting in Morse code.

frequency

  • Frequency of the beacon's transmitter(s) in Hz.

11. Deactivate beacon

Deactivates beacon onboard the unit. If it is a group the beacon will be activated onboard a first unit of the group. No parameters.

 { 
   id = 'DeactivateBeacon', 
   params = { 
   } 
 }

12. EPLRS

Sets parameters of EPLRS datalink of the unit/group. If EPLRS command called for the airborne group then all aircrafts of the group will be affected. If EPLRS command called for vehicle group then only the first unit of the group will be affected. You can switch EPLRS on/off and change track number of the first unit of the vehicle group.

 { 
   id = 'EPLRS', 
   params = { 
     value = boolean, 
     groupId = number, 
   } 
 }

value

  • EPLRS status.

groupId

  • Track number of the first unit of the vehicle group. Used only for vehicle group.

Behavior options

Option is a pair of identifier and value. Behavior options are global parameters those affect controller behavior in all tasks it performs.

Option identifiers and values are stored in table AI.Option in subtables Air, Ground and Naval.

 OptionId = AI.Option.Air.id or AI.Option.Ground.id or AI.Option.Naval.id
 OptionValue = AI.Option.Air.val[optionName] or AI.Option.Ground.val[optionName] or AI.Option.Naval.val[optionName]
 function Controller.setOption(Controller self, OptionId optionId, OptionValue optionValue) 

sets the option to the controller.

optionId

  • Option identifier.

optionValue

  • Value of the option

Airborne units

Option Values
AI.Option.Air.id.NO_OPTION
AI.Option.Air.id.ROE AI.Option.Air.val.ROE.WEAPON_FREE

AI.Option.Air.val.ROE.OPEN_FIRE_WEAPON_FREE

AI.Option.Air.val.ROE.OPEN_FIRE

AI.Option.Air.val.ROE.RETURN_FIRE

AI.Option.Air.val.ROE.WEAPON_HOLD

AI.Option.Air.id.REACTION_ON_THREAT AI.Option.Air.val.REACTION_ON_THREAT.NO_REACTION

AI.Option.Air.val.REACTION_ON_THREAT.PASSIVE_DEFENCE

AI.Option.Air.val.REACTION_ON_THREAT.EVADE_FIRE

AI.Option.Air.val.REACTION_ON_THREAT.BYPASS_AND_ESCAPE

AI.Option.Air.val.REACTION_ON_THREAT.ALLOW_ABORT_MISSION

AI.Option.Air.id.RADAR_USING AI.Option.Air.val.RADAR_USING.NEVER

AI.Option.Air.val.RADAR_USING.FOR_ATTACK_ONLY

AI.Option.Air.val.RADAR_USING.FOR_SEARCH_IF_REQUIRED

AI.Option.Air.val.RADAR_USING.FOR_CONTINUOUS_SEARCH

AI.Option.Air.id.FLARE_USING AI.Option.Air.val.FLARE_USING.NEVER

AI.Option.Air.val.FLARE_USING.AGAINST_FIRED_MISSILE

AI.Option.Air.val.FLARE_USING.WHEN_FLYING_IN_SAM_WEZ

AI.Option.Air.val.FLARE_USING.WHEN_FLYING_NEAR_ENEMIES

AI.Option.Air.id.FORMATION complex option. See the description below.
AI.Option.Air.id.RTB_ON_BINGO true

false

AI.Option.Air.id.SILENCE true

false

Ground units

Option Values
AI.Option.Ground.id.NO_OPTION
AI.Option.Ground.id.ROE AI.Option.Ground.val.ROE.OPEN_FIRE

AI.Option.Ground.val.ROE.RETURN_FIRE

AI.Option.Ground.val.ROE.WEAPON_HOLD

AI.Option.Ground.id.DISPERSE_ON_ATTACK true

false

AI.Option.Ground.id.ALARM_STATE AI.Option.Ground.val.ALARM_STATE.AUTO,

AI.Option.Ground.val.ALARM_STATE.GREEN

AI.Option.Ground.val.ALARM_STATE.RED

Naval units

Option Values
AI.Option.Naval.id.NO_OPTION
AI.Option.Naval.id.ROE AI.Option.Naval.val.ROE.OPEN_FIRE

AI.Option.Naval.val.ROE.RETURN_FIRE

AI.Option.Naval.val.ROE.WEAPON_HOLD

Formation

Formation is a complex parameter that consists of 3 sub-parameters: formation type, formation variant and formation orientation (left/right). Each sub-parameter is represented by a number. These three numbers are packed into a single number - the formation code.

Note: it is not an elegant solution, but we have a limitation here - option value may be a number or boolean. May be it will be reworked later.

[4 bytes formation code] = [2 bytes - formation type][1 byte - formation orientation][1 byte - formation variant]

Formations are enlisted in ./Scripts/Database/db_formations.Lua.

Formation type identifiers

 local id = { 
   NO_FORMATION    = 0, 
   --airplanes 
   LINE_ABREAST    = 1, 
   TRAIL           = 2, 
   WEDGE           = 3, 
   ECHELON_RIGHT   = 4, 
   ECHELON_LEFT    = 5, 
   FINGER_FOUR     = 6, 
   SPREAD_FOUR     = 7, 
   --helicopters 
   HEL_WEDGE       = 8, 
   HEL_ECHELON     = 9, 
   HEL_FRONT       = 10, 
   HEL_COLUMN      = 11, 
   -- 
   MAX             = 12 
 }

Formation orientation

Default orientation of each formation type determines by a formation geometry given in the script. All existed formation types have right orientation. To inverse orientation (to the left) the value of formation orientation sub-parameter must be 1.

Formation variant

Some formation types have several variants usually different by a density. Variants are enumerated from 1 to N. If the variant is 0 then default variant will be used.

Airplane formations "Trail", "Wedge", "Echelon Right", "Echelon Left", "Finger Four", "Spred Four" have two variants: "Open" and "Close" (default) and have no variable orientation. Helicopter formation "Echelon" has three variants "50x70", "50x300" (default), "50x600" and has variable orientation. Helicopter formation "Front" has three variants: "interval 300" (default), "interval 600" and has variable orientation. All other formations have no variants and no variable orientation.

Detection

 Conroller.Detection = {
   VISUAL,
   OPTIC,
   RADAR,
   IRST,
   RWR,
   DLINK
 }

enum contains identifiers of surface types.

 function 
     boolean detected,
     boolean visible,
     ModelTime lastTime,
     boolean type,
     boolean distance,
     Vec3 lastPos,
     Vec3 lastVel,
                     Controller.isTargetDetected(Controller self,
                                                 Object target,
                                                 [Controller.Detection detection1,
                                                  Controller.Detection detection2,
                                                  ...
                                                  Controller.Detection detectionN] or nil) 

checks if the target is detected or not. If one or more detection method is specified the function will return true if the target is detected by at least one of these methods. If no detection methods are specified the function will return true if the target is detected by any method.

target

  • Target to check.

detection1 - detectionN

  • Detection methods of interest.

Return values:

detected

  • True if the target is detected.

visible

  • Has effect only if detected is true. True if the target is visible now.

type

  • Has effect only if detected is true. True if the target type is known.

distance

  • Has effect only if detected is true. True if the distance to the target is known.

lastTime

  • Has effect only if visible is false. Last time when target was seen.

lastPos

  • Has effect only if visible is false. Last position of the target when it was seen.

lastVel

  • Has effect only if visible is false. Last velocity of the target when it was seen.
 DetectedTarget = {
   object = Object, --the target
   visible = boolean, --the target is visible
   type = boolean, --the target type is known
   distance = boolean --distance to the target is known
 }

detected target.

 DetectedTargets = array of DetectedTarget

list of detected targets.

 function array DetectedTargets Controller.getDetectedTargets(Controller self,
                                                              [Controller.Detection detection1,
                                                               Controller.Detection detection2,
                                                                 ...
                                                               Controller.Detection detectionN] or nil)

returns list of detected targets. If one or more detection method is specified the function will return targets which were detected by at least one of these methods. If no detection methods are specified the function will return targets which were detected by any method.

detection1 - detectionN

  • Detection methods of interest.
 function Controller.knowTarget(Controller self, Object object, boolean type, boolean distance)

object

  • The target.

type

  • Target type is known.

distance

  • Distance to the target type is known.

Spot

Represents a spot from laser or IR-pointer. Final class.

Types

Spot.Category enum that stores spot categories.

 Spot.Category = {
   INFRA_RED,
   LASER
 }

Static functions

 Spot function Spot.createInfraRed(Object source, Vec3 localPoint = nil, Vec3 point)

creates laser ray from the object to the given point.

source

  • The object as the IR beam source.

localPoint

  • The point in the object reference frame where the IR beam is radiated from. May be nil.

point

  • The spot point - end point of the IR beam.
 Spot function Spot.createInfraRed(Object source, Vec3 localPoint = nil, Vec3 point, number laserCode)

creates laser ray from the object to the given point.

source

  • The object as the laser beam source.

localPoint

  • The point in the object reference frame where the laser beam is radiated from. May be nil.

point

  • The spot point - end point of the laser beam.

laserCode

  • The code that is used by laser designator.

Member functions

 function Spot.destroy(Spot self)

Destroys the spot.

 Spot.Category function Spot.getCategory(Spot self)

Returns category of the spot.

 Vec3 function Spot.getPoint(Spot self)

Returns position of the spot, end of the beam.

 number function Spot.getCode(Spot self)

Returns laser code.

 function Spot.setPoint(Spot self, Vec3 point)

Sets position of the spot.

point

  • Position of the spot.
 function Spot.setCode(Spot self, number code)

Sets position of the spot.

code

  • Laser code.