MIST getUnitsInZones
From DCS World Wiki - Hoggitworld.com
mist.getUnitsInZones
Added with: Mist 1.0 |
Description |
Returns a table of unit objects from the table unit_names that are inside any of the zones listed in the table of zone_names. |
Syntax |
table mist.getUnitsInZones(UnitNameTable unit_names ,table zone_names , string zone_type ) |
Valid Input Values: |
ExampleUnitNameTable
zone_names = {'zone1', 'zone2'} zone_type = 'cylinder' - cylindrical shaped zone extending to +/- infinity in altitude. 'sphere' - spherical zone |
Return value: |
table |
Return example: |
{ [1] = { ["id_"] = 16779264,} ,[2] = { ["id_"] = 16780032,} ,[3] = { ["id_"] = 16780288,} ,[4] = { ["id_"] = 16780544,} ,} |
Usage Examples: |
Returns a table of units within the zone KutasiBattle and builds table of units index by the country each unit belongs to.
local u = mist.getUnitsInZones(mist.makeUnitTable({'[all]'}), {'KutaisiBattle'}) local countries = {} for i = 1, #u do local cntry = Unit.getCountry(u[i]) if not countries[cntry] then countries[cntry] = {} end table.insert(countries[cntry], u[i]) end |
Notes: |
Is called by and is related to Units in zones |
Related Functions |
makeUnitTable, getRandPointInCircle, getRandomPointInZone, getRandomPointInPoly, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, getAvgPoint, getQFE, getWindBearingAndVel, getPathLength, getPathInSegments, getPointAtDistanceOnPath, projectPoint, getGroupsByAttribute, , getUnitsByAttribute, mapValue, |