Skip to content

Test/Debug Control Surface

Optional file DynamicMission_TestUtils.lua, loaded separately.

Activated by DM.Config.TEST_MODE — simply loading the file activates this mode by default if the flag isn't already set, with no action required from the mission maker. Exposes an F10 → DynamicMission Test Utils F10 menu with 9 paginated submenus (DCS's 9-entries-per-page limit handled automatically), roughly 30 functions in total.

Confirmed desync with the current data model

This file references a property schema that predates the current DM.Region/DM.Airbase one. Direct field-name comparison:

  • region.cycleCount / region.lastDetectionTime read/written everywhere — the real field is region.spawnCycles, and lastDetectionTime doesn't exist at all.
  • region.visibility — the real field is region.isMapVisible.
  • region.forceBalancing — the real field is region.modeFB.
  • region.modelGroups / region.spawnZones (flat arrays) — the real structures are region._mgTemplatesByTag / region._szZonesByTag (indexed by tag).
  • region.vertices — the real fields are region.vertices2D / region.verticesRaw.
  • airbase.position — the real field is airbase.point.
  • airbase.jerrycanStatics (plural) — the real field is airbase.jerrycanStatic (singular).
  • forceSpawnInRegion calls an external mist.cloneInZone(...) function unrelated to the script's internal spawn engine (DM.utils.cloneInZone) — it only works if a third-party file providing that function is loaded separately by the mission.

Net effect: functions touching these stale fields (printRegionInfo, printAirbaseInfo, forceSpawnInRegion, resetRegion, resetMission, fastForwardCycles, setRegionFrequency, toggleRegionVisibility, refreshRegionMarks, teleportPlayerToRegion, the refresh branch of captureAirbase) will read nil where a value is expected — an empty/inconsistent output in most cases, a runtime error in a few (e.g. arithmetic on nil in fastForwardCycles). A code-reading finding, not a live execution test.

Function inventory, by menu section

1 — Base defenses (4)

Function Effect
clearAirbaseDefenses Destroys every AD_ defense group and the Jerrycan of a base.
forceSpawnDefenses Purges then forces the spawn of N groups (1-6) for a given coalition.
clearAllDefenses Applies clearAirbaseDefenses to every base in the mission.
respawnDefenses Purges then respawns 6 groups for the base's current coalition.

2 — Base coalition (3)

Function Effect
setAirbaseCoalition Changes the raw DCS coalition, no defenses or event.
setAirbaseNeutral Shortcut to neutral coalition.
captureAirbase Full simulated capture: purges defenses, changes coalition, spawns 6 new defenses, re-checks CLEARED.

3 — Region management (6)

Function Effect
forceActivateRegion Bypasses activation conditions; refuses if CLEARED.
forceInactivateRegion Forced scheduler stop.
setRegionState Directly forces IDLE/ACTIVE/CLEARED; refuses CLEARED → ACTIVE.
clearRegionGroups Destroys every active group of a region.
forceSpawnInRegion Forces 1-20 spawns, ignoring every cap. ⚠️ Stale fields
resetRegion Purge + forced IDLE + counters to zero + F10 cleared. ⚠️ Stale fields

4 — Debug / inspection (5)

Function Effect
printRegionInfo Multi-line F10 dump of a region's state/config. ⚠️ Stale fields
printAirbaseInfo Multi-line F10 dump of a base. ⚠️ Stale fields
printAllRegionsStatus One-line-per-region summary table.
printActiveGroups Lists a region's active groups (name/coalition/headcount).
printManagerStatus Global counters (regions per state, bases, active groups, message queue, error log).

5 — Teleportation (3)

Function Effect
teleportPlayerToZone Teleports to a trigger zone's center, altitude kept.
teleportPlayerToAirbase Teleports above a base (default altitude 3000m).
teleportPlayerToRegion Teleports to a region's centroid at 3000m. ⚠️ Stale fields

6 — F10 marks (3)

Function Effect
clearAllMarks Removes every region polygon.
refreshRegionMarks Redraws visible non-IDLE regions. ⚠️ Stale fields
toggleRegionVisibility Toggles the visibility flag. ⚠️ Doesn't touch the real isMapVisible field

7 — Event simulation (2)

Function Effect
simulateBaseCaptured Thin wrapper around captureAirbase.
simulateLanding Spawns defenses as if a landing had just happened on a neutral base.

8 — Time / cycles (2)

Function Effect
fastForwardCycles Manually invokes runCycle() N times (1-50), early exit if CLEARED. ⚠️ Stale fields
setRegionFrequency Changes the cycle frequency (10-300s) on the fly, restarts the scheduler if active.

9 — Global reset (4)

Function Effect
resetMission Purges every group of every region and every base's defenses, resets everything to IDLE.
stopAllRegions Deactivates every ACTIVE region.
reloadCode Hot-reloads both files via dofile(). Hardcoded path — only works on the original machine.
forceRegionCleared The most elaborate one: purges and respawns opposing defenses on every base of the region, then schedules a 10s follow-up that resyncs coalitions and forces CLEARED if checkClearedStatus() confirms it.