Difference between revisions of "DCS func getUnit"

From DCS World Wiki - Hoggitworld.com
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
|par1= [[DCS_Class_Group|Group]]
 
|par1= [[DCS_Class_Group|Group]]
  
|par2=  
+
|par2= [[DCS_Class_Airbase|Airbase]]
  
 
|par3=  
 
|par3=  
Line 14: Line 14:
  
 
|desc= Returns the unit object of the specified unitIndex within the group. If the index is not valid, this function will return nil.
 
|desc= Returns the unit object of the specified unitIndex within the group. If the index is not valid, this function will return nil.
 +
 +
If called from Airbase class it will return the unit or static object associated with the airbase.
  
 
|rtnType= [[DCS_Class_Unit|Unit]]
 
|rtnType= [[DCS_Class_Unit|Unit]]
Line 38: Line 40:
 
|related=  
 
|related=  
 
[[DCS_Class_Group|'''Group Functions:''']] {{listOfScriptingGroupFuncs}}
 
[[DCS_Class_Group|'''Group Functions:''']] {{listOfScriptingGroupFuncs}}
 +
 +
[[DCS_Class_Airbase|'''AirbaseFunctions:''']] {{listOfScriptingAirbaseFuncs}}
 
|notes=  
 
|notes=  
 
}}
 
}}
 
[[Category:Class Functions|getUnit]]
 
[[Category:Class Functions|getUnit]]
 +
[[Category:Game Patch 1.2.0|getUnit]]

Latest revision as of 17:40, 16 August 2023

Scripting Root

Envrioment: Mission Scripting
Function: getUnit Added with: 1.2.0
Member Of: Group, Airbase
Syntax: Unit Group.getUnit(Class self , number UnitIndex )
Description: Returns the unit object of the specified unitIndex within the group. If the index is not valid, this function will return nil.

If called from Airbase class it will return the unit or static object associated with the airbase.


Return Value: Unit
Return Example: any positive number
Examples: Returns the first unit in a group
local unit1 = Group.getByName('tanks'):getUnit(1)
Related Functions: Group Functions: isExist, activate, destroy, getCategory, getCoalition, getName, getID, getUnit, getUnits, getSize, getInitialSize, getController, enableEmission

AirbaseFunctions: getCallsign, getUnit, getID, getCategoryEx, getParking, getRunways, getTechObjectPos, getDispatcherTowerPos, getRadioSilentMode, setRadioSilentMode, autoCapture, autoCaptureIsOn, setCoalition, getWarehouse,

Notes: