MIST spawnRandomizedGroup

From DCS World Wiki - Hoggitworld.com


Added with: Mist 3.5
Respawns a group of the name groupName at its initial location as set in the mission editor but randomizes the order of the units within the group. Group will spawn with the same task as defined in the mission editor. 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.
boolean mist.spawnRandomizedGroup(string groupName , table vars )
Valid Input Values:
groupName 'myRandomGroup1'

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:
Return example:
Usage Examples:
  mist.spawnRandomizedGroup('convoy1', {lowerLimit = 2, upperLimit = 9})

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

The purpose of this function is to add a little variety to a mission. A groups composition might be the same as last time, but a sam threat for instance would not always be in the same position within the group.
Related Functions
dynAdd, dynAddStatic, groupTableCheck, getNextUnitId, getNextGroupId, respawnGroup, respawnInZone, cloneGroup, cloneInZone, teleportGroup, teleportInZone, teleportToPoint, spawnRandomizedGroup

Scripting Engine

MIST Root Page