Jump to content

SpawnGroundUnitInZone

From CMM Wiki
Revision as of 10:12, 11 November 2025 by Ozdeadmeat (talk | contribs) (SpawnGroundUnitInZone – created via PowerShell script (2025-11-11T21:12:42Z))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Return to CMM Command Reference
Environment: Mission Scripting
Function: SpawnGroundUnitInZone
Function Description: Spawns ground units in a specified zone based on a unit type table, with optional road-based spawning and a limit on total units. It checks for existing units, calculates how many more units are needed, and spawns new units at valid positions within the zone.
File Location: cmm.spawnFunctions.lua
Syntax: CMM.SpawnGroundUnitInZone( string ZoneName , number Country , table UnitTypeTable , number UnitLimit , nil or boolean ForceRoad )
Return Value: nil
Parameters: Name Description
ZoneNameName of the zone where units should be spawned, must exist in the mission editor.
CountryID of the country to assign to the spawned units.
UnitTypeTableTable containing unit types to randomly select from during spawning.
UnitLimitMaximum number of units allowed in the zone; if exceeded, no additional units are spawned.
ForceRoadOptional parameter to force unit spawns on roads within the zone; defaults to false.
Example: CMM.SpawnGroundUnitInZone("DebrisArea", 1, {"T-72", "BTR-80"}, 100, true)
Example Description: Spawns up to 100 units in the "DebrisArea" zone, using a mix of T-72 and BTR-80 units, with all spawns forced to occur on roads.
Related Functions:
Notes: