Difference between revisions of "DCS Class Unit"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
 
(2 intermediate revisions by one other user not shown)
Line 10: Line 10:
 
|desc= Represents units: airplanes, helicopters, vehicles, ships and armed ground structures.
 
|desc= Represents units: airplanes, helicopters, vehicles, ships and armed ground structures.
  
|type= enumerator for Unit categories
+
|type= enumerator for Unit categories.<br/>Note that Unit.Category values are <u>not</u> obtained by calling ''unit'':getCategory() - that calls Object.getCategory(''unit'') and will <u>always</u> return the value Object.Category.UNIT.  Instead you need to use ''unit'':getDesc().category to find the Unit.Category!
 
  Unit.Category = {
 
  Unit.Category = {
   AIRPLANE,
+
   AIRPLANE     = 0,
   HELICOPTER,
+
   HELICOPTER   = 1,
   GROUND_UNIT,
+
   GROUND_UNIT   = 2,
   SHIP,
+
   SHIP         = 3,
   STRUCTURE
+
   STRUCTURE     = 4
 
  }
 
  }
  
 
Refueling system
 
Refueling system
 
  Unit.RefuelingSystem = {
 
  Unit.RefuelingSystem = {
   BOOM_AND_RECEPTACLE,
+
   BOOM_AND_RECEPTACLE   = 0,
   PROBE_AND_DROGUE
+
   PROBE_AND_DROGUE     = 1
 
  }
 
  }
  
Line 28: Line 28:
  
 
  Unit.SensorType = {
 
  Unit.SensorType = {
   OPTIC,
+
   OPTIC     = 0,
   RADAR,
+
   RADAR     = 1,
   IRST,
+
   IRST     = 2,
   RWR
+
   RWR       = 3
 
  }
 
  }
 
Optic Types
 
Optic Types
  
 
  Unit.OpticType = {
 
  Unit.OpticType = {
   TV, --TV-sensor
+
   TV     = 0, --TV-sensor
   LLTV, --Low-level TV-sensor
+
   LLTV   = 1, --Low-level TV-sensor
   IR --Infra-Red optic sensor
+
   IR     = 2  --Infra-Red optic sensor
 
  }
 
  }
  
Line 44: Line 44:
  
 
  Unit.RadarType = {
 
  Unit.RadarType = {
   AS, --air search radar
+
   AS   = 0, --air search radar
   SS --surface/land search radar
+
   SS   = 1 --surface/land search radar
 
  }
 
  }
 
|structures=
 
|structures=
Line 68: Line 68:
  
 
}}
 
}}
 +
[[Category:Game Patch 1.2.0|Unit Class]]

Latest revision as of 00:36, 4 January 2023

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: