MIST randomizeGroupOrder

From DCS World Wiki - Hoggitworld.com


mist.spawnRandomizedGroup

Added with: Mist 3.5
Description
Randomizes the contents of a group for further use in spawning or other purposes a designer could use it for. The optional variables define which units in the group will not be randomized. The lowerLimit and upperLimit variables respectively define the low and upper limits on which unit indexes can be randomized. The excludeNum table is a table of numbers, in no particular order, of which unit indexes will be ignored. The excludeType table defines the unitType name of units that will be ignored.
Syntax
table mist.spawnRandomizedGroup(table units , table vars )
Valid Input Values:
  units = mist.getGroupData(groupName).units


vars tables have the following recognized fields( required entries in blue, optional in green):

 vars = 
 {
 
 lowerLimit = number lowerLimit, 
 upperLimit = number upperLimit, 
 excludeNum = table excludeNum, 
 excludeType = table excludeType,
 }


lowerLimit is an optional variable that defines the lower range of which unit indexes will be randomized.

upperLimit is an optional variable that defines the upper range of which unit indexes will be randomized.

excludeNum is an optional table that defines unit indexes that will not be randomized.

excludeType is an optional table of strings that lists unitTypes that will not be randomized.

Return value:
table
Return example:
units table
Usage Examples:
  local newGroup = mist.getGroupData('myGroup')  
  newGroup.units = mist.randomizeGroupOrder(newGroup.units), {lowerLimit = 2, upperLimit = 9})
  
  mist.dynAdd(newGroup)

Groups will spawn in the following order with 'r' representing a random position: 1, 2, r, r, r, r, r, r, 9, 10

Notes:
Related Functions
getGroupData, getCurrentGroupData, getGroupTable getGroupPoints, getGroupRoute, getLeadPos, getAvgPos, getPayload, getGroupPayload, randomizeGroupOrder, groupIsDead

Scripting Engine

MIST Root Page