Jump to content

SpawnGroundUnit

From CMM Wiki
Return to CMM Command Reference
Environment: Mission Scripting
Function: SpawnGroundUnit
Function Description: Spawns a ground unit at a specified location with optional heading, visibility, and debug markers. The function assigns the unit to a group, sets its country, visibility, and heading, and configures AI behavior such as dispersion and alarm state.
File Location: cmm.spawnFunctions.lua
Syntax: CMM.SpawnGroundUnit( string GroupName , string UnitType , number Country , table SpawnPoint , nil or number Heading , nil or boolean Hidden ,nil or boolean Debug )
Return Value: nil
Parameters: Name Description
GroupNameName of the group to assign the unit to, used as the unit's identifier in the mission.
UnitTypeType of the unit to spawn, such as "T-72" or "BTR-80", defined in the mission editor.
CountryDCS Country ID number, used to assign the unit to a specific faction.
SpawnPointTable containing X and Y coordinates for the spawn location; Z is optional and defaults to 0 if not provided.
HeadingOptional value for the unit's initial heading; defaults to a random value between 0 and 359 if not specified.
HiddenOptional flag to hide the unit upon spawn; defaults to false if not specified.
DebugOptional flag to create a debug marker at spawn location for visibility; defaults to false if not specified.
Example: CMM.SpawnGroundUnit("BLUFOR_T72_Group", "T-72", 1, {x=1000, y=2000}, 90, true, false)
Example Description: Spawns a T-72 unit in BLUFOR under the group name "BLUFOR_T72_Group" at coordinates (1000, 2000) facing 90 degrees, hidden from view, without debug markers.
Related Functions:
Notes: