Difference between revisions of "DCS func getGroups"

From DCS World Wiki - Hoggitworld.com
m
Line 14: Line 14:
  
 
|desc= Returns a table of [[DCS_Class_Group|group objects]] belonging to the specified coalition. If the groupCategory enumerator is provided the table will only contain groups that belong to the specified category. If this optional variable is not provided, all group types will be returned. See [[DCS_Class_Group|here]] for the list of possible group categories.
 
|desc= Returns a table of [[DCS_Class_Group|group objects]] belonging to the specified coalition. If the groupCategory enumerator is provided the table will only contain groups that belong to the specified category. If this optional variable is not provided, all group types will be returned. See [[DCS_Class_Group|here]] for the list of possible group categories.
 +
 +
Group.Category = {
 +
  AIRPLANE      = 0
 +
  HELICOPTER    = 1
 +
  GROUND        = 2
 +
  SHIP          = 3
 +
  TRAIN        = 4
 +
}
  
 
|rtnType= table
 
|rtnType= table

Revision as of 22:59, 24 November 2021

Scripting Root

Envrioment: Mission Scripting
Function: getGroups Added with: 1.2.4
Member Of: coalition
Syntax: table coalition.getGroups(enum coalitionId , enum GroupCategory)
Description: Returns a table of group objects belonging to the specified coalition. If the groupCategory enumerator is provided the table will only contain groups that belong to the specified category. If this optional variable is not provided, all group types will be returned. See here for the list of possible group categories.
Group.Category = {
  AIRPLANE      = 0
  HELICOPTER    = 1
  GROUND        = 2
  SHIP          = 3
  TRAIN         = 4
}


Return Value: table
Return Example:
Examples: The following will print each groups name belonging to the blue coalition to dcs.log
for i, gp in pairs(coalition.getGroups(2)) do
 env.info(Group.getName(gp))
end
Related Functions: Coalition Functions: addGroup, addStaticObject, getGroups, getStaticObjects, getAirbases. getPlayers, getServiceProviders, addRefPoint, getRefPoints, getMainRefPoint, getCountryCoalition
Notes: Due to a bug this function is returning dead groups in addition to the alive groups. You must