Module Static

Wrapper -- STATIC wraps the DCS StaticObject class.


Author: FlightControl

Contributions:


Global(s)

STATIC

STATIC class, extends Positionable#POSITIONABLE

Statics are Static Units defined within the Mission Editor.

Type STATIC

STATIC:Find(DCSStatic)

Finds a STATIC from the _DATABASE using a DCSStatic object.

STATIC:FindByName(StaticName, RaiseError)

Finds a STATIC from the _DATABASE using the relevant Static Name.

STATIC:GetDCSObject()
STATIC:GetThreatLevel()
STATIC:GetUnits()

Returns a list of one Static.

STATIC:ReSpawn()

Respawn the Unit at the same location with the same properties.

STATIC:ReSpawnAt(Coordinate, Heading)

Respawn the Unit at a defined Coordinate with an optional heading.

STATIC:Register(StaticName)
STATIC:SpawnAt(Coordinate, Heading)

Respawn the Unit using a (tweaked) template of the parent Group.

STATIC.StaticName

Global(s)

#STATIC STATIC

STATIC class, extends Positionable#POSITIONABLE

Statics are Static Units defined within the Mission Editor.

Note that Statics are almost the same as Units, but they don't have a controller. The Static#STATIC class is a wrapper class to handle the DCS Static objects:

  • Wraps the DCS Static objects.
  • Support all DCS Static APIs.
  • Enhance with Static specific APIs not in the DCS API set.

STATIC reference methods

For each DCS Static will have a STATIC wrapper object (instance) within the _DATABASE object. This is done at the beginning of the mission (when the mission starts).

The STATIC class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference using the Static Name.

Another thing to know is that STATIC objects do not "contain" the DCS Static object. The STATIc methods will reference the DCS Static object by name when it is needed during API execution. If the DCS Static object does not exist or is nil, the STATIC methods will return nil and log an exception in the DCS.log file.

The STATIc class provides the following functions to retrieve quickly the relevant STATIC instance:

  • STATIC.FindByName(): Find a STATIC instance from the _DATABASE object using a DCS Static name.

IMPORTANT: ONE SHOULD NEVER SANATIZE these STATIC OBJECT REFERENCES! (make the STATIC object references nil).

Type Static

Type STATIC

Extends Wrapper.Positionable#POSITIONABLE

Field(s)

STATIC:Find(DCSStatic)

Finds a STATIC from the _DATABASE using a DCSStatic object.

Parameter

Return value

#STATIC: self

STATIC:FindByName(StaticName, RaiseError)

Finds a STATIC from the _DATABASE using the relevant Static Name.

As an optional parameter, a briefing text can be given also.

Parameters

  • #string StaticName : Name of the DCS Static as defined within the Mission Editor.

  • #boolean RaiseError : Raise an error if not found.

Return value

#STATIC:

STATIC:GetDCSObject()
STATIC:GetThreatLevel()
STATIC:GetUnits()

Returns a list of one Static.

Return value

#list<Wrapper.Static#STATIC>: A list of one Static.

STATIC:ReSpawn()

Respawn the Unit at the same location with the same properties.

This is useful to respawn a cargo after it has been destroyed.

STATIC:ReSpawnAt(Coordinate, Heading)

Respawn the Unit at a defined Coordinate with an optional heading.

Parameters

  • Core.Point#COORDINATE Coordinate : The coordinate where to spawn the new Static.

  • #number Heading : The heading of the unit respawn.

STATIC:Register(StaticName)

Parameter

  • StaticName :

STATIC:SpawnAt(Coordinate, Heading)

Respawn the Unit using a (tweaked) template of the parent Group.

Parameters

  • Core.Point#COORDINATE Coordinate : The coordinate where to spawn the new Static.

  • #number Heading : The heading of the unit respawn.

STATIC.StaticName

Type UNIT