Banner Image

Module Wrapper.Group

Wrapper - GROUP wraps the DCS Class Group objects.


The #GROUP class is a wrapper class to handle the DCS Group objects.

Features:

  • Support all DCS Group APIs.
  • Enhance with Group specific APIs not in the DCS Group API set.
  • Handle local Group Controller.
  • Manage the "state" of the DCS Group.

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


For each DCS Group object alive within a running mission, a GROUP wrapper object (instance) will be created within the global _DATABASE object (an instance of Core.Database#DATABASE). This is done at the beginning of the mission (when the mission starts), and dynamically when new DCS Group objects are spawned (using the Core.Spawn class).

The GROUP class does not contain a :New() method, rather it provides :Find() methods to retrieve the object reference using the DCS Group or the DCS GroupName.

The GROUP methods will reference the DCS Group object by name when it is needed during API execution. If the DCS Group object does not exist or is nil, the GROUP methods will return nil and may log an exception in the DCS.log file.


Author: FlightControl

Contributions:

  • Entropy, Afinegan: Came up with the requirement for AIOnOff().

Global(s)

Global GROUP

Wrapper class of the DCS world Group object.

#GROUP GROUP

Wrapper class of the DCS world Group object.

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

1. Tasking of groups

A GROUP is derived from the wrapper class CONTROLLABLE (Wrapper.Controllable#CONTROLLABLE). See the Wrapper.Controllable task methods section for a description of the task methods.

But here is an example how a group can be assigned a task.

This test demonstrates the use(s) of the SwitchWayPoint method of the GROUP class.

First we look up the objects. We create a GROUP object HeliGroup, using the #GROUP() method, looking up the "Helicopter" group object. Same for the "AttackGroup".

     local HeliGroup = GROUP:FindByName( "Helicopter" )
     local AttackGroup = GROUP:FindByName( "AttackGroup" )

Now we retrieve the Wrapper.Unit#UNIT objects of the AttackGroup object, using the method :GetUnits().

     local AttackUnits = AttackGroup:GetUnits()

Tasks are actually text strings that we build using methods of GROUP. So first, we declare an list of Tasks.

     local Tasks = {}

Now we loop over the AttackUnits using a for loop. We retrieve the AttackUnit using the AttackGroup:GetUnit() method. Each AttackUnit found, will be attacked by HeliGroup, using the method HeliGroup:TaskAttackUnit(). This method returns a string containing a command line to execute the task to the HeliGroup. The code will assign the task string command to the next element in the Task list, using Tasks[#Tasks+1]. This little code will take the count of Task using # operator, and will add 1 to the count. This result will be the index of the Task element.

     for i = 1, #AttackUnits do
       local AttackUnit = AttackGroup:GetUnit( i )
       Tasks[#Tasks+1] = HeliGroup:TaskAttackUnit( AttackUnit )
     end

Once these tasks have been executed, a function _Resume will be called ...

     Tasks[#Tasks+1] = HeliGroup:TaskFunction( "_Resume", { "''" } )

     -- @param Wrapper.Group#GROUP HeliGroup
     function _Resume( HeliGroup )
       env.info( '_Resume' )

       HeliGroup:MessageToAll( "Resuming",10,"Info")
     end

Now here is where the task gets assigned! Using HeliGroup:PushTask, the task is pushed onto the task queue of the group HeliGroup. Since Tasks is an array of tasks, we use the HeliGroup:TaskCombo method to execute the tasks. The HeliGroup:PushTask method can receive a delay parameter in seconds. In the example, 30 is given as a delay.

     HeliGroup:PushTask( 
       HeliGroup:TaskCombo(
       Tasks
       ), 30 
     ) 

That's it! But again, please refer to the Wrapper.Controllable task methods section for a description of the different task methods that are available.

Obtain the mission from group templates

Group templates contain complete mission descriptions. Sometimes you want to copy a complete mission from a group and assign it to another:

GROUP Command methods

A GROUP is a Wrapper.Controllable. See the Wrapper.Controllable command methods section for a description of the command methods.

GROUP option methods

A GROUP is a Wrapper.Controllable. See the Wrapper.Controllable option methods section for a description of the option methods.

GROUP Zone validation methods

The group can be validated whether it is completely, partly or not within a Core.Zone. Use the following Zone validation methods on the group:

The zone can be of any Core.Zone class derived from Core.Zone#ZONE_BASE. So, these methods are polymorphic to the zones tested on.

GROUP AI methods

A GROUP has AI methods to control the AI activation.

Global GROUPTEMPLATE

#table GROUPTEMPLATE

Type(s)

Fields and Methods inherited from GROUP Description

GROUP:Activate(delay)

Activates a late activated GROUP.

GROUP:AllOnGround()

Returns if all units of the group are on the ground or landed.

GROUP.Attribute

GROUP:CalculateThreatLevelA2G()

Calculate the maxium A2G threat level of the Group.

GROUP:CopyRoute(Begin, End, Randomize, Radius)

Return the route of a group by using the global _DATABASE object (an instance of Core.Database#DATABASE).

GROUP:CountAliveUnits()

Count number of alive units in the group.

GROUP:CountInZone(Zone)

Returns the number of UNITs that are in the Core.Zone

GROUP:Destroy(GenerateEvent, delay)

Destroys the DCS Group and all of its DCS Units.

GROUP:EnableEmission(switch)

GROUND - Switch on/off radar emissions for the group.

GROUP:Find(DCSGroup)

Find the GROUP wrapper class instance using the DCS Group.

GROUP:FindByName(GroupName)

Find the created GROUP using the DCS Group Name.

GROUP:GetAltitude(FromGround)

Returns the average group altitude in meters.

GROUP:GetAmmunition()

Get the number of shells, rockets, bombs and missiles the whole group currently has.

GROUP:GetAttribute()

Get the generalized attribute of a self.

GROUP:GetAverageCoordinate()

Returns a COORDINATE object indicating the average position of the GROUP within the mission.

GROUP:GetAverageVec3()

Returns the average Vec3 vector of the Units in the GROUP.

GROUP:GetCallsign()

Gets the CallSign of the first DCS Unit of the DCS Group.

GROUP:GetCategory()

Returns category of the DCS Group.

GROUP:GetCategoryName()

Returns the category name of the #GROUP.

GROUP:GetCoalition()

Returns the coalition of the DCS Group.

GROUP:GetCoordinate()

Returns a COORDINATE object indicating the point of the first UNIT of the GROUP within the mission.

GROUP:GetCountry()

Returns the country of the DCS Group.

GROUP:GetCustomCallSign(ShortCallsign, Keepnumber, CallsignTranslations)

GROUP:GetDCSDesc(n)

Returns the DCS descriptor table of the nth unit of the group.

GROUP:GetDCSObject()

Returns the DCS Group.

GROUP:GetDCSUnit(UnitNumber)

Returns the DCS Unit with number UnitNumber.

GROUP:GetDCSUnits()

Returns the DCS Units of the DCS Group.

GROUP:GetFirstUnit()

Get the first unit of the group.

GROUP:GetFirstUnitAlive()

Get the first unit of the group which is alive.

GROUP:GetFuel()

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

GROUP:GetFuelAvg()

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

GROUP:GetFuelMin()

Return the fuel state and unit reference for the unit with the least amount of fuel in the group.

GROUP:GetHeading()

Returns the mean heading of every UNIT in the GROUP in degrees

GROUP:GetHeight(FromGround)

Returns the average group height in meters.

GROUP:GetHighestThreat()

Get the unit in the group with the highest threat level, which is still alive.

GROUP:GetInitialSize()

  • Returns the initial size of the DCS Group.

GROUP:GetMaxHeight()

Returns the current maximum height of the group, i.e.

GROUP:GetMaxVelocity()

Returns the current maximum velocity of the group.

GROUP:GetMinHeight()

Returns the current minimum height of the group.

GROUP:GetNatoReportingName()

[AIRPLANE] Get the NATO reporting name (platform, e.g.

GROUP:GetPlayerCount()

Get the active player count in the group.

GROUP:GetPlayerName()

Gets the player name of the group.

GROUP:GetPlayerNames()

Get player names

GROUP:GetPlayerUnits()

Returns a list of Wrapper.Unit objects of the Wrapper.Group that are occupied by a player.

GROUP:GetPointVec2()

Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.

GROUP:GetPositionVec3()

Returns the DCS#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.

GROUP:GetRandomVec3(Radius)

Returns a random DCS#Vec3 vector (point in 3D of the UNIT within the mission) within a range around the first UNIT of the GROUP.

GROUP:GetRange()

Returns the maximum range of the group.

GROUP:GetSize()

Returns current size of the DCS Group.

GROUP:GetSkill()

Get skill from Group.

GROUP:GetSpeedMax()

Returns the maximum speed of the group.

GROUP:GetTaskMission()

Return the mission template of the group.

GROUP:GetTaskRoute()

Return the mission route of the group.

GROUP:GetTemplate()

Returns the group template from the global _DATABASE object (an instance of Core.Database#DATABASE).

GROUP:GetTemplateRoutePoints()

Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of Core.Database#DATABASE).

GROUP:GetThreatLevel()

Get threat level of the group.

GROUP:GetTypeName()

Gets the type name of the group.

GROUP:GetUnit(UnitNumber)

Returns the UNIT wrapper object with number UnitNumber.

GROUP:GetUnits()

Returns a list of Wrapper.Unit objects of the Wrapper.Group.

GROUP:GetVec2()

Returns the current point (Vec2 vector) of the first DCS Unit in the DCS Group.

GROUP:GetVec3()

Returns the current Vec3 vector of the first Unit in the GROUP.

GROUP:GetVelocityVec3()

Returns the average velocity Vec3 vector.

GROUP.GroupName

GROUP:HandleEvent(Event, EventFunction, ...)

Subscribe to a DCS Event.

GROUP:HasAttribute(attribute, all)

Check if at least one (or all) unit(s) has (have) a certain attribute.

GROUP:InAir()

Returns true if the first unit of the GROUP is in the air.

GROUP.InitCoord

GROUP:InitCoordinate(coordinate)

Set respawn coordinate.

GROUP:InitHeading(Heading)

Set the heading for the units in degrees within the respawned group.

GROUP:InitHeight(Height)

Set the height for the units in meters for the respawned group.

GROUP:InitModex(modex)

Sets the modex (tail number) of the first unit of the group.

GROUP:InitRadioCommsOnOff(switch)

Sets the radio comms on or off when the group is respawned.

GROUP:InitRadioFrequency(frequency)

Sets the radio frequency of the group when it is respawned.

GROUP:InitRadioModulation(modulation)

Set radio modulation when the group is respawned.

GROUP:InitRandomizePositionRadius(OuterRadius, InnerRadius)

Randomize the positions of the units of the respawned group in a circle band.

GROUP:InitRandomizePositionZone(PositionZone)

Randomize the positions of the units of the respawned group within the Core.Zone.

GROUP.InitRespawnFreq

GROUP.InitRespawnHeading

GROUP.InitRespawnHeight

GROUP.InitRespawnModex

GROUP.InitRespawnModu

GROUP.InitRespawnRadio

GROUP.InitRespawnRandomizePositionInner

GROUP.InitRespawnRandomizePositionOuter

GROUP.InitRespawnRandomizePositionZone

GROUP.InitRespawnZone

GROUP:InitZone(Zone)

Set the respawn Core.Zone for the respawned group.

GROUP:IsActive()

Returns if the group is activated.

GROUP:IsAir()

Returns if the group is of an air category.

GROUP:IsAirPlane()

Returns if the DCS Group contains AirPlanes.

GROUP:IsAirborne(AllUnits)

Checks whether any unit (or optionally) all units of a group is(are) airbore or not.

GROUP:IsAlive()

Returns if the group is alive.

GROUP:IsAnyInZone(Zone)

Returns true if any units of the group are within a Core.Zone.

GROUP:IsCompletelyInZone(Zone)

Returns true if all units of the group are within a Core.Zone.

GROUP:IsGround()

Returns if the DCS Group contains Ground troops.

GROUP:IsHelicopter()

Returns if the DCS Group contains Helicopters.

GROUP:IsInZone(Zone)

Check if any unit of a group is inside a Core.Zone.

GROUP:IsNotInZone(Zone)

Returns true if none of the group units of the group are within a Core.Zone.

GROUP:IsPartlyInZone(Zone)

Returns true if some but NOT ALL units of the group are within a Core.Zone.

GROUP:IsPartlyOrCompletelyInZone(Zone)

Returns true if part or all units of the group are within a Core.Zone.

GROUP:IsPlayer()

Check if an (air) group is a client or player slot.

GROUP:IsShip()

Returns if the DCS Group contains Ships.

GROUP:NewTemplate(GroupTemplate, CoalitionSide, CategoryID, CountryID)

Create a new GROUP from a given GroupTemplate as a parameter.

GROUP:OnReSpawn(ReSpawnFunction)

GROUP:Register(GroupName)

Create a new GROUP from an existing Group in the Mission.

GROUP:ResetEvents()

Reset the subscriptions.

GROUP:Respawn(Template, Reset)

Respawn the Wrapper.Group at a Point.

GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled)

Respawn a group at an airbase.

GROUP:RouteRTB(RTBAirbase, Speed)

(AIR) Return the Group to an Wrapper.Airbase#AIRBASE.

GROUP:SetAIOff()

Turns the AI Off for the GROUP.

GROUP:SetAIOn()

Turns the AI On for the GROUP.

GROUP:SetAIOnOff(AIOnOff)

Turns the AI On or Off for the GROUP.

GROUP:SetAsRecoveryTanker(CarrierGroup, Speed, ToKIAS, Altitude, Delay, LastWaypoint)

GROUP:SetCommandImmortal(switch)

Switch on/off immortal flag for the group.

GROUP:SetCommandInvisible(switch)

Switch on/off invisible flag for the group.

GROUP:SetTemplateCoalition(CoalitionID, Template)

Sets the CoalitionID of the group in a Template.

GROUP:SetTemplateControlled(Controlled, Template)

Sets the controlled status in a Template.

GROUP:SetTemplateCountry(CountryID, Template)

Sets the CountryID of the group in a Template.

GROUP.Takeoff

GROUP:UnHandleEvent(Event)

UnSubscribe to a DCS event.

Fields and Methods inherited from GROUP.Attribute Description

GROUP.Attribute.AIR_ATTACKHELO

Attack helicopter.

GROUP.Attribute.AIR_AWACS

Airborne Early Warning and Control System.

GROUP.Attribute.AIR_BOMBER

Aircraft which can be used for strategic bombing.

GROUP.Attribute.AIR_FIGHTER

Fighter, interceptor, ... airplane.

GROUP.Attribute.AIR_OTHER

Any airborne unit that does not fall into any other airborne category.

GROUP.Attribute.AIR_TANKER

Airplane which can refuel other aircraft.

GROUP.Attribute.AIR_TRANSPORTHELO

Helicopter with transport capability. This can be used to transport other assets.

GROUP.Attribute.AIR_TRANSPORTPLANE

Airplane with transport capability. This can be used to transport other assets.

GROUP.Attribute.AIR_UAV

Unpiloted Aerial Vehicle, e.g. drones.

GROUP.Attribute.GROUND_AAA

Anti-Aircraft Artillery.

GROUP.Attribute.GROUND_APC

Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets.

GROUP.Attribute.GROUND_ARTILLERY

Artillery assets.

GROUP.Attribute.GROUND_EWR

Early Warning Radar.

GROUP.Attribute.GROUND_IFV

Ground Infantry Fighting Vehicle.

GROUP.Attribute.GROUND_INFANTRY

Ground infantry assets.

GROUP.Attribute.GROUND_OTHER

Any ground unit that does not fall into any other ground category.

GROUP.Attribute.GROUND_SAM

Surface-to-Air Missile system or components.

GROUP.Attribute.GROUND_TANK

Tanks (modern or old).

GROUP.Attribute.GROUND_TRAIN

Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently.

GROUP.Attribute.GROUND_TRUCK

Unarmed ground vehicles, which has the DCS "Truck" attribute.

GROUP.Attribute.NAVAL_AIRCRAFTCARRIER

Aircraft carrier.

GROUP.Attribute.NAVAL_ARMEDSHIP

Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette.

GROUP.Attribute.NAVAL_OTHER

Any naval unit that does not fall into any other naval category.

GROUP.Attribute.NAVAL_UNARMEDSHIP

Any unarmed naval vessel.

GROUP.Attribute.NAVAL_WARSHIP

War ship, i.e. cruisers, destroyers, firgates and corvettes.

GROUP.Attribute.OTHER_UNKNOWN

Anything that does not fall into any other category.

Fields and Methods inherited from GROUP.Takeoff Description

GROUP.Takeoff.Air

GROUP.Takeoff.Cold

GROUP.Takeoff.Hot

GROUP.Takeoff.Runway

Field(s)

Function(s)

Activates a late activated GROUP.

Defined in:

GROUP

Parameter:

#number delay

Delay in seconds, before the group is activated.

Return value:

self

Returns if all units of the group are on the ground or landed.

If all units of this group are on the ground, this function will return true, otherwise false.

Defined in:

GROUP

Return value:

#boolean:

All units on the ground result.

Calculate the maxium A2G threat level of the Group.

Defined in:

GROUP

Return value:

#number:

Number between 0 and 10.

Return the route of a group by using the global _DATABASE object (an instance of Core.Database#DATABASE).

Defined in:

GROUP

Parameters:

#number Begin

The route point from where the copy will start. The base route point is 0.

#number End

The route point where the copy will end. The End point is the last point - the End point. The last point has base 0.

#boolean Randomize

Randomization of the route, when true.

#number Radius

When randomization is on, the randomization is within the radius.

Count number of alive units in the group.

Defined in:

GROUP

Return value:

#number:

Number of alive units. If DCS group is nil, 0 is returned.

Returns the number of UNITs that are in the Core.Zone

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#number:

The number of UNITs that are in the Core.Zone

Destroys the DCS Group and all of its DCS Units.

Note that this destroy method also can raise a destroy event at run-time. So all event listeners will catch the destroy event of this group for each unit in the group. To raise these events, provide the GenerateEvent parameter.

Defined in:

GROUP

Parameters:

#boolean GenerateEvent

If true, a crash [AIR] or dead [GROUND] event for each unit is generated. If false, if no event is triggered. If nil, a RemoveUnit event is triggered.

#number delay

Delay in seconds before despawning the group.

Usages:

  • -- Air unit example: destroy the Helicopter and generate a S_EVENT_CRASH for each unit in the Helicopter group.
    Helicopter = GROUP:FindByName( "Helicopter" )
    Helicopter:Destroy( true )
  • -- Ground unit example: destroy the Tanks and generate a S_EVENT_DEAD for each unit in the Tanks group.
    Tanks = GROUP:FindByName( "Tanks" )
    Tanks:Destroy( true )
  • -- Ship unit example: destroy the Ship silently.
    Ship = GROUP:FindByName( "Ship" )
    Ship:Destroy()
    
  • -- Destroy without event generation example.
    Ship = GROUP:FindByName( "Boat" )
    Ship:Destroy( false ) -- Don't generate an event upon destruction.
    

GROUND - Switch on/off radar emissions for the group.

Defined in:

GROUP

Parameter:

#boolean switch

If true, emission is enabled. If false, emission is disabled.

Return value:

self

Find the GROUP wrapper class instance using the DCS Group.

Defined in:

GROUP

Parameter:

DCS#Group DCSGroup

The DCS Group.

Return value:

The GROUP.

Find the created GROUP using the DCS Group Name.

Defined in:

GROUP

Parameter:

#string GroupName

The DCS Group Name.

Return value:

The GROUP.

Returns the average group altitude in meters.

Defined in:

GROUP

Parameter:

#boolean FromGround

Measure from the ground or from sea level (ASL). Provide true for measuring from the ground (AGL). false or nil if you measure from sea level.

Return value:

#number:

The altitude of the group or nil if is not existing or alive.

Get the number of shells, rockets, bombs and missiles the whole group currently has.

Defined in:

GROUP

Return values:

#number:

Total amount of ammo the group has left. This is the sum of shells, rockets, bombs and missiles of all units.

#number:

Number of shells left.

#number:

Number of rockets left.

#number:

Number of bombs left.

#number:

Number of missiles left.

#number:

Number of artillery shells left (with explosive mass, included in shells; shells can also be machine gun ammo)

Get the generalized attribute of a self.

Note that for a heterogenious self, the attribute is determined from the attribute of the first unit!

Defined in:

GROUP

Return value:

#string:

Generalized attribute of the self.

Returns a COORDINATE object indicating the average position of the GROUP within the mission.

Defined in:

GROUP

Return value:

The COORDINATE of the GROUP.

Returns the average Vec3 vector of the Units in the GROUP.

Defined in:

GROUP

Return value:

Current Vec3 of the GROUP or nil if cannot be found.

Gets the CallSign of the first DCS Unit of the DCS Group.

Defined in:

GROUP

Return value:

#string:

The CallSign of the first DCS Unit of the DCS Group.

Returns category of the DCS Group.

Returns one of

  • Group.Category.AIRPLANE
  • Group.Category.HELICOPTER
  • Group.Category.GROUND
  • Group.Category.SHIP
  • Group.Category.TRAIN

Defined in:

GROUP

Return value:

The category ID.

Returns the category name of the #GROUP.

Defined in:

GROUP

Return value:

#string:

Category name = Helicopter, Airplane, Ground Unit, Ship, Train.

Returns the coalition of the DCS Group.

Defined in:

GROUP

Return value:

The coalition side of the DCS Group.

Returns a COORDINATE object indicating the point of the first UNIT of the GROUP within the mission.

Defined in:

GROUP

Return value:

The COORDINATE of the GROUP.

Returns the country of the DCS Group.

Defined in:

GROUP

Return value:

The country identifier or nil if the DCS Group is not existing or alive.

Defined in:

GROUP

Parameters:

ShortCallsign

Keepnumber

CallsignTranslations

Returns the DCS descriptor table of the nth unit of the group.

Defined in:

GROUP

Parameter:

#number n

(Optional) The number of the unit for which the dscriptor is returned.

Return value:

The descriptor of the first unit of the group or #nil if the group does not exist any more.

Returns the DCS Group.

Defined in:

GROUP

Return value:

The DCS Group.

Returns the DCS Unit with number UnitNumber.

If the underlying DCS Unit does not exist, the method will return try to find the next unit. Returns nil if no units are found.

Defined in:

GROUP

Parameter:

#number UnitNumber

The number of the DCS Unit to be returned.

Return value:

The DCS Unit.

Returns the DCS Units of the DCS Group.

Defined in:

GROUP

Return value:

#table:

The DCS Units.

Get the first unit of the group.

Might be nil!

Defined in:

GROUP

Return value:

First unit or nil if it does not exist.

Get the first unit of the group which is alive.

Defined in:

GROUP

Return value:

First unit alive.

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

If there are additional fuel tanks the value may be greater than 1.0.

Defined in:

GROUP

Return values:

#number:

The relative amount of fuel (from 0.0 to 1.0).

#nil:

The GROUP is not existing or alive.

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

If there are additional fuel tanks the value may be greater than 1.0.

Defined in:

GROUP

Return values:

#number:

The relative amount of fuel (from 0.0 to 1.0).

#nil:

The GROUP is not existing or alive.

Return the fuel state and unit reference for the unit with the least amount of fuel in the group.

Defined in:

GROUP

Return values:

#number:

The fuel state of the unit with the least amount of fuel.

reference to #Unit object for further processing.

Returns the mean heading of every UNIT in the GROUP in degrees

Defined in:

GROUP

Return value:

#number:

Mean heading of the GROUP in degrees or #nil The first UNIT is not existing or alive.

Returns the average group height in meters.

Defined in:

GROUP

Parameter:

#boolean FromGround

Measure from the ground or from sea level (ASL). Provide true for measuring from the ground (AGL). false or nil if you measure from sea level.

Return value:

#number:

The height of the group or nil if is not existing or alive.

Get the unit in the group with the highest threat level, which is still alive.

Defined in:

GROUP

Return values:

The most dangerous unit in the group.

#number:

Threat level of the unit.

  • Returns the initial size of the DCS Group.

If some of the DCS Units of the DCS Group are destroyed, the initial size of the DCS Group is unchanged.

Defined in:

GROUP

Return value:

#number:

The DCS Group initial size.

Returns the current maximum height of the group, i.e.

the highest unit height of that group. Each unit within the group gets evaluated, and the maximum height (= the unit which is the highest elevated) is returned.

Defined in:

GROUP

Return value:

#number:

Maximum height found.

Returns the current maximum velocity of the group.

Each unit within the group gets evaluated, and the maximum velocity (= the unit which is going the fastest) is returned.

Defined in:

GROUP

Return value:

#number:

Maximum velocity found.

Returns the current minimum height of the group.

Each unit within the group gets evaluated, and the minimum height (= the unit which is the lowest elevated) is returned.

Defined in:

GROUP

Return value:

#number:

Minimum height found.

[AIRPLANE] Get the NATO reporting name (platform, e.g.

"Flanker") of a GROUP (note - first unit the group). "Bogey" if not found. Currently airplanes only!

Defined in:

GROUP

Return value:

#string:

NatoReportingName or "Bogey" if unknown.

Get the active player count in the group.

Defined in:

GROUP

Return value:

#number:

The amount of players.

Gets the player name of the group.

Defined in:

GROUP

Return value:

#string:

The player name of the group.

Get player names

Defined in:

GROUP

Return values:

#table:

The group has players, an array of player names is returned.

#nil:

The group has no players

Returns a list of Wrapper.Unit objects of the Wrapper.Group that are occupied by a player.

Defined in:

GROUP

Return value:

#list<Wrapper.Unit#UNIT>:

The list of player occupied Wrapper.Unit objects of the Wrapper.Group.

Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission.

Defined in:

GROUP

Return values:

The 2D point vector of the first DCS Unit of the GROUP.

#nil:

The first UNIT is not existing or alive.

Returns the DCS#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission.

Defined in:

GROUP

Return value:

The 3D position vectors of the POSITIONABLE or #nil if the groups not existing or alive.

Returns a random DCS#Vec3 vector (point in 3D of the UNIT within the mission) within a range around the first UNIT of the GROUP.

Defined in:

GROUP

Parameter:

#number Radius

Radius in meters.

Return value:

The random 3D point vector around the first UNIT of the GROUP or #nil The GROUP is invalid or empty.

Usage:


-- If Radius is ignored, returns the DCS#Vec3 of first UNIT of the GROUP

Returns the maximum range of the group.

If the group is heterogenious and consists of different units, the smallest range of all units is returned.

Defined in:

GROUP

Return value:

#number:

Range in meters.

Returns current size of the DCS Group.

If some of the DCS Units of the DCS Group are destroyed the size of the DCS Group is changed.

Defined in:

GROUP

Return value:

#number:

The DCS Group size.

Get skill from Group.

Effectively gets the skill from Unit 1 as the group holds no skill value.

Defined in:

GROUP

Return value:

#string:

Skill String of skill name.

Returns the maximum speed of the group.

If the group is heterogenious and consists of different units, the max speed of the slowest unit is returned.

Defined in:

GROUP

Return value:

#number:

Speed in km/h.

Return the mission template of the group.

Defined in:

GROUP

Return value:

#table:

The MissionTemplate

Return the mission route of the group.

Defined in:

GROUP

Return value:

#table:

The mission route defined by points.

Returns the group template from the global _DATABASE object (an instance of Core.Database#DATABASE).

Defined in:

GROUP

Return value:

#table:

Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of Core.Database#DATABASE).

Defined in:

GROUP

Return value:

#table:

Get threat level of the group.

Defined in:

GROUP

Return value:

#number:

Max threat level (a number between 0 and 10).

Gets the type name of the group.

Defined in:

GROUP

Return value:

#string:

The type name of the group.

Returns the UNIT wrapper object with number UnitNumber.

If it doesn't exist, tries to return the next available unit. If no underlying DCS Units exist, the method will return nil.

Defined in:

GROUP

Parameter:

#number UnitNumber

The number of the UNIT wrapper class to be returned.

Return value:

The UNIT object or nil

Returns a list of Wrapper.Unit objects of the Wrapper.Group.

Defined in:

GROUP

Return value:

#table:

of Wrapper.Unit#UNIT objects, indexed by number.

Returns the current point (Vec2 vector) of the first DCS Unit in the DCS Group.

Defined in:

GROUP

Return value:

Current Vec2 point of the first DCS Unit of the DCS Group.

Returns the current Vec3 vector of the first Unit in the GROUP.

Defined in:

GROUP

Return value:

Current Vec3 of the first Unit of the GROUP or nil if cannot be found.

Returns the average velocity Vec3 vector.

Defined in:

GROUP

Return value:

The velocity Vec3 vector or #nil if the GROUP is not existing or alive.

Subscribe to a DCS Event.

Defined in:

GROUP

Parameters:

#function EventFunction

(optional) The function to be called when the event occurs for the GROUP.

...

Return value:

Check if at least one (or all) unit(s) has (have) a certain attribute.

See hoggit documentation.

Defined in:

GROUP

Parameters:

#string attribute

The name of the attribute the group is supposed to have. Valid attributes can be found in the "db_attributes.lua" file which is located at in "C:\Program Files\Eagle Dynamics\DCS World\Scripts\Database".

#boolean all

If true, all units of the group must have the attribute in order to return true. Default is only one unit of a heterogenious group needs to have the attribute.

Return value:

#boolean:

Group has this attribute.

Returns true if the first unit of the GROUP is in the air.

Defined in:

GROUP

Return value:

#boolean:

true if in the first unit of the group is in the air or #nil if the GROUP is not existing or not alive.

Set respawn coordinate.

Defined in:

GROUP

Parameter:

Coordinate where the group should be respawned.

Return value:

self

Set the heading for the units in degrees within the respawned group.

Defined in:

GROUP

Parameter:

#number Heading

The heading in meters.

Return value:

self

Set the height for the units in meters for the respawned group.

(This is applicable for air units).

Defined in:

GROUP

Parameter:

#number Height

The height in meters.

Return value:

self

Sets the modex (tail number) of the first unit of the group.

If more units are in the group, the number is increased with every unit.

Defined in:

GROUP

Parameter:

#string modex

Tail number of the first unit.

Return value:

self

Sets the radio comms on or off when the group is respawned.

Same as checking/unchecking the COMM box in the mission editor.

Defined in:

GROUP

Parameter:

#boolean switch

If true (or nil), enables the radio comms. If false, disables the radio for the spawned group.

Return value:

self

Sets the radio frequency of the group when it is respawned.

Defined in:

GROUP

Parameter:

#number frequency

The frequency in MHz.

Return value:

self

Set radio modulation when the group is respawned.

Default is AM.

Defined in:

GROUP

Parameter:

#string modulation

Either "FM" or "AM". If no value is given, modulation is set to AM.

Return value:

self

Randomize the positions of the units of the respawned group in a circle band.

When a Respawn happens, the units of the group will be positioned at random places within the Outer and Inner radius. Thus, a band is created around the respawn location where the units will be placed at random positions.

Defined in:

GROUP

Parameters:

#boolean OuterRadius

Outer band in meters from the center.

#boolean InnerRadius

Inner band in meters from the center.

Return value:

self

Randomize the positions of the units of the respawned group within the Core.Zone.

When a Respawn happens, the units of the group will be placed at random positions within the Zone (selected).

Defined in:

GROUP

Parameter:

#boolean PositionZone

true will randomize the positions within the Zone.

Return value:

self

Set the respawn Core.Zone for the respawned group.

Defined in:

GROUP

Parameter:

The zone in meters.

Return value:

self

Returns if the group is activated.

Defined in:

GROUP

Return value:

#boolean:

true if group is activated or #nil The group is not existing or alive.

Returns if the group is of an air category.

If the group is a helicopter or a plane, then this method will return true, otherwise false.

Defined in:

GROUP

Return value:

#boolean:

Air category evaluation result.

Returns if the DCS Group contains AirPlanes.

Defined in:

GROUP

Return value:

#boolean:

true if DCS Group contains AirPlanes.

Checks whether any unit (or optionally) all units of a group is(are) airbore or not.

Defined in:

GROUP

Parameter:

#boolean AllUnits

(Optional) If true, check whether all units of the group are airborne.

Return value:

#boolean:

True if at least one (optionally all) unit(s) is(are) airborne or false otherwise. Nil if no unit exists or is alive.

Returns if the group is alive.

The Group must:

  • Exist at run-time.
  • Has at least one unit.

When the first Wrapper.Unit of the group is active, it will return true. If the first Wrapper.Unit of the group is inactive, it will return false.

Defined in:

GROUP

Return value:

#boolean:

true if the group is alive and active, false if the group is alive but inactive or #nil if the group does not exist anymore.

Returns true if any units of the group are within a Core.Zone.

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#boolean:

Returns true if any unit of the Group is within the Core.Zone#ZONE_BASE

Returns true if all units of the group are within a Core.Zone.

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#boolean:

Returns true if the Group is completely within the Core.Zone#ZONE_BASE

Returns if the DCS Group contains Ground troops.

Defined in:

GROUP

Return value:

#boolean:

true if DCS Group contains Ground troops.

Returns if the DCS Group contains Helicopters.

Defined in:

GROUP

Return value:

#boolean:

true if DCS Group contains Helicopters.

Check if any unit of a group is inside a Core.Zone.

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#boolean:

Returns true if at least one unit is inside the zone or false if no unit is inside.

Returns true if none of the group units of the group are within a Core.Zone.

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#boolean:

Returns true if the Group is not within the Core.Zone#ZONE_BASE

Returns true if some but NOT ALL units of the group are within a Core.Zone.

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#boolean:

Returns true if the Group is partially within the Core.Zone#ZONE_BASE

Returns true if part or all units of the group are within a Core.Zone.

Defined in:

GROUP

Parameter:

The zone to test.

Return value:

#boolean:

Returns true if the Group is partially or completely within the Core.Zone#ZONE_BASE.

Check if an (air) group is a client or player slot.

Information is retrieved from the group template.

Defined in:

GROUP

Return value:

#boolean:

If true, group is associated with a client or player slot.

Returns if the DCS Group contains Ships.

Defined in:

GROUP

Return value:

#boolean:

true if DCS Group contains Ships.

Create a new GROUP from a given GroupTemplate as a parameter.

Note that the GroupTemplate is NOT spawned into the mission. It is merely added to the Core.Database.

Defined in:

GROUP

Parameters:

#table GroupTemplate

The GroupTemplate Structure exactly as defined within the mission editor.

DCS#coalition.side CoalitionSide

The coalition.side of the group.

DCS#Group.Category CategoryID

The Group.Category of the group.

DCS#country.id CountryID

the country.id of the group.

Return value:

self

Defined in:

GROUP

Parameter:

ReSpawnFunction

Create a new GROUP from an existing Group in the Mission.

Defined in:

GROUP

Parameter:

#string GroupName

The Group name

Return value:

self

Reset the subscriptions.

Defined in:

GROUP

Return value:

Respawn the Wrapper.Group at a Point.

The method will setup the new group template according the Init(Respawn) settings provided for the group. These settings can be provided by calling the relevant Init...() methods of the Group.

Notes:

  • When InitZone or InitRandomizeZones is not used, the position of the respawned group will be its current position.
  • The current alive group will always be destroyed and respawned using the template definition.

Defined in:

GROUP

Parameters:

#table Template

(optional) The template of the Group retrieved with GROUP:GetTemplate(). If the template is not provided, the template will be retrieved of the group itself.

#boolean Reset

Reset positions if TRUE.

Return value:

Respawn a group at an airbase.

Note that the group has to be on parking spots at the airbase already in order for this to work. So each unit of the group is respawned at exactly the same parking spot as it currently occupies.

Defined in:

GROUP

Parameters:

#table SpawnTemplate

(Optional) The spawn template for the group. If no template is given it is exacted from the group.

(Optional) Takeoff type. Sould be either SPAWN.Takeoff.Cold or SPAWN.Takeoff.Hot. Default is SPAWN.Takeoff.Hot.

#boolean Uncontrolled

(Optional) If true, spawn in uncontrolled state.

Return value:

Group spawned at airbase or nil if group could not be spawned.

(AIR) Return the Group to an Wrapper.Airbase#AIRBASE.

The following things are to be taken into account:

  • The group is respawned to achieve the RTB, there may be side artefacts as a result of this. (Like weapons suddenly come back).
  • A group consisting out of more than one unit, may rejoin formation when respawned.
  • A speed can be given in km/h. If no speed is specified, the maximum speed of the first unit will be taken to return to base.
  • When there is no Wrapper.Airbase object specified, the group will return to the home base if the route of the group is pinned at take-off or at landing to a base.
  • When there is no Wrapper.Airbase object specified and the group route is not pinned to any airbase, it will return to the nearest airbase.

Defined in:

GROUP

Parameters:

(optional) The Wrapper.Airbase to return to. If blank, the controllable will return to the nearest friendly airbase.

#number Speed

(optional) The Speed, if no Speed is given, 80% of maximum Speed of the group is selected.

Return value:

self

Turns the AI Off for the GROUP.

Defined in:

GROUP

Return value:

The GROUP.

Turns the AI On for the GROUP.

Defined in:

GROUP

Return value:

The GROUP.

Turns the AI On or Off for the GROUP.

Defined in:

GROUP

Parameter:

#boolean AIOnOff

The value true turns the AI On, the value false turns the AI Off.

Return value:

The GROUP.

Defined in:

GROUP

Parameters:

Wrapper.Group#GROUP CarrierGroup

#number Speed

Speed in knots.

#boolean ToKIAS

If true, adjust speed to altitude (KIAS).

#number Altitude

Altitude the tanker orbits at in feet.

#number Delay

(optional) Set the task after this many seconds. Defaults to one.

#number LastWaypoint

(optional) Waypoint number of carrier group that when reached, ends the recovery tanker task.

Return value:

self

Switch on/off immortal flag for the group.

Defined in:

GROUP

Parameter:

#boolean switch

If true, emission is enabled. If false, emission is disabled.

Return value:

self

Switch on/off invisible flag for the group.

Defined in:

GROUP

Parameter:

#boolean switch

If true, emission is enabled. If false, emission is disabled.

Return value:

self

Sets the CoalitionID of the group in a Template.

Defined in:

GROUP

Parameters:

DCS#coalition.side CoalitionID

The coalition ID.

Template

Return value:

#table:

Sets the controlled status in a Template.

Defined in:

GROUP

Parameters:

#boolean Controlled

true is controlled, false is uncontrolled.

Template

Return value:

#table:

Sets the CountryID of the group in a Template.

Defined in:

GROUP

Parameters:

DCS#country.id CountryID

The country ID.

Template

Return value:

#table:

UnSubscribe to a DCS event.

Defined in:

GROUP

Parameter:

Return value:

Generalized group attributes.

See DCS attributes on hoggit.

Field(s)

#string GROUP.Attribute.AIR_ATTACKHELO

Attack helicopter.

#string GROUP.Attribute.AIR_AWACS

Airborne Early Warning and Control System.

#string GROUP.Attribute.AIR_BOMBER

Aircraft which can be used for strategic bombing.

#string GROUP.Attribute.AIR_FIGHTER

Fighter, interceptor, ... airplane.

#string GROUP.Attribute.AIR_OTHER

Any airborne unit that does not fall into any other airborne category.

#string GROUP.Attribute.AIR_TANKER

Airplane which can refuel other aircraft.

#string GROUP.Attribute.AIR_TRANSPORTHELO

Helicopter with transport capability. This can be used to transport other assets.

#string GROUP.Attribute.AIR_TRANSPORTPLANE

Airplane with transport capability. This can be used to transport other assets.

#string GROUP.Attribute.AIR_UAV

Unpiloted Aerial Vehicle, e.g. drones.

#string GROUP.Attribute.GROUND_AAA

Anti-Aircraft Artillery.

#string GROUP.Attribute.GROUND_APC

Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets.

#string GROUP.Attribute.GROUND_ARTILLERY

Artillery assets.

#string GROUP.Attribute.GROUND_EWR

Early Warning Radar.

#string GROUP.Attribute.GROUND_IFV

Ground Infantry Fighting Vehicle.

#string GROUP.Attribute.GROUND_INFANTRY

Ground infantry assets.

#string GROUP.Attribute.GROUND_OTHER

Any ground unit that does not fall into any other ground category.

#string GROUP.Attribute.GROUND_SAM

Surface-to-Air Missile system or components.

#string GROUP.Attribute.GROUND_TANK

Tanks (modern or old).

#string GROUP.Attribute.GROUND_TRAIN

Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently.

#string GROUP.Attribute.GROUND_TRUCK

Unarmed ground vehicles, which has the DCS "Truck" attribute.

#string GROUP.Attribute.NAVAL_AIRCRAFTCARRIER

Aircraft carrier.

#string GROUP.Attribute.NAVAL_ARMEDSHIP

Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette.

#string GROUP.Attribute.NAVAL_OTHER

Any naval unit that does not fall into any other naval category.

#string GROUP.Attribute.NAVAL_UNARMEDSHIP

Any unarmed naval vessel.

#string GROUP.Attribute.NAVAL_WARSHIP

War ship, i.e. cruisers, destroyers, firgates and corvettes.

#string GROUP.Attribute.OTHER_UNKNOWN

Anything that does not fall into any other category.

Function(s)

Enumerator for location at airbases

Field(s)

Function(s)