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. |
Wrapper class of the DCS world Group object.
The GROUP class provides the following functions to retrieve quickly the relevant GROUP instance:
- GROUP.Find(): Find a GROUP instance from the global _DATABASE object (an instance of Core.Database#DATABASE) using a DCS Group object.
- GROUP.FindByName(): Find a GROUP instance from the global _DATABASE object (an instance of Core.Database#DATABASE) using a DCS Group name.
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:
- Wrapper.Controllable#CONTROLLABLE.TaskMission: (AIR + GROUND) Return a mission task from a mission template.
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:
- GROUP.IsCompletelyInZone: Returns true if all units of the group are within a Core.Zone.
- GROUP.IsPartlyInZone: Returns true if some units of the group are within a Core.Zone.
- GROUP.IsNotInZone: Returns true if none of the group units of the group are within a Core.Zone.
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.
- GROUP.SetAIOnOff(): Turns the GROUP AI On or Off.
- GROUP.SetAIOn(): Turns the GROUP AI On.
- GROUP.SetAIOff(): Turns the GROUP AI Off.
Global GROUPTEMPLATE |
Type(s)
| Fields and Methods inherited from GROUP | Description |
|---|---|
|
Activates a late activated GROUP. |
|
|
Returns if all units of the group are on the ground or landed. |
|
|
Calculate the maxium A2G threat level of the Group. |
|
|
Return the route of a group by using the global _DATABASE object (an instance of Core.Database#DATABASE). |
|
|
Count number of alive units in the group. |
|
|
Returns the number of UNITs that are in the Core.Zone |
|
|
Destroys the DCS Group and all of its DCS Units. |
|
|
GROUND - Switch on/off radar emissions for the group. |
|
|
Find the GROUP wrapper class instance using the DCS Group. |
|
|
Find the created GROUP using the DCS Group Name. |
|
|
Returns the average group altitude in meters. |
|
|
Get the number of shells, rockets, bombs and missiles the whole group currently has. |
|
|
Get the generalized attribute of a self. |
|
|
Returns a COORDINATE object indicating the average position of the GROUP within the mission. |
|
|
Returns the average Vec3 vector of the Units in the GROUP. |
|
|
Gets the CallSign of the first DCS Unit of the DCS Group. |
|
|
Returns category of the DCS Group. |
|
|
Returns the category name of the #GROUP. |
|
|
Returns the coalition of the DCS Group. |
|
|
Returns a COORDINATE object indicating the point of the first UNIT of the GROUP within the mission. |
|
|
Returns the country of the DCS Group. |
|
GROUP:GetCustomCallSign(ShortCallsign, Keepnumber, CallsignTranslations) |
|
|
Returns the DCS descriptor table of the nth unit of the group. |
|
|
Returns the DCS Group. |
|
|
Returns the DCS Unit with number UnitNumber. |
|
|
Returns the DCS Units of the DCS Group. |
|
|
Get the first unit of the group. |
|
|
Get the first unit of the group which is alive. |
|
|
Returns relative amount of fuel (from 0.0 to 1.0) the group has in its internal tanks. |
|
|
Returns relative amount of fuel (from 0.0 to 1.0) the group has in its internal tanks. |
|
|
Return the fuel state and unit reference for the unit with the least amount of fuel in the group. |
|
|
Returns the mean heading of every UNIT in the GROUP in degrees |
|
|
Returns the average group height in meters. |
|
|
Get the unit in the group with the highest threat level, which is still alive. |
|
|
|
|
Returns the current maximum height of the group, i.e. |
|
|
Returns the current maximum velocity of the group. |
|
|
Returns the current minimum height of the group. |
|
|
[AIRPLANE] Get the NATO reporting name (platform, e.g. |
|
|
Get the active player count in the group. |
|
|
Gets the player name of the group. |
|
|
Get player names |
|
|
Returns a list of Wrapper.Unit objects of the Wrapper.Group that are occupied by a player. |
|
|
Returns a POINT_VEC2 object indicating the point in 2D of the first UNIT of the GROUP within the mission. |
|
|
Returns the DCS#Position3 position vectors indicating the point and direction vectors in 3D of the POSITIONABLE within the mission. |
|
|
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. |
|
|
Returns the maximum range of the group. |
|
|
Returns current size of the DCS Group. |
|
|
Get skill from Group. |
|
|
Returns the maximum speed of the group. |
|
|
Return the mission template of the group. |
|
|
Return the mission route of the group. |
|
|
Returns the group template from the global _DATABASE object (an instance of Core.Database#DATABASE). |
|
|
Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of Core.Database#DATABASE). |
|
|
Get threat level of the group. |
|
|
Gets the type name of the group. |
|
|
Returns the UNIT wrapper object with number UnitNumber. |
|
|
Returns a list of Wrapper.Unit objects of the Wrapper.Group. |
|
|
Returns the current point (Vec2 vector) of the first DCS Unit in the DCS Group. |
|
|
Returns the current Vec3 vector of the first Unit in the GROUP. |
|
|
Returns the average velocity Vec3 vector. |
|
|
Subscribe to a DCS Event. |
|
|
Check if at least one (or all) unit(s) has (have) a certain attribute. |
|
|
Returns true if the first unit of the GROUP is in the air. |
|
|
Set respawn coordinate. |
|
|
Set the heading for the units in degrees within the respawned group. |
|
|
Set the height for the units in meters for the respawned group. |
|
|
Sets the modex (tail number) of the first unit of the group. |
|
|
Sets the radio comms on or off when the group is respawned. |
|
|
Sets the radio frequency of the group when it is respawned. |
|
|
Set radio modulation when the group is respawned. |
|
|
Randomize the positions of the units of the respawned group in a circle band. |
|
|
Randomize the positions of the units of the respawned group within the Core.Zone. |
|
|
Set the respawn Core.Zone for the respawned group. |
|
|
Returns if the group is activated. |
|
|
Returns if the group is of an air category. |
|
|
Returns if the DCS Group contains AirPlanes. |
|
|
Checks whether any unit (or optionally) all units of a group is(are) airbore or not. |
|
|
Returns if the group is alive. |
|
|
Returns true if any units of the group are within a Core.Zone. |
|
|
Returns true if all units of the group are within a Core.Zone. |
|
|
Returns if the DCS Group contains Ground troops. |
|
|
Returns if the DCS Group contains Helicopters. |
|
|
Check if any unit of a group is inside a Core.Zone. |
|
|
Returns true if none of the group units of the group are within a Core.Zone. |
|
|
Returns true if some but NOT ALL units of the group are within a Core.Zone. |
|
|
Returns true if part or all units of the group are within a Core.Zone. |
|
|
Check if an (air) group is a client or player slot. |
|
|
Returns if the DCS Group contains Ships. |
|
GROUP:NewTemplate(GroupTemplate, CoalitionSide, CategoryID, CountryID) |
Create a new GROUP from a given GroupTemplate as a parameter. |
|
Create a new GROUP from an existing Group in the Mission. |
|
|
Reset the subscriptions. |
|
|
Respawn the Wrapper.Group at a Point. |
|
GROUP:RespawnAtCurrentAirbase(SpawnTemplate, Takeoff, Uncontrolled) |
Respawn a group at an airbase. |
|
(AIR) Return the Group to an Wrapper.Airbase#AIRBASE. |
|
|
Turns the AI Off for the GROUP. |
|
|
Turns the AI On for the GROUP. |
|
|
Turns the AI On or Off for the GROUP. |
|
GROUP:SetAsRecoveryTanker(CarrierGroup, Speed, ToKIAS, Altitude, Delay, LastWaypoint) |
|
|
Switch on/off immortal flag for the group. |
|
|
Switch on/off invisible flag for the group. |
|
|
Sets the CoalitionID of the group in a Template. |
|
|
Sets the controlled status in a Template. |
|
|
Sets the CountryID of the group in a Template. |
|
|
UnSubscribe to a DCS event. |
| Fields and Methods inherited from GROUP.Attribute | Description |
|---|---|
|
Attack helicopter. |
|
|
Airborne Early Warning and Control System. |
|
|
Aircraft which can be used for strategic bombing. |
|
|
Fighter, interceptor, ... airplane. |
|
|
Any airborne unit that does not fall into any other airborne category. |
|
|
Airplane which can refuel other aircraft. |
|
|
Helicopter with transport capability. This can be used to transport other assets. |
|
|
Airplane with transport capability. This can be used to transport other assets. |
|
|
Unpiloted Aerial Vehicle, e.g. drones. |
|
|
Anti-Aircraft Artillery. |
|
|
Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets. |
|
|
Artillery assets. |
|
|
Early Warning Radar. |
|
|
Ground Infantry Fighting Vehicle. |
|
|
Ground infantry assets. |
|
|
Any ground unit that does not fall into any other ground category. |
|
|
Surface-to-Air Missile system or components. |
|
|
Tanks (modern or old). |
|
|
Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently. |
|
|
Unarmed ground vehicles, which has the DCS "Truck" attribute. |
|
|
Aircraft carrier. |
|
|
Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette. |
|
|
Any naval unit that does not fall into any other naval category. |
|
|
Any unarmed naval vessel. |
|
|
War ship, i.e. cruisers, destroyers, firgates and corvettes. |
|
|
Anything that does not fall into any other category. |
| Fields and Methods inherited from GROUP.Takeoff | Description |
|---|---|
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:
Core.Zone#ZONE_BASE Zone
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.
Find the created GROUP using the DCS Group Name.
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.
Returns the average Vec3 vector of the Units in the GROUP.
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
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.
Returns a COORDINATE object indicating the point of the first UNIT of the GROUP within the mission.
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.
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!
Get the first unit of the group which is 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:
- 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:
Core.Event#EVENTS Event
#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:
Core.Point#COORDINATE coordinate
Coordinate where the group should be respawned.
Return value:
self
Set the heading for the units in degrees within the respawned group.
Set the height for the units in meters for the respawned group.
(This is applicable for air units).
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.
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.
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:
Core.Zone#ZONE_BASE Zone
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:
Core.Zone#ZONE_BASE Zone
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:
Core.Zone#ZONE_BASE Zone
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:
Core.Zone#ZONE_BASE Zone
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:
Core.Zone#ZONE_BASE Zone
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:
Core.Zone#ZONE_BASE Zone
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.
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.
- GROUP.InitHeading: Set the heading for the units in degrees within the respawned group.
- GROUP.InitHeight: Set the height for the units in meters for the respawned group. (This is applicable for air units).
- GROUP.InitRandomizeHeading: Randomize the headings for the units within the respawned group.
- GROUP.InitZone: Set the respawn Core.Zone for the respawned group.
- GROUP.InitRandomizeZones: Randomize the respawn Core.Zone between one of the Core.Zones given for the respawned group.
- GROUP.InitRandomizePositionZone: Randomize the positions of the units of the respawned group within the Core.Zone.
- GROUP.InitRandomizePositionRadius: Randomize the positions of the units of the respawned group in a circle band.
- GROUP.InitRandomizeTemplates: Randomize the Template for the respawned 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:
self
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.
Core.Spawn#SPAWN.Takeoff Takeoff
(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:
Wrapper.Airbase#AIRBASE RTBAirbase
(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 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.
Generalized group attributes.
See DCS attributes on hoggit.
Field(s)
Attack helicopter.
Airborne Early Warning and Control System.
Aircraft which can be used for strategic bombing.
Fighter, interceptor, ... airplane.
Any airborne unit that does not fall into any other airborne category.
Airplane which can refuel other aircraft.
Helicopter with transport capability. This can be used to transport other assets.
Airplane with transport capability. This can be used to transport other assets.
Unpiloted Aerial Vehicle, e.g. drones.
Anti-Aircraft Artillery.
Infantry carriers, in particular Amoured Personell Carrier. This can be used to transport other assets.
Artillery assets.
Early Warning Radar.
Ground Infantry Fighting Vehicle.
Ground infantry assets.
Any ground unit that does not fall into any other ground category.
Surface-to-Air Missile system or components.
Tanks (modern or old).
Trains. Not that trains are not yet properly implemented in DCS and cannot be used currently.
Unarmed ground vehicles, which has the DCS "Truck" attribute.
Aircraft carrier.
Any armed ship that is not an aircraft carrier, a cruiser, destroyer, firgatte or corvette.
Any naval unit that does not fall into any other naval category.
Any unarmed naval vessel.
War ship, i.e. cruisers, destroyers, firgates and corvettes.
Anything that does not fall into any other category.
Function(s)
Enumerator for location at airbases