Difference between revisions of "MIST respawnInZone"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Mission Scripting |fName= mist.respawnInZone| |vNum = Mist 3.0 |desc= Respawns a group of the name groupName to a randomized point within a trigger zone. | |rtnType= st...")
 
Line 66: Line 66:
 
|rtnExamples= string of group's name
 
|rtnExamples= string of group's name
  
|example= The following code will respawn a group if it has died randomly within a zone
+
|example= The following code will respawn a group randomly in a zone once it is has died.
 
<code>
 
<code>
   if not Group.getByName('groupName') then
+
   if (Group.getByName('groupName') and Group.getByName('groupName'):getSize() < 1) or not Group.getByName('groupName') then
 
     mist.respawnInZone('groupName', 'myZone', true, 500)
 
     mist.respawnInZone('groupName', 'myZone', true, 500)
 
   end
 
   end

Revision as of 18:56, 23 August 2018


mist.respawnInZone

Added with: Mist 3.0
Description
Respawns a group of the name groupName to a randomized point within a trigger zone.
Syntax
string mist.respawnInZone(string groupName ,string/table zoneName/tableOfZoneNames , boolean disperse ,number radius )
Valid Input Values:
groupName= name of the group that is to respawn 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.

Return value:
string
Return example:
string of group's name
Usage Examples:
The following code will respawn a group randomly in a zone once it is has died.

 if (Group.getByName('groupName') and Group.getByName('groupName'):getSize() < 1) or not Group.getByName('groupName') then
   mist.respawnInZone('groupName', 'myZone', true, 500)
 end

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