Difference between revisions of "DCS func getUnits"

From DCS World Wiki - Hoggitworld.com
m (1 revision imported)
 
Line 42: Line 42:
 
}}
 
}}
 
[[Category:Class Functions|getUnits]]
 
[[Category:Class Functions|getUnits]]
 +
[[Category:Game Patch 1.2.0|getUnits]]

Revision as of 00:14, 21 March 2022

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: