MIST dynAdd

From DCS World Wiki - Hoggitworld.com


mist.dynAdd

Added with: Mist 3.0
Description
With valid data, this function will dynamically spawn a group consisting of unitsTable within the categoryName for countryName using the built in scripting function coalition.addGroup.
Syntax
table mist.dynAdd(table vars )
Valid Input Values:

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

 vars = 
 {
 units = table units, 
 country = string/number country, 
 category = string/number category,
 groupName/name = string groupName/name, 
 groupId = number groupId, 
 clone = boolean clone, 
 route = table route,
 }

units is a unitTable as formatted in the mission editor

country is the country name the group will spawn for

category is the category of the group to spawn

groupName/name is an optional variable that defines the group name. If not present the function will generate a new name based on country, category, and groupId. If it is the same as a pre-existing group, this function will overwrite and remove that group existing from the mission.

groupId is an optional variable that defines the group Id. If not present the function will generate a new group Id based off of the number of existing groups. If it is the same as a pre-existing groups Id, this function will overwrite and remove that existing group from the mission.

clone is an optional variable that defines whether or not it should treat the passed group data as a clone. If present it will create a new group Id and groupName regardless if you passed a custom name or Id.

route is an optional variable that defines the default route assigned to the group. Function is overloaded to accept it as either:

 route.points = { 
  [1] = {pointTable}, 
  [2] = {pointTable}, 
 ... 
 },

or

 route = { 
  [1] = {pointTable}, 
  [2] = {pointTable}, 
  ... 
 }
Return value:
table
Return example:
groupDataTable
Usage Examples:
  local vars = {} 
  vars.gpName = ‘group1’ 
  vars.action = 'clone' 
  vars.point = vec3 
  vars.radius = 1000 
  vars.disperse = ‘disp’ 
  vars.maxDisp = 500 
  mist.teleportToPoint(vars) 
Notes:
Related Functions
dynAdd, dynAddStatic, groupTableCheck, getNextUnitId, getNextGroupId, respawnGroup, respawnInZone, cloneGroup, cloneInZone, teleportGroup, teleportInZone, teleportToPoint, spawnRandomizedGroup

Scripting Engine

MIST Root Page