MIST getUnitsByAttribute

From DCS World Wiki - Hoggitworld.com


mist.getUnitsByAttribute

Added with: Mist 4.5
Description
Iterates the mist database and the passed attributes table to find units matching those parameters. Consider it to be an alternative of mist.makeUnitTable.
  typeName
  country
  coalition
  skill
  category

Optional value matches determines how many of those entries must match. Defaults to 1. For instance if you pass 2, then any 2 of the above list must be present for a given unit.

Optional boolean value of id will if present return the unitId instead of unit names.

Syntax
table mist.getUnitsByAttribute(table attributes , number matches ,boolean id )
Valid Input Values:
Valid attributes:


  typeName       : a string of any unit type
  country        : a string of the country name
  coalition      : a string of the coalition name
  skill          : a string of the skill
  category       : a string of the category
Return value:
table
Return example:
Usage Examples:
The following would return a table of ids for all blue clients
  local list = mist.getUnitsByAttribute({skill = 'Clients', coalition = "blue"}, 2, true)
Notes:
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,

Scripting Engine

MIST Root Page