MIST getNextUnitId

From DCS World Wiki - Hoggitworld.com
Revision as of 06:40, 12 April 2018 by Grimes (talk | contribs) (Created page with "{{Mission Scripting |fName= mist.getNextUnitId| |vNum = Mist 3.3 |desc= Returns the next unused unitId for use with spawning units via coalition.addGroup(). This function a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


mist.getNextUnitId

Added with: Mist 3.3
Description
Returns the next unused unitId for use with spawning units via coalition.addGroup(). This function automatically iterates the global value mist.nextUnitId.
Syntax
number mist.getNextUnitId(nothing nothing )
Valid Input Values:
nothing is required
Return value:
number
Return example:
29
Usage Examples:

do

local newGroup = {}
newGroup.units = {}
for i = 1, 6 do
newGroup.units[i] = {}
newGroup.units[i].unitId = mist.getNextUnitId()
end

end

Notes:
Iterates from the highest unitId from the mission file. The nextUnitId is also accessible globally via mist.nextUnitId. If you access it via the global variable it is recommended to iterate it yourself. All groups spawned by mist.dynAdd have a unitId starting at 7000.

The intention for this function is to provide easy access to a next available unitId if you prefer using coalition.addGroup() instead of mist.dynAdd().

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

Scripting Engine

MIST Root Page