SpawnGroundUnitInZone
Appearance
| 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 |
| ZoneName | Name of the zone where units should be spawned, must exist in the mission editor. | |
| Country | ID of the country to assign to the spawned units. | |
| UnitTypeTable | Table containing unit types to randomly select from during spawning. | |
| UnitLimit | Maximum number of units allowed in the zone; if exceeded, no additional units are spawned. | |
| ForceRoad | Optional 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: | ||