Banner Image

Module DCS

DCS API Prototypes

See the Simulator Scripting Engine Documentation on Hoggit for further explanation and examples.

Global(s)

Global AI

Global Airbase

Global CoalitionObject

Global Controller

Global Group

Global Object

Global Unit

Global Weapon

Global Zone

#table Zone

Global coalition

Global country

Global env

DCS Singleton env

Global land

DCS Singleton land

Global timer

DCS Singleton timer

Global world

The world singleton contains functions centered around two different but extremely useful functions.

#world world

The world singleton contains functions centered around two different but extremely useful functions.

  • Events and event handlers are all governed within world.
  • A number of functions to get information about the game world.

See https://wiki.hoggitworld.com/view/DCS_singleton_world

Type(s)

AI
Fields and Methods inherited from AI Description

AI.Option

AI.Skill

AI.Task

Fields and Methods inherited from AI.Option Description

AI.Option.Air

AI.Option.Ground

AI.Option.Naval

Fields and Methods inherited from AI.Option.Air Description

AI.Option.Air.id

AI.Option.Air.val

Fields and Methods inherited from AI.Option.Ground Description

AI.Option.Ground.id

AI.Option.Ground.val

Fields and Methods inherited from AI.Option.Ground.val Description

AI.Option.Ground.val.ALARM_STATE

AI.Option.Ground.val.ROE

Fields and Methods inherited from AI.Option.Ground.val.ALARM_STATE Description

AI.Option.Ground.val.ALARM_STATE.AUTO

AI.Option.Ground.val.ALARM_STATE.GREEN

AI.Option.Ground.val.ALARM_STATE.RED

Fields and Methods inherited from AI.Option.Ground.val.ROE Description

AI.Option.Ground.val.ROE.OPEN_FIRE

AI.Option.Ground.val.ROE.RETURN_FIRE

AI.Option.Ground.val.ROE.WEAPON_HOLD

Fields and Methods inherited from AI.Option.Naval Description

AI.Option.Naval.id

AI.Option.Naval.val

Fields and Methods inherited from AI.Option.Naval.id Description

AI.Option.Naval.id.NO_OPTION

AI.Option.Naval.id.ROE

Fields and Methods inherited from AI.Option.Naval.val Description

AI.Option.Naval.val.ROE

Fields and Methods inherited from AI.Option.Naval.val.ROE Description

AI.Option.Naval.val.ROE.OPEN_FIRE

AI.Option.Naval.val.ROE.RETURN_FIRE

AI.Option.Naval.val.ROE.WEAPON_HOLD

Fields and Methods inherited from AI.Skill Description

AI.Skill.AVERAGE

AI.Skill.CLIENT

AI.Skill.EXCELLENT

AI.Skill.GOOD

AI.Skill.HIGH

AI.Skill.PLAYER

Fields and Methods inherited from AI.Task.AltitudeType Description

AI.Task.AltitudeType.BARO

AI.Task.AltitudeType.RADIO

Fields and Methods inherited from AI.Task.OrbitPattern Description

AI.Task.OrbitPattern.CIRCLE

AI.Task.OrbitPattern.RACE_TRACK

Fields and Methods inherited from AI.Task.TurnMethod Description

AI.Task.TurnMethod.FIN_POINT

AI.Task.TurnMethod.FLY_OVER_POINT

Fields and Methods inherited from Airbase Description

Airbase.Category

enum contains identifiers of airbase categories.

Airbase.Desc

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

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.getByName(name)

Returns airbase by its name.

Airbase:getCallsign()

Returns the airbase's callsign - the localized string.

Airbase:getDesc()

Returns descriptor of the airbase.

Airbase.getDescByName(typeName)

Returns airbase descriptor by type name.

Airbase:getID()

Returns identifier of the airbase.

Airbase:getUnit()

Returns Unit that is corresponded to the airbase.

Fields and Methods inherited from Airbase.Category Description

Airbase.Category.AIRDROME

Airbase.Category.HELIPAD

Airbase.Category.SHIP

Airbase.Desc , extends #Desc
Fields and Methods inherited from Airbase.Desc Description

Airbase.Desc.category

Category of the airbase type.

Fields and Methods inherited from Box3 Description

Box3.max

Box3.min

Fields and Methods inherited from CoalitionObject Description

CoalitionObject:getCoalition()

Returns coalition of the object.

CoalitionObject:getCountry()

Returns object country.

Fields and Methods inherited from Controller Description

Controller:getDetectedTargets(detection)

Returns list of detected targets.

Controller:hasTask()

Returns true if the controller has a task.

Controller:isTargetDetected(target, detection)

Checks if the target is detected or not.

Controller:knowTarget(object, type, distance)

Know a target.

Controller:popTask()

