MIST cloneInZone

From DCS World Wiki - Hoggitworld.com


mist.cloneInZone

Added with: Mist 3.0
Description
Clones a group of the name groupName to a randomized point within a trigger zone.
Syntax
string mist.cloneInZone(string groupName ,string/table zoneName/tableOfZoneNames , boolean disperse ,number radius ,table vars )
Valid Input Values:
groupName= name of the group that is to be cloned inside a zone

zoneName= Name of the zone as placed in the editor to that the group will randomly spawn inside of.

or

tableOfZoneNames= If numerous zone names are given, a single zone will be chosen at random for the group to spawn inside of.

disperse= if this variable is present each unit of the group will be randomly dispersed in the zone. If not present, the group will remain in its default formation

radius= if this variable is present in addition to disperse, this radius will specify the maximum distance each unit will be from the first unit of the group.


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

 vars = 
 {
 
 anyTerrain = boolean anyTerrain, 
 validTerrain = table validTerrain, 
 offsetRoute = boolean offsetRoute, 
 offsetWP1 = boolean offsetWP1, 
 initTasks = boolean initTasks,
 }


anyTerrain is an optional variable that if present will define any terrain type as valid.

validTerrain is an optional variable used to define specific terrain types you may wish to spawn objects over. Useful for spawning ground units on a runway or in water because by default these options are disabled.

offsetRoute is an optional variable that if present will offset the entire route of the group from the groups original position. Note all task information is kept. For example if used on a ship the assigned shape of the route will be kept, it will simply be offset to the new spawn point.

offsetWP1 is an optional variable that if present will offset the first waypoint of the route of the group from the groups original position. Note all task information is kept. For example if used on a ship, the original route will be kept, but the first waypoint will be in the new location. .

initTasks is an optional variable that will keep the tasks assigned at WP1, but will erase every other waypoint.

Return value:
string
Return example:
string of group's name
Usage Examples:
The following code will clone 10 groups inside of a number of zones
  for i = 1, 10 do
    mist.cloneInZone('zues', {'myZone1', 'myZone2', 'LowCalCalzoneZone'})
  end

The following would offset the entire route relative to where the AI spawned at. and would keep any of the tasks assigned to that group.

  mist.cloneInZone('groupName', 'zone', nil, 4000, {offsetRoute = true, initTasks = true})
Notes:
As of mist 3.3 this function supports the use of static objects.

This function limits where groups of certain types can spawn. Ground groups can only spawn on the ground and roads. Ships can only spawn on water. And aircraft can be spawned anywhere. Note that for ground groups any part of the airbase like the runway, ramp, or taxiway is not a valid spawning location. This is done so ground units won't accidentally block AI aircraft paths when at an airbase.

Related Functions
dynAdd, dynAddStatic, groupTableCheck, getNextUnitId, getNextGroupId, respawnGroup, respawnInZone, cloneGroup, cloneInZone, teleportGroup, teleportInZone, teleportToPoint, spawnRandomizedGroup

Scripting Engine

MIST Root Page