Removes the unit from the mission.
Nothing.
TODO: disembarkation task payload is engine-native and absent from installed Lua sources.
Enables or disables supported radar emissions.
Desired emission state.
Nothing.
Returns the airbase currently associated with the unit, when any.
Returns each ammunition type currently loaded and its remaining count. DCS
returns nil when ammunition information is unavailable.
Ammunition entries, or undefined when no table is available.
Returns all database attributes assigned to this unit type.
Attribute membership flags.
Looks up a unit by its exact mission name. DCS may return late-activated
units before activation; use isActive() when runtime activation matters.
Exact Mission Editor or dynamically assigned unit name.
Matching unit, or undefined when not found.
Returns the unit's localized callsign.
Callsign text.
Returns cargo objects currently loaded aboard this transport.
Returns the inherited broad object category. For a unit this is normally
Object.Category.UNIT; use getCategoryEx() or getDesc().category for
airplane, helicopter, ground, ship, and structure categories.
Category identifier from Object.Category.
Returns the unit-specific platform category.
Value from Unit.Category.
Returns the coalition to which the unit currently belongs.
Coalition identifier from coalition.side.
TODO: engine-native communicator userdata has no published scripting shape.
Returns the AI controller for the unit. Aircraft and helicopters support unit-level control; ships and ground units are normally controlled through their group's controller.
Unit controller.
Returns the country assigned to the unit.
Country identifier from country.id.
Returns database metadata for the unit's type. Descriptor data is static; use other methods for changing runtime state.
Type-specific unit descriptor.
Returns descriptor data for a unit type without requiring an instance. This is a static function on Unit.
Returns troop/descent capacity for supported transport units.
Capacity count.
Returns a model draw argument in its normalized range.
Draw-argument index.
Current value, normally 0 to 1.
Returns fuel as a fraction of maximum internal capacity. External tanks can
make the result greater than 1; ground units and ships normally return 1.
Remaining fuel fraction, where 1 is full internal fuel.
Returns the group containing this unit, or undefined after it is no longer associated with a live group.
Parent group when available.
Returns the unit's runtime mission identifier.
Numeric runtime unit ID.
Returns the unit's current life (hit-point) value. Values below 1 are
generally considered dead. Aircraft subsystem damage is more detailed than
this aggregate value, and burning ground/ship units may report 0 before
their final explosion.
Current life value.
Returns the unit type's initial life value from its descriptor. This value
does not change as the unit takes damage and can be compared with
getLife() to calculate the remaining fraction.
Initial life value for the unit type.
const unit = Unit.getByName("Target");
if (unit) {
const remainingFraction = unit.getLife() / unit.getLife0();
env.info(`Life remaining: ${remainingFraction * 100}%`);
}
Returns the unit's exact mission name, not its type or callsign.
Mission Editor or dynamically assigned unit name.
Returns friendly cargo objects sorted nearest-first. Only helicopters provide this list.
Cargo objects, or undefined for unsupported units.
Returns nearby cargo candidates for aircraft cargo UI.
Returns the unit's fixed Mission Editor position within its group. This number does not change as other units are destroyed.
One-based group position.
Returns the object's runtime identifier used by lower-level object APIs.
Runtime object ID.
Returns the player's name when human-controlled, otherwise undefined.
Player name or undefined.
Returns the unit's current origin in local DCS world coordinates.
Position in metres using DCS's X/north, Y/up, Z/east axes.
Returns the unit's position and orientation matrix in local world space.
p is the position; x, y, and z are orientation unit vectors.
Current position and orientation.
Returns whether a radar is operating and the object it is tracking. When no object is tracked, Lua still returns the radar state but the second value is nil.
Radar-on state and tracked object, when present.
Returns all sensors grouped by values from Unit.SensorType.
Sensor map, or undefined when unavailable.
Returns the unit's internal DCS database type name, such as "F-16C_50".
Internal type name.
Returns the unit's current world-space velocity vector.
Velocity components in metres per second.
Tests a database attribute.
Attribute name.
Whether it is present.
Checks for any sensor, or a sensor type and optional subtype values.
OptionalsensorType: number
Value from Unit.SensorType; omit to test for any sensor.
Optic/radar subtype values.
Whether a matching sensor exists.
Reports whether the unit is airborne.
In-air state.
Reports whether the unit has been activated in the simulation. A known
late-activation unit returns false until its group is activated.
true when the unit is active.
Reports whether the unit still exists.
Existence state.
TODO: transport loading contract is engine-native and absent from installed Lua sources.
TODO: disembarkation marker payload is engine-native and absent from installed Lua sources.
TODO: legacy carrier-menu contract is engine-native and absent from installed Lua sources.
TODO: transport unloading contract is engine-native and absent from installed Lua sources.
Returns VTOL landing-area information. TODO: the native return schema is not exposed by installed Lua sources.
Version
2.9.29.27468