Pops current (front) task from the queue and makes active next task in the queue (if exists).

Controller:pushTask(task)

Pushes the task to the front of the queue and makes the task active.

Controller:resetTask()

Resets current task of the controller.

Controller:setOnOff(value)

Enables and disables the controller.

Controller:setOption(optionId, optionValue)

Sets the option to the controller.

Controller:setTask(task)

Resets current task and then sets the task to the controller.

Fields and Methods inherited from Desc Description

Desc.attributes

object type attributes

Desc.displayName

localized display name

Desc.typeName

type name

Fields and Methods inherited from DetectedTarget Description

DetectedTarget.distance

Distance to the target is known

DetectedTarget.object

The target

DetectedTarget.type

The target type is known

DetectedTarget.visible

The target is visible

Fields and Methods inherited from Group Description

Group.Category

Enum contains identifiers of group types.

Group.ID

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

Group:destroy()

Destroys the group and all of its units.

Group.getByName(name)

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

Group:getCategory()

Returns category of the group.

Group:getCoalition()

Returns the coalition of the group.

Group:getController()

Returns controller of the group.

Group:getID()

Returns the group identifier.

Group:getInitialSize()

Returns initial size of the group.

Group:getName()

Returns the group's name.

Group:getSize()

Returns current size of the group.

Group:getUnit(unitNumber)

Returns the unit with number unitNumber.

Group:getUnits()

Returns array of the units present in the group now.

Group:isExist()

returns true if the group exist or false otherwise.

Fields and Methods inherited from Object Description

Object.Category

Object.Desc

Object:destroy()

Object:getCategory()

Object:getDesc()

Returns object descriptor.

Object:getName()

Returns name of the object.

Object:getPoint()

Returns object coordinates for current time.

Object:getPosition()

Returns object position for current time.

Object:getTypeName()

Returns type name of the Object.

Object:getVelocity()

Returns the unit's velocity vector.

Object:hasAttribute(attributeName)

Returns true if the object belongs to the category.

Object:inAir()

Returns true if the unit is in air.

Object:isExist()

Object.Desc , extends #Desc
Fields and Methods inherited from Object.Desc Description

Object.Desc.box

bounding box of collision geometry

Object.Desc.life

initial life level

Fields and Methods inherited from Position3 Description

Position3.p

Position3.x

Position3.y

Position3.z

Fields and Methods inherited from Task Description

Task.id

Task.param

Fields and Methods inherited from Unit Description

Unit.Ammo

Unit.AmmoItem

Unit.Category

Unit.Desc

Unit.DescAircraft

Unit.DescAirplane

Unit.DescHelicopter

Unit.DescShip

Unit.DescVehicle

Unit.ID

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

Unit.IRST

Unit.Optic

Unit.OpticType

Unit.Radar

Unit.RadarType

Unit.RefuelingSystem

Unit.Sensor

Unit.SensorType

Unit:getAmmo()

Returns the unit ammunition.

Unit.getByName(name)

Returns unit object by the name assigned to the unit in Mission Editor.

Unit:getCallsign()

Returns the unit's callsign - the localized string.

Unit:getController()

Returns controller of the unit if it exist and nil otherwise

Unit:getDesc()

Returns unit descriptor.

Unit:getFuel()

Returns relative amount of fuel (from 0.0 to 1.0) the unit has in its internal tanks.

Unit:getGroup()

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

Unit:getID()

returns the unit's unique identifier.

Unit:getLife()

Returns the unit's health.

Unit:getLife0()

returns the unit's initial health.

Unit:getNumber()

Returns the unit's number in the group.

Unit:getPlayerName()

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

Unit:getRadar()

returns two values: First value indicates if at least one of the unit's radar(s) is on.

Unit:getSensors()

Returns the unit sensors.

Unit:hasSensors(sensorType, ...)

Returns true if the unit has specified types of sensors.

Unit:isActive()

Returns if the unit is activated.

Fields and Methods inherited from Unit.AmmoItem Description

Unit.AmmoItem.count

ammunition count

Unit.AmmoItem.desc

ammunition descriptor

Fields and Methods inherited from Unit.Desc Description

Unit.Desc.category

Unit Category

Unit.Desc.massEmpty

mass of empty unit

Unit.Desc.speedMax

istance / Time, --maximal velocity

Fields and Methods inherited from Unit.DescAircraft Description

Unit.DescAircraft.Hmax

Ceiling

Unit.DescAircraft.NyMax

maximal safe acceleration

Unit.DescAircraft.NyMin

minimal safe acceleration

Unit.DescAircraft.VyMax

#Distance / #Time, --maximal climb rate

Unit.DescAircraft.fuelMassMax

maximal inner fuel mass

Unit.DescAircraft.range

Operational range

