DCS func getNearestCargos
From DCS World Wiki - Hoggitworld.com
Envrioment: | Mission Scripting | ||
Function: | getNearestCargos | Added with: 2.5.5 | |
Member Of: | Unit | ||
Syntax: | table Unit.getNearestCargos(Class Self ) | ||
Description: | Returns a table of friendly cargo objects indexed numerically and sorted by distance from the helicopter.
Returns nil if used on any object other than a helicopter.
| ||
Return Value: | table | ||
Return Example: | A table of unit objects.
{ [1] = { ["id_"] = 16777728, }, [2] = { ["id_"] = 16777984, }, } | ||
Examples: | This could be used in a function to find the nearest ammo crate to a given helicopter:
local cargo = Unit.getByName('whoopwhoop'):getNearestCargos for i = 1, cargo do if Object.getDesc(cargo[i]).typeName == 'ammo_cargo' then return cargo[i] end end | ||
Related Functions: | Unit Functions: isActive, getPlayerName, getID, getNumber, getCategoryEx, getObjectID, getController, getGroup, getCallsign, getLife, getLife0, getFuel, getAmmo, getSensors, hasSensors, getRadar, getDrawArgumentValue, getNearestCargos, enableEmission, getDescentCapacity
Object Functions: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir | ||
Notes: |