SpawnGroundUnit
Appearance
| 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 |
| GroupName | Name of the group to assign the unit to, used as the unit's identifier in the mission. | |
| UnitType | Type of the unit to spawn, such as "T-72" or "BTR-80", defined in the mission editor. | |
| Country | DCS Country ID number, used to assign the unit to a specific faction. | |
| SpawnPoint | Table containing X and Y coordinates for the spawn location; Z is optional and defaults to 0 if not provided. | |
| Heading | Optional value for the unit's initial heading; defaults to a random value between 0 and 359 if not specified. | |
| Hidden | Optional flag to hide the unit upon spawn; defaults to false if not specified. | |
| Debug | Optional 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: | ||