Unit.DescAircraft.tankerType

refueling system type

Fields and Methods inherited from Unit.DescAirplane Description

Unit.DescAirplane.speedMax0

Distance / Time maximal TAS at ground level

Unit.DescAirplane.speedMax10K

Distance / Time maximal TAS at altitude of 10 km

Fields and Methods inherited from Unit.DescHelicopter Description

Unit.DescHelicopter.HmaxStat

static ceiling

Fields and Methods inherited from Unit.DescVehicle Description

Unit.DescVehicle.maxSlopeAngle

maximal slope angle

Unit.DescVehicle.riverCrossing

can the vehicle cross a rivers

Fields and Methods inherited from Unit.IRST Description

Unit.IRST.detectionDistanceAfterburner

..., engines are in afterburner mode

Unit.IRST.detectionDistanceIdle

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

Unit.IRST.detectionDistanceMaximal

..., engines are in maximal mode

Fields and Methods inherited from Unit.Optic Description

Unit.Optic.opticType

Fields and Methods inherited from Unit.OpticType Description

Unit.OpticType.IR

Infra-Red optic sensor

Unit.OpticType.LLTV

Low-level TV-sensor

Unit.OpticType.TV

TV-sensor

Fields and Methods inherited from Unit.Radar Description

Unit.Radar.detectionDistanceAir

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

Unit.Radar.detectionDistanceHRM

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

Unit.Radar.detectionDistanceRBM

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

Fields and Methods inherited from Unit.Radar.detectionDistanceAir Description

Unit.Radar.detectionDistanceAir.lowerHemisphere

Unit.Radar.detectionDistanceAir.upperHemisphere

Fields and Methods inherited from Unit.Radar.detectionDistanceAir.lowerHemisphere Description

Unit.Radar.detectionDistanceAir.lowerHemisphere.headOn

Unit.Radar.detectionDistanceAir.lowerHemisphere.tailOn

Fields and Methods inherited from Unit.Radar.detectionDistanceAir.upperHemisphere Description

Unit.Radar.detectionDistanceAir.upperHemisphere.headOn

Unit.Radar.detectionDistanceAir.upperHemisphere.tailOn

Fields and Methods inherited from Unit.RadarType Description

Unit.RadarType.AS

air search radar

Unit.RadarType.SS

surface/land search radar

Fields and Methods inherited from Unit.RefuelingSystem Description

Unit.RefuelingSystem.BOOM_AND_RECEPTACLE

Unit.RefuelingSystem.PROBE_AND_DROGUE

Fields and Methods inherited from Unit.Sensor Description

Unit.Sensor.type

Unit.Sensor.typeName

Fields and Methods inherited from Unit.SensorType Description

Unit.SensorType.IRST

Unit.SensorType.OPTIC

Unit.SensorType.RADAR

Unit.SensorType.RWR

Fields and Methods inherited from Vec2 Description

Vec2.x

Vec2.x = Vec3.x

Vec2.y

Vec2.y = Vec3.z

Fields and Methods inherited from Vec3 Description

Vec3.x

is directed to the north

Vec3.y

is directed up

Vec3.z

is directed to the east

Fields and Methods inherited from Weapon Description

Weapon.Category

enum that stores weapon categories.

Weapon.Desc

The descriptor of a weapon.

Weapon.GuidanceType

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

Weapon.MissileCategory

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

Weapon.WarheadType

enum that stores warhead types.

Weapon.flag

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

Weapon:getDesc()

returns weapon descriptor.

Weapon:getLauncher()

Returns the unit that launched the weapon.

Weapon:getTarget()

returns target of the guided weapon.

Fields and Methods inherited from Weapon.Category Description

Weapon.Category.BOMB

Weapon.Category.MISSILE

Weapon.Category.ROCKET

Weapon.Category.SHELL

Fields and Methods inherited from Weapon.WarheadType Description

Weapon.WarheadType.AP

Weapon.WarheadType.HE

Weapon.WarheadType.SHAPED_EXPLOSIVE

Fields and Methods inherited from Weapon.flag Description

Weapon.flag.AR_AAM

Weapon.flag.AntiRadarMissile

Weapon.flag.AntiShipMissile

Weapon.flag.AntiTankMissile

Weapon.flag.AnyAAM

= IR_AAM + SAR_AAM + AR_AAM + SRAAM + MRAAM + LRAAM

Weapon.flag.AnyAAWeapon

= BuiltInCannon + GUN_POD + AnyAAM

Weapon.flag.AnyAGWeapon

= BuiltInCannon + GUN_POD + AnyBomb + AnyRocket + AnyASM

Weapon.flag.AnyASM

= AntiRadarMissile + AntiShipMissile + AntiTankMissile + FireAndForgetASM + GuidedASM + CruiseMissile

