DCS Class Unit

From DCS World Wiki - Hoggitworld.com
Revision as of 00:36, 4 January 2023 by Loophole 62ndFF (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Scripting Root

Class Name: Unit Added with: 1.2.0
Extends:
Inherits: Object, Coalition Object
Description: Represents units: airplanes, helicopters, vehicles, ships and armed ground structures.
Member Functions: isActive, getPlayerName, getID, getNumber, getCategoryEx, getObjectID, getController, getGroup, getCallsign, getLife, getLife0, getFuel, getAmmo, getSensors, hasSensors, getRadar, getDrawArgumentValue, getNearestCargos, enableEmission, getDescentCapacity

Inherited from Object Class: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir

Inherited from Coalition Object Class: getCoalition, getCountry

Obtained Via: Static Functions Functions Events
Unit.getByName

Unit.getDescByName

Group Class Functions: getUnits, getUnit shot, hit, takeoff, land, crash, ejection, refueling, dead, pilot_dead, base_captured, refueling_stop, birth, human_failure, engine_startup, engine_shutdown, player_enter_unit, player_leave_unit, shooting_start, shooting_end
Enumerator Types: enumerator for Unit categories.
Note that Unit.Category values are not obtained by calling unit:getCategory() - that calls Object.getCategory(unit) and will always return the value Object.Category.UNIT. Instead you need to use unit:getDesc().category to find the Unit.Category!
Unit.Category = {
  AIRPLANE      = 0,
  HELICOPTER    = 1,
  GROUND_UNIT   = 2,
  SHIP          = 3,
  STRUCTURE     = 4
}

Refueling system

Unit.RefuelingSystem = {
  BOOM_AND_RECEPTACLE   = 0,
  PROBE_AND_DROGUE      = 1
}

Sensor Types

Unit.SensorType = {
  OPTIC     = 0,
  RADAR     = 1,
  IRST      = 2,
  RWR       = 3
}

Optic Types

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

Radar Types

Unit.RadarType = {
  AS    = 0, --air search radar
  SS    = 1 --surface/land search radar
}
Description Table Structure:
Notes: