Module DCS.DCSUnit

Global(s)

Global Unit

Type(s)

Extends Dcs.DCSCoalitionWrapper.Object#CoalitionObject

Function(s)

Returns the unit ammunition.

Return value:

#Unit.Ammo:

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.

Parameter:
#string name

Return value:

#Unit:

Returns the unit's callsign - the localized string.

Return value:

string:

Returns controller of the unit if it exist and nil otherwise

Return value:

#Controller:

Returns unit descriptor.

Descriptor type depends on unit category.

Return value:

#Unit.Desc:

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.

Return value:

number:

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

returns the unit's unique identifier.

Return value:

#Unit.ID:

Returns the unit's health.

Dead units has health <= 1.0

Return value:

number:

returns the unit's initial health.

Return value:

number:

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.

Return value:

number:

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

Return value:

string:

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.

Return value:

boolean, Wrapper.Object#Object:

Returns the unit sensors.

Return value:

#Unit.Sensors:

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.

Parameters:
#Unit.SensorType sensorType

(= nil) Sensor type.

...

Additional parameters.

Return value:

boolean:

Usage:
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.

Returns if the unit is activated.

Return value:

boolean:

Type Unit.AmmoItem

ammunition item: "type-count" pair.

Field(s)

#number Unit.AmmoItem.count

ammunition count

#Weapon.Desc Unit.AmmoItem.desc

ammunition descriptor

Function(s)

Type Unit.Category

Enum that stores unit categories.

Field(s)

Function(s)

Type Unit.Desc

Extends Wrapper.Object#Object.Desc

A unit descriptor.

Field(s)

#Mass Unit.Desc.massEmpty

mass of empty unit

#number Unit.Desc.speedMax

istance / Time, --maximal velocity

Function(s)

Type Unit.DescAircraft

Extends Wrapper.Unit#Unit.Desc

An aircraft descriptor.

Field(s)

#number Unit.DescAircraft.NyMax

maximal safe acceleration

#number Unit.DescAircraft.NyMin

minimal safe acceleration

#number Unit.DescAircraft.VyMax

#Distance / #Time, --maximal climb rate

#Mass Unit.DescAircraft.fuelMassMax

maximal inner fuel mass

Function(s)

Type Unit.DescAirplane

Extends Wrapper.Unit#Unit.DescAircraft

An airplane descriptor.

Field(s)

#number Unit.DescAirplane.speedMax0

Distance / Time maximal TAS at ground level

#number Unit.DescAirplane.speedMax10K

Distance / Time maximal TAS at altitude of 10 km

Function(s)

Type Unit.DescHelicopter

Extends Wrapper.Unit#Unit.DescAircraft

A helicopter descriptor.

Field(s)

Function(s)

Type Unit.DescVehicle

Extends Wrapper.Unit#Unit.Desc

A vehicle descriptor.

Field(s)

#boolean Unit.DescVehicle.riverCrossing

can the vehicle cross a rivers

Function(s)

Type Unit.Optic

Extends Wrapper.Unit#Unit.Sensor

An optic sensor.

Function(s)

Type Unit.OpticType

Enum that stores types of optic sensors.

Field(s)

Function(s)

Type Unit.Radar

Extends Wrapper.Unit#Unit.Sensor

A radar.

Field(s)

#Unit.Radar.detectionDistanceAir Unit.Radar.detectionDistanceAir

detection distance for RCS=1m^2 airborne target, nil if radar doesn't support air search

#Distance Unit.Radar.detectionDistanceHRM

detection distance for RCS=1m^2 in high-resolution mapping mode, nil if radar has no HRM

#Distance Unit.Radar.detectionDistanceRBM

detection distance for RCS=1m^2 in real-beam mapping mode, nil if radar doesn't support surface/land search

Function(s)

Type Unit.Radar.detectionDistanceAir

Type Unit.Radar.detectionDistanceAir.lowerHemisphere

Type Unit.Radar.detectionDistanceAir.upperHemisphere

Type Unit.RadarType

Enum that stores radar types.

Field(s)

Function(s)

Type Unit.RefuelingSystem

Enum that stores aircraft refueling system types.

Field(s)

Function(s)

Type Unit.Sensor

A unit sensor.

Function(s)

Type Unit.SensorType

Enum that stores sensor types.

Field(s)

Function(s)

Type Wrapper.Unit

An IRST.

Field(s)

#Distance Wrapper.Unit.detectionDistanceAfterburner

..., engines are in afterburner mode

#Distance Wrapper.Unit.detectionDistanceIdle

detection of tail-on target with heat signature = 1 in upper hemisphere, engines are in idle

#Distance Wrapper.Unit.detectionDistanceMaximal

..., engines are in maximal mode

Function(s)