Weapon.flag.AnyAutonomousMissile

= IR_AAM + AntiRadarMissile + AntiShipMissile + FireAndForgetASM + CruiseMissile

Weapon.flag.AnyBomb

= GuidedBomb + AnyUnguidedBomb

Weapon.flag.AnyMissile

= AnyASM + AnyAAM

Weapon.flag.AnyRocket

= LightRocket + HeavyRocket + MarkerRocket + CandleRocket

Weapon.flag.AnyUnguidedBomb

= HEBomb + Penetrator + NapalmBomb + FAEBomb + ClusterBomb + Dispencer + CandleBomb + ParachuteBomb

Weapon.flag.AnyWeapon

= AnyBomb + AnyRocket + AnyMissile + Cannons

Weapon.flag.ArmWeapon

= AnyWeapon - MarkerWeapon

Weapon.flag.BuiltInCannon

Weapon.flag.CandleBomb

Weapon.flag.CandleRocket

Weapon.flag.Cannons

= GUN_POD + BuiltInCannon

Weapon.flag.ClusterBomb

Weapon.flag.CruiseMissile

Weapon.flag.Dispencer

Weapon.flag.FAEBomb

Weapon.flag.FireAndForgetASM

Weapon.flag.GUN_POD

Weapon.flag.GuidedASM

= LaserASM + TeleASM

Weapon.flag.GuidedBomb

= LGB + TvGB + SNSGB

Weapon.flag.GuidedWeapon

= GuidedBomb + AnyASM + AnyAAM

Weapon.flag.HEBomb

Weapon.flag.HeavyRocket

Weapon.flag.IR_AAM

Weapon.flag.LGB

Weapon.flag.LRAAM

Weapon.flag.LaserASM

Weapon.flag.LightRocket

Weapon.flag.MRAAM

Weapon.flag.MarkerRocket

Weapon.flag.MarkerWeapon

= MarkerRocket + CandleRocket + CandleBomb

Weapon.flag.NapalmBomb

Weapon.flag.ParachuteBomb

Weapon.flag.Penetrator

Weapon.flag.SAR_AAM

Weapon.flag.SNSGB

Weapon.flag.SRAAM

Weapon.flag.TacticASM

= GuidedASM + FireAndForgetASM

Weapon.flag.TeleASM

Weapon.flag.TvGB

Weapon.flag.UnguidedWeapon

= Cannons + BuiltInCannon + GUN_POD + AnyUnguidedBomb + AnyRocket

Fields and Methods inherited from Zone Description

Zone.point

Zone.radius

Fields and Methods inherited from coalition Description

coalition.getCountryCoalition(countryId)

coalition.side

Fields and Methods inherited from coalition.side Description

coalition.side.BLUE

coalition.side.NEUTRAL

coalition.side.RED

Fields and Methods inherited from country Description

country.id

Fields and Methods inherited from country.id Description

country.id.ABKHAZIA

country.id.AGGRESSORS

country.id.ALGERIA

country.id.AUSTRALIA

country.id.AUSTRIA

country.id.BAHRAIN

country.id.BELARUS

country.id.BELGIUM

country.id.BRAZIL

country.id.BULGARIA

country.id.CANADA

country.id.CHEZH_REPUBLIC

country.id.CHILE

country.id.CHINA

country.id.CROATIA

country.id.DENMARK

country.id.EGYPT

country.id.ETHIOPIA

country.id.FINLAND

country.id.FRANCE

country.id.GEORGIA

country.id.GERMANY

country.id.GREECE

country.id.HONDURAS

country.id.HUNGARY

country.id.INDIA

country.id.INDONESIA

country.id.INSURGENTS

country.id.IRAN

country.id.IRAQ

country.id.ISRAEL

country.id.ITALIAN_SOCIAL_REPUBLIC

country.id.ITALY

country.id.JAPAN

country.id.JORDAN

country.id.KAZAKHSTAN

country.id.KUWAIT

country.id.LIBYA

country.id.MALAYSIA

country.id.MEXICO

country.id.MOROCCO

country.id.NORTH_KOREA

country.id.NORWAY

country.id.OMAN

country.id.PAKISTAN

country.id.PHILIPPINES

country.id.POLAND

country.id.QATAR

country.id.ROMANIA

country.id.RUSSIA

country.id.SAUDI_ARABIA

country.id.SERBIA

country.id.SLOVAKIA

country.id.SOUTH_KOREA

country.id.SOUTH_OSETIA

country.id.SPAIN

country.id.SUDAN

country.id.SWEDEN

country.id.SWITZERLAND

country.id.SYRIA

country.id.THAILAND

country.id.THE_NETHERLANDS

country.id.THIRDREICH

