DCS func getUnits

From DCS World Wiki - Hoggitworld.com
Revision as of 00:14, 21 March 2022 by Grimes (talk | contribs)

Scripting Root

Envrioment: Mission Scripting
Function: getUnits Added with: 1.2.0
Member Of: Group
Syntax: table Group.getUnits(Class Self )
Description: Returns a table of unit objects indexed in unit order. Useful for getting unit specific data for every unit in the group.


Return Value: table
Return Example:
Examples: The following would run a function if any of the aircraft in the groups fuel level is below 10%
for index, data in pairs(Group.getByName('CAP1'):getUnits())
 if Unit.getFuel(data) < 0.1 then
   abortMission('CAP1')
 end 
end
Related Functions: Group Functions: isExist, activate, destroy, getCategory, getCoalition, getName, getID, getUnit, getUnits, getSize, getInitialSize, getController, enableEmission
Notes: