DCS World mission scripts that manage AI raid and patrol spawning based on live player population in the Normandy theatre.
These Lua scripts monitor active human player counts per coalition. When player numbers drop below configured thresholds, AI reinforcements are automatically spawned:
mist.respawnGroup) with coalition-wide radio messages.AI_CAP_ZONE via MOOSE) that respawn in randomised spawn zones when count is low.Landed AI units are automatically destroyed via an engine-shutdown event handler (event.id 19) to keep the mission clean.
| File | Notes |
|---|---|
ai_spawn_3rdJune.lua |
Patrol-only (no raids). Uses coalition.getPlayers() count. 2 Red + 2 Blue patrol groups. |
ai_spawn_10thJune.lua |
Raids + patrols. 3 Blue patrol groups (BlueAI_3 added). minPlayersRaid=10. |
ai_spawn_18thJune.lua |
Raids + patrols. minPlayersRaid=15. |
ai_spawn_24thJune.lua |
Raids + patrols. minPlayersRaid=15. |
ai_spawn_6thJuly.lua |
Raids + patrols. minPlayersRaid=15. |
ai_spawn_25thJuly.lua |
Raids + patrols. minPlayersRaid=10. |
ai_spawn_8thAugust.lua |
Raids + patrols. minPlayersRaid=10. Red patrol uses delayed CAP start via timer.scheduleFunction. |
ai_spawn_14thAugust.lua |
Raids + patrols. minPlayersRaid=15. |
ai_spawn_template.lua |
Mission-agnostic template. Copy and edit the CONFIG table for new dates. |
Legacy originals moved to old/ (archived for reference only).
ai_spawn_template.luaai_spawn_template.lua is a mission-agnostic drop-in replacement. You configure a single CONFIG table at the top of the file instead of editing hardcoded logic throughout the script.
| Section | Purpose |
|---|---|
player_count_method |
"mist" (scan all active units) or "coalition" (use coalition.getPlayers()) |
update_interval |
Seconds between player-count refreshes |
patrol_spawn_delay |
Seconds after player count before patrols spawn |
raids |
Red and Blue raid groups (group_name, cooldown, initial_timer, message text) |
patrols |
Red and Blue patrol groups (group, spawn_zone, patrol_zone, altitude, speed, engage_range) |
template_groups |
List of ME template group names to destroy at mission start |
CONFIG.raids = {
red = {
enabled = true,
min_players = 15,
group_name = "1./JG26 AI 1",
cooldown = 3600,
initial_timer = 1600,
message = {
coalition = 1,
text = "All callsigns, this is Brutus. JaBos from JG26...",
duration = 60,
},
},
blue = {
enabled = true,
min_players = 15,
group_name = "313rd FS AI 1",
cooldown = 3600,
initial_timer = 1000,
message = {
coalition = 2,
text = "All callsigns, this is Kenway. Jugs from 313th FS...",
duration = 60,
},
},
}
Each patrol entry requires matching group, spawn_zone, and patrol_zone names in the Mission Editor:
CONFIG.patrols = {
red = {
{
group = "RedAI_1",
spawn_zone = "Red_Spawn_1",
patrol_zone = "Red_Patrol_Zone_1",
min_alt = 1000,
max_alt = 3000,
speed = 400,
engage_range = 10000,
},
},
blue = {
{
group = "BlueAI_1",
spawn_zone = "Blue_Spawn_1",
patrol_zone = "Blue_Patrol_Zone_1",
min_alt = 1000,
max_alt = 3000,
speed = 400,
engage_range = 10000,
},
},
max_players = 7,
}
CONFIG.buildPlayersTable, checkRaid, spawnPatrol, and startCAP are shared and not duplicated per mission.event.initiator, Group.getByName, and chained method calls.coalition.getPlayers() count and mist.scheduleFunction loop for patrol-only operation (no raids).| Version | Changes |
|---|---|
| 1.0 | Initial extraction — Extracted 8 mission-embedded AI spawn scripts from .miz files, created generic ai_spawn_template.lua, templated all mission variants, archived originals to old/. |
| 1.1 | Current |
mist.makeUnitTable, mist.respawnGroup, mist.respawnInZoneGROUP, ZONE, AI_CAP_ZONE