country.id.TUNISIA

country.id.TURKEY

country.id.UK

country.id.UKRAINE

country.id.UNITED_ARAB_EMIRATES

country.id.USA

country.id.USSR

country.id.VENEZUELA

country.id.VIETNAM

country.id.YEMEN

country.id.YUGOSLAVIA

env
Fields and Methods inherited from env Description

env.error(message, showMessageBox)

Add message to simulator log with caption "ERROR".

env.info(message, showMessageBox)

Add message to simulator log with caption "INFO".

env.setErrorMessageBoxEnabled(on)

Enables/disables appearance of message box each time lua error occurs.

env.warning(message, showMessageBox)

Add message to simulator log with caption "WARNING".

Fields and Methods inherited from land Description

land.SurfaceType

land.getHeight(point)

Returns altitude MSL of the point.

land.getSurfaceType(point)

returns surface type at the given point.

Fields and Methods inherited from timer Description

timer.getAbsTime()

Returns mission time in seconds.

timer.getTime()

Returns model time in seconds.

timer.getTime0()

Returns mission start time in seconds.

timer.removeFunction(functionId)

Removes the function from schedule.

timer.scheduleFunction(functionToCall, functionArgument, time)

Schedules function to call at desired model time.

timer.setFunctionTime(functionId, time)

Re-schedules function to call at another model time.

Fields and Methods inherited from world Description

world.BirthPlace

The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.

world.VolumeType

The volumeType enumerator defines the types of 3d geometery used within the world.searchObjects function.

world.addEventHandler(handler)

Adds a function as an event handler that executes whenever a simulator event occurs.

world.event

https://wiki.hoggitworld.com/view/DCS_enum_world

world.getMarkPanels()

Returns a table of mark panels indexed numerically that are present within the mission.

world.getPlayer()

Returns a table of the single unit object in the game who's skill level is set as "Player".

world.removeEventHandler(handler)

Removes the specified event handler from handling events.

world.searchObjects(objectcategory, volume, ObjectSeachHandler, any)

Searches a defined volume of 3d space for the specified objects within it and then can run function on each returned object.

Fields and Methods inherited from world.VolumeType Description

world.VolumeType.BOX

world.VolumeType.PYRAMID

world.VolumeType.SEGMENT

world.VolumeType.SPHERE

Fields and Methods inherited from world.event Description

world.event.S_EVENT_BASE_CAPTURED

https://wiki.hoggitworld.com/view/DCS_event_base_captured

world.event.S_EVENT_BIRTH

https://wiki.hoggitworld.com/view/DCS_event_birth

world.event.S_EVENT_CRASH

https://wiki.hoggitworld.com/view/DCS_event_crash

world.event.S_EVENT_DEAD

https://wiki.hoggitworld.com/view/DCS_event_dead

world.event.S_EVENT_EJECTION

https://wiki.hoggitworld.com/view/DCS_event_ejection

world.event.S_EVENT_ENGINE_SHUTDOWN

https://wiki.hoggitworld.com/view/DCS_event_engine_shutdown

world.event.S_EVENT_ENGINE_STARTUP

https://wiki.hoggitworld.com/view/DCS_event_engine_startup

world.event.S_EVENT_HIT

https://wiki.hoggitworld.com/view/DCS_event_hit

world.event.S_EVENT_HUMAN_FAILURE

https://wiki.hoggitworld.com/view/DCS_event_human_failure

world.event.S_EVENT_INVALID

world.event.S_EVENT_LAND

https://wiki.hoggitworld.com/view/DCS_event_land

world.event.S_EVENT_MARK

REMOVE https://wiki.hoggitworld.com/view/DCS_event_mark_remove

world.event.S_EVENT_MAX

world.event.S_EVENT_MISSION_END

https://wiki.hoggitworld.com/view/DCS_event_mission_end

world.event.S_EVENT_MISSION_START

https://wiki.hoggitworld.com/view/DCS_event_mission_start

world.event.S_EVENT_PILOT_DEAD

https://wiki.hoggitworld.com/view/DCS_event_pilot_dead

world.event.S_EVENT_PLAYER_COMMENT

world.event.S_EVENT_PLAYER_ENTER_UNIT

https://wiki.hoggitworld.com/view/DCS_event_player_enter_unit

world.event.S_EVENT_PLAYER_LEAVE_UNIT

https://wiki.hoggitworld.com/view/DCS_event_player_leave_unit

world.event.S_EVENT_REFUELING

https://wiki.hoggitworld.com/view/DCS_event_refueling

world.event.S_EVENT_REFUELING_STOP

https://wiki.hoggitworld.com/view/DCS_event_refueling_stop

world.event.S_EVENT_SHOOTING_END

https://wiki.hoggitworld.com/view/DCS_event_shooting_end

world.event.S_EVENT_SHOOTING_START

https://wiki.hoggitworld.com/view/DCS_event_shooting_start

world.event.S_EVENT_SHOT

https://wiki.hoggitworld.com/view/DCS_event_shot

world.event.S_EVENT_TAKEOFF

https://wiki.hoggitworld.com/view/DCS_event_takeoff

world.event.S_EVENT_TOOK_CONTROL

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

Field(s)

Function(s)

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

Field(s)

#Airbase.Category Airbase.Category

enum contains identifiers of airbase categories.

#Airbase.Desc Airbase.Desc

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

#Airbase.ID 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.

Function(s)

Returns airbase by its name.

If no airbase found the function will return nil.

Defined in:

Airbase

Parameter:

#string name

Return value:

Returns the airbase's callsign - the localized string.

Defined in:

Airbase

Return value:

#string:

Returns descriptor of the airbase.

Defined in:

Airbase

Return value:

Returns airbase descriptor by type name.

If no descriptor is found the function will return nil.

Defined in:

Airbase

Parameter:

#TypeName typeName

Airbase type name.

Return value:

Returns identifier of the airbase.

Defined in:

Airbase

Return value:

Returns Unit that is corresponded to the airbase.

Works only for ships.

Defined in:

Airbase

Return value:

Enum contains identifiers of airbase categories.

Field(s)

Function(s)

Airbase descriptor.

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

Field(s)

#Airbase.Category Airbase.Desc.category

Category of the airbase type.

Function(s)

3-dimensional box.

Field(s)

Function(s)

DCS Class CoalitionObject

Field(s)

Function(s)

Returns coalition of the object.

Defined in:

CoalitionObject

Return value:

Returns object country.

Defined in:

CoalitionObject

Return value:

Field(s)

Function(s)

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.

Defined in:

Controller

Parameter:

Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN

Return value:

#list<#DetectedTarget>:

array of DetectedTarget

Returns true if the controller has a task.

Defined in:

Controller

Return value:

#boolean:

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.

Defined in:

Controller

Parameters:

Target to check

Controller.Detection detection1, Controller.Detection detection2, ... Controller.Detection detectionN

Return values:

#boolean:

detected True if the target is detected.

#boolean:

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

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

#boolean:

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

#boolean:

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

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.

Know a target.

Defined in:

Controller

Parameters:

The target.

#boolean type

Target type is known.

#boolean distance

Distance to target is known.

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.

Defined in:

Controller

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.

Defined in:

Controller

Parameter:

#Task task

Resets current task of the controller.

Defined in:

Controller

Enables and disables the controller.

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

Defined in:

Controller

Parameter:

#boolean value

Enable / Disable.

Sets the option to the controller.

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]

Defined in:

Controller

Parameters:

#OptionId optionId

Option identifier.

#OptionValue optionValue

Value of the option.

Resets current task and then sets the task to the controller.

Task is a table that contains task identifier and task parameters.

Defined in:

Controller

Parameter:

#Task task

Enum contains identifiers of surface types.

Field(s)

Function(s)

Field(s)

#table Desc.attributes

object type attributes

#string Desc.displayName

localized display name

Function(s)

Detected target.

Field(s)

#boolean DetectedTarget.distance

Distance to the target is known

#boolean DetectedTarget.type

The target type is known

#boolean DetectedTarget.visible

The target is visible

Function(s)

Represents group of Units.

Field(s)

#Group.Category Group.Category

Enum contains identifiers of group types.

#ID Group.ID

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

Function(s)

Destroys the group and all of its units.

Defined in:

Group

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

Defined in:

Group

Parameter:

#string name

Return value:

Returns category of the group.

Defined in:

Group

Return value:

Returns the coalition of the group.

Defined in:

Group

Return value:

Returns controller of the group.

Defined in:

Group

Return value:

Returns the group identifier.

Defined in:

Group

Return value:

#ID:

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.

Defined in:

Group

Return value:

#number:

Returns the group's name.

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

Defined in:

Group

Return value:

#string:

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.

Defined in:

Group

Return value:

#number:

Returns the unit with number unitNumber.

If the unit is not exists the function will return nil.

Defined in:

Group

Parameter:

#number unitNumber

Return value:

Returns array of the units present in the group now.

Destroyed units will not be enlisted at all.

Defined in:

Group

Return value:

#list<#Unit>:

array of Units

returns true if the group exist or false otherwise.

Defined in:

Group

Return value:

#boolean:

Enum contains identifiers of group types.

Field(s)

Function(s)

DCS Class Object

Field(s)

Function(s)

Defined in:

Object

Defined in:

Object

Return value:

Returns object descriptor.

Defined in:

Object

Return value:

Returns name of the object.

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

Defined in:

Object

Return value:

#string:

Returns object coordinates for current time.

Defined in:

Object

Return value:

Returns object position for current time.

Defined in:

Object

Return value:

Returns type name of the Object.

Defined in:

Object

Return value:

#string:

Returns the unit's velocity vector.

Defined in:

Object

Return value:

Returns true if the object belongs to the category.

Defined in:

Object

Parameter:

#AttributeName attributeName

Attribute name to check.

Return value:

#boolean:

Returns true if the unit is in air.

Defined in:

Object

Return value:

#boolean:

Defined in:

Object

Return value:

#boolean:

DCS Enum Object.Category

Field(s)

Function(s)

Field(s)

#Box3 Object.Desc.box

bounding box of collision geometry

#number Object.Desc.life

initial life level

Function(s)

Position is a composite structure.

It consists of both coordinate vector and orientation matrix. Position3 (also known as "Pos3" for short) is a table that has following format:

Field(s)

Function(s)

A task descriptor (internal structure for DCS World).

See https://wiki.hoggitworld.com/view/Category:Tasks. In MOOSE, these tasks can be accessed via Wrapper.Controllable#CONTROLLABLE.

Field(s)

#string Task.id

Function(s)

Field(s)

#list<#Unit.AmmoItem> Unit.Ammo

Function(s)

Returns the unit ammunition.

Defined in:

Unit

Return value:

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.

Defined in:

Unit

Parameter:

#string name

Return value:

Returns the unit's callsign - the localized string.

Defined in:

Unit

Return value:

#string:

Returns controller of the unit if it exist and nil otherwise

Defined in:

Unit

Return value:

Returns unit descriptor.

Descriptor type depends on unit category.

Defined in:

Unit

Return value:

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.

Defined in:

Unit

Return value:

#number:

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

Defined in:

Unit

Return value:

returns the unit's unique identifier.

Defined in:

Unit

Return value:

Returns the unit's health.

Dead units has health <= 1.0

Defined in:

Unit

Return value:

#number:

returns the unit's initial health.

Defined in:

Unit

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.

Defined in:

Unit

Return value:

#number:

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

Defined in:

Unit

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.

Defined in:

Unit

Return value:

Returns the unit sensors.

Defined in:

Unit

Return value:

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.

Defined in:

Unit

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.

Defined in:

Unit

Return value:

#boolean:

ammunition item: "type-count" pair.

Field(s)

#number Unit.AmmoItem.count

ammunition count

#Weapon.Desc Unit.AmmoItem.desc

ammunition descriptor

Function(s)

Enum that stores unit categories.

Field(s)

Function(s)

A unit descriptor.

Field(s)

#Mass Unit.Desc.massEmpty

mass of empty unit

#number Unit.Desc.speedMax

istance / Time, --maximal velocity

Function(s)

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)

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)

A helicopter descriptor.

Field(s)

Function(s)

A vehicle descriptor.

Field(s)

#boolean Unit.DescVehicle.riverCrossing

can the vehicle cross a rivers

Function(s)

An IRST.

Field(s)

#Distance Unit.IRST.detectionDistanceAfterburner

..., engines are in afterburner mode

#Distance Unit.IRST.detectionDistanceIdle

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

#Distance Unit.IRST.detectionDistanceMaximal

..., engines are in maximal mode

Function(s)

An optic sensor.

Field(s)

Function(s)

Enum that stores types of optic sensors.

Field(s)

Function(s)

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)

Enum that stores radar types.

Field(s)

Function(s)

Enum that stores aircraft refueling system types.

Field(s)

Function(s)

A unit sensor.

Field(s)

Function(s)

Enum that stores sensor types.

Field(s)

Function(s)

Vec2 is a 2D-vector for the ground plane as a reference plane.

Field(s)

#Distance Vec2.x

Vec2.x = Vec3.x

#Distance Vec2.y

Vec2.y = Vec3.z

Function(s)

Vec3 type is a 3D-vector.

DCS world has 3-dimensional coordinate system. DCS ground is an infinite plain.

Field(s)

#Distance Vec3.x

is directed to the north

#Distance Vec3.y

is directed up

#Distance Vec3.z

is directed to the east

Function(s)

DCS Class Weapon

Field(s)

#Weapon.Category Weapon.Category

enum that stores weapon categories.

#Weapon.Desc Weapon.Desc

The descriptor of a weapon.

#Weapon.GuidanceType Weapon.GuidanceType

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

#Weapon.MissileCategory Weapon.MissileCategory

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

#Weapon.WarheadType Weapon.WarheadType

enum that stores warhead types.

#Weapon.flag Weapon.flag

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

Function(s)

returns weapon descriptor.

Descriptor type depends on weapon category.

Defined in:

Weapon

Return value:

Returns the unit that launched the weapon.

Defined in:

Weapon

Return value:

returns target of the guided weapon.

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

Defined in:

Weapon

Return value:

Weapon.Category enum that stores weapon categories.

Field(s)

Function(s)

Weapon.GuidanceType enum that stores guidance methods.

Available only for guided weapon (Weapon.Category.MISSILE and some Weapon.Category.BOMB).

Field(s)

Function(s)

Weapon.MissileCategory enum that stores missile category.

Available only for missiles (Weapon.Category.MISSILE).

Field(s)

Function(s)

Weapon.WarheadType enum that stores warhead types.

Field(s)

Function(s)

enum stores weapon flags.

Some of them are combination of another flags.

Field(s)

Function(s)

Field(s)

#number Zone.radius

Function(s)

DCS Enum coalition

Field(s)

Function(s)

Defined in:

coalition

Parameter:

#number countryId

Return value:

#number:

coalitionId

DCS Enum coalition.side

Field(s)

Function(s)

DCS Enum country

Field(s)

Function(s)

DCS enumerator country

Field(s)

Function(s)

DCS Singleton env

Field(s)

Function(s)

Add message to simulator log with caption "ERROR".

Message box is optional.

Defined in:

env

Parameters:

#string message

message string to add to log.

#boolean showMessageBox

If the parameter is true Message Box will appear. Optional.

Add message to simulator log with caption "INFO".

Message box is optional.

Defined in:

env

Parameters:

#string message

message string to add to log.

#boolean showMessageBox

If the parameter is true Message Box will appear. Optional.

Enables/disables appearance of message box each time lua error occurs.

Defined in:

env

Parameter:

#boolean on

if true message box appearance is enabled.

Add message to simulator log with caption "WARNING".

Message box is optional.

Defined in:

env

Parameters:

#string message

message string to add to log.

#boolean showMessageBox

If the parameter is true Message Box will appear. Optional.

DCS Singleton land

Field(s)

Function(s)

Returns altitude MSL of the point.

Defined in:

land

Parameter:

#Vec2 point

point on the ground.

Return value:

returns surface type at the given point.

Defined in:

land

Parameter:

#Vec2 point

Point on the land.

Return value:

Type of surface enumerator

Field(s)

Function(s)

DCS Singleton timer

Field(s)

Function(s)

Returns mission time in seconds.

Defined in:

timer

Return value:

Returns model time in seconds.

Defined in:

timer

Return value:

Returns mission start time in seconds.

Defined in:

timer

Return value:

Removes the function from schedule.

Defined in:

timer

Parameter:

functionId

Function identifier to remove from schedule

Schedules function to call at desired model time.

Time function FunctionToCall(any argument, Time time)

...

return ...

end

Must return model time of next call or nil. Note that the DCS scheduler calls the function in protected mode and any Lua errors in the called function will be trapped and not reported. If the function triggers a Lua error then it will be terminated and not scheduled to run again.

Defined in:

timer

Parameters:

#FunctionToCall functionToCall

Lua-function to call. Must have prototype of FunctionToCall.

functionArgument

Function argument of any type to pass to functionToCall.

#Time time

Model time of the function call.

Return value:

functionId

Re-schedules function to call at another model time.

Defined in:

timer

Parameters:

functionId

Lua-function to call. Must have prototype of FunctionToCall.

#Time time

Model time of the function call.

DCS Enum world

Field(s)

#world.BirthPlace world.BirthPlace

The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.

#world.VolumeType world.VolumeType

The volumeType enumerator defines the types of 3d geometery used within the world.searchObjects function.

Function(s)

Adds a function as an event handler that executes whenever a simulator event occurs.

See hoggit.

Defined in:

world

Parameter:

#table handler

Event handler table.

Returns a table of mark panels indexed numerically that are present within the mission.

See hoggit

Defined in:

world

Return value:

#table:

Table of marks.

Returns a table of the single unit object in the game who's skill level is set as "Player".

See hoggit. There is only a single player unit in a mission and in single player the user will always spawn into this unit automatically unless other client or Combined Arms slots are available.

Defined in:

world

Return value:

Removes the specified event handler from handling events.

Defined in:

world

Parameter:

#table handler

Event handler table.

Searches a defined volume of 3d space for the specified objects within it and then can run function on each returned object.

See hoggit.

Defined in:

world

Parameters:

DCS#Object.Category objectcategory

Category (can be a table) of objects to search.

Shape of the search area/volume.

ObjectSeachHandler

handler A function that handles the search.

#table any

Additional data.

Return value:

The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.

Field(s)

Function(s)

The volumeType enumerator defines the types of 3d geometery used within the #world.searchObjects function.

Field(s)

Function(s)