Read Moose_DynamicGroundBattle_Plugin.lua, lines 540 to 580
Read Moose_DynamicGroundBattle_Plugin.lua, lines 340 to 380
Read Moose_DynamicGroundBattle_Plugin.lua, lines 380 to 430
Now let me check where garrison data cleanup happens:
Read Moose_DynamicGroundBattle_Plugin.lua, lines 470 to 530
Good - I can see some cleanup is already happening. Now let me add comprehensive cleanup to ensure nothing accumulates. I need to add:
Periodic cleanup of old cooldown entries for groups that no longer exist
Cleanup of garrison data for zones that no longer exist or have been recaptured
Ensure marker cleanup is working properly
Moose_DynamicGroundBattle_Plugin.lua+106-5
Perfect! Now all tracking structures have comprehensive cleanup:
Memory Management Summary:
1. spawnedGroups ✓
Cleaned in getAllGroups() when groups are dead
Cleaned in CleanupStaleData() every 10 minutes
2. groupGarrisonAssignments ✓
Cleaned when defenders die in CountAliveDefenders()
Cleaned when rotated out in TryDefenderRotation()
Cleaned in getAllGroups() when groups are dead
Cleaned in CleanupStaleData() every 10 minutes
3. groupAttackCooldown ✓
Cleaned in getAllGroups() when groups are dead
Cleaned in CleanupStaleData() every 10 minutes
4. zoneGarrisons ✓
Dead defenders removed in CountAliveDefenders() (called frequently)
Dead defenders removed in CleanupStaleData() every 10 minutes
Entire garrison data removed if zone no longer exists
lastPatrolTime sub-table cleaned for dead defenders
5. activeMarkers ✓
All markers removed and table cleared every 5 minutes in updateMarkPoints()
Improved to iterate backwards and properly nil out entries
6. Lua Garbage Collection ✓
Forced collectgarbage("collect") in CleanupStaleData() every 10 minutes
Ensures Lua VM reclaims memory from deleted tables
7. Enhanced Memory Logging ✓
Now tracks: Lua memory, Groups, Cooldowns, Garrisons, Defenders
Runs every 15 minutes
Visible in DCS logs for monitoring
All tracking structures now have multiple layers of cleanup to prevent memory accumulation. The combination of immediate cleanup (when groups die) and periodic comprehensive cleanup (every 10 minutes) ensures nothing builds up over long missions.
MOOSE Dual Coalition Zone Capture System
A dynamic zone capture and control system for DCS World missions using the MOOSE framework. This script enables territory-based gameplay where RED and BLUE coalitions compete to capture and hold strategic zones across the battlefield.
🎯 Features
- 🎨 Visual Feedback: Color-coded zone boundaries (Red/Blue/Green/Orange) that change dynamically
- 💨 Smoke Signals: Automatic smoke markers indicating zone status
- 📍 Tactical Information: Real-time force composition and MGRS coordinates for enemies
- 🏆 Victory Conditions: Automatic win detection when one coalition captures all zones
- 📻 F10 Radio Menu: Player-accessible status reports and progress tracking
- ⚙️ Highly Configurable: Simple zone ownership configuration via Lua tables
- 🔄 Dual Coalition: Full support for both RED and BLUE coalitions
- 📊 Auto-Reporting: Periodic status updates every 5 minutes
- 🎮 Player-Friendly: Clear messaging and intuitive state transitions
🚀 Quick Start
Prerequisites
- DCS World (version 2.9 or higher)
- MOOSE Framework (Download here)
- Basic knowledge of DCS Mission Editor
Installation
-
Download the files:
Moose_DualCoalitionZoneCapture.lua- Main scriptMoose_DualCoalitionZoneCapture.miz- Example missionMoose_.lua- MOOSE framework (get latest version)
-
In DCS Mission Editor:
- Create trigger zones for each capture point (e.g., "Capture Zone-1", "Capture Severomorsk")
- Create two groups:
BLUEHQ(any BLUE ground unit) andREDHQ(any RED ground unit)
-
Configure zones in
Moose_DualCoalitionZoneCapture.lua:
local ZONE_CONFIG = {
RED = {
"Capture Zone-1",
"Capture Zone-2"
},
BLUE = {
"Capture Zone-3",
"Capture Zone-4"
},
NEUTRAL = {
-- Empty zones at mission start
}
}
-
Load scripts via Mission Start trigger:
- Action 1: DO SCRIPT FILE →
Moose_.lua - Action 2: DO SCRIPT FILE →
Moose_DualCoalitionZoneCapture.lua
- Action 1: DO SCRIPT FILE →
-
Save and test your mission!
📖 How It Works
Zone States
Zones transition between four distinct states:
| State | Color | Smoke | Description |
|---|---|---|---|
| RED Controlled | 🔴 Red Border | Red | Zone secured by RED coalition |
| BLUE Controlled | 🔵 Blue Border | Blue | Zone secured by BLUE coalition |
| Neutral/Empty | 🟢 Green Border | Green | Uncontrolled, ready for capture |
| Contested | 🟠 Orange Border | White | Multiple coalitions present - fighting for control |
Capture Mechanics
- To Capture: Move ground units into a zone
- To Hold: Eliminate all enemy forces in the zone
- To Win: Capture ALL zones on the map
The script automatically scans zones every 30 seconds (configurable) and updates ownership based on unit presence.
Tactical Information Markers
Each zone displays real-time tactical data:
TACTICAL: Capture Severomorsk-1
Forces: R:5 B:12
TGTS: T-90@38U LV 12345 67890, BTR-80@38U LV 12346 67891
- Force Counts: Number of units per coalition
- MGRS Coordinates: Precise enemy locations (when ≤10 units)
- Coalition-Specific: Each side sees their enemies marked
⚙️ Configuration Options
Zone Settings
local ZONE_SETTINGS = {
guardDelay = 1, -- Seconds before entering Guard state after capture
scanInterval = 30, -- How often to scan for units (seconds)
captureScore = 200 -- Points awarded for zone capture
}
Performance Tuning
For missions with many units:
scanInterval = 60 -- Scan less frequently
For fast-paced action:
scanInterval = 15 -- More responsive zone changes
Logging Control
Disable detailed logging:
CAPTURE_ZONE_LOGGING = { enabled = false }
👥 Player Features
F10 Radio Menu Commands
Players access zone information via F10 → Zone Control:
- Get Zone Status Report: Current ownership of all zones
- Check Victory Progress: Percentage toward victory
- Refresh Zone Colors: Manually redraw zone boundaries
Automatic Notifications
- ✅ Zone capture/loss announcements
- ⚠️ Attack warnings when zones are contested
- 📊 Status reports every 5 minutes
- 🏆 Victory alerts at 80% and 100% completion
- 🎉 Victory countdown with celebratory effects
🎮 Example Mission
The included Moose_DualCoalitionZoneCapture.miz demonstrates:
- Proper zone configuration
- HQ group placement
- Script loading order
- AI patrol patterns for testing
- All visual and messaging features
Use this mission as a template for your own scenarios!
🔧 Troubleshooting
Common Issues
❌ Script Won't Load
Error: "attempt to index a nil value"
- Cause: MOOSE not loaded first
- Fix: Ensure load order is MOOSE → Capture Script
❌ Zone Not Found
Error: "Zone 'X' not found in mission editor!"
- Cause: Zone name mismatch
- Fix: Verify zone names match EXACTLY (case-sensitive!)
⚠️ Zones Not Capturing
- Only ground units, planes, and helicopters are scanned
- Wait 30 seconds for scan cycle
- Eliminate ALL enemy forces to capture
- Check DCS.log for detailed information
Checking Logs
Open Saved Games\DCS\Logs\DCS.log and search for:
[CAPTURE Module]- General logging[INIT]- Initialization messages[TACTICAL]- Tactical marker updates[VICTORY]- Victory condition checks
🏗️ Mission Design Tips
Best Practices
- Zone Size: Large enough for tactical areas, avoid overlaps
- Zone Placement: Position over airbases, FOBs, strategic terrain
- Starting Balance: Consider defensive vs. offensive scenarios
- AI Behavior: Use "Ground Hold" or "Ground On Road" waypoints
- Player Briefing: Document F10 menu commands in mission brief
Integration with Other Scripts
Access zone data from other scripts:
-- Get current ownership status
local status = GetZoneOwnershipStatus()
-- Returns: { blue = X, red = Y, neutral = Z, total = N, zones = {...} }
-- Manual status broadcast
BroadcastZoneStatus()
-- Refresh zone visuals
RefreshAllZoneColors()
Victory Flags
The script sets user flags on victory:
BLUE_VICTORY = 1when BLUE winsRED_VICTORY = 1when RED wins
Use these in triggers to end missions or transition to next phase.
📋 Requirements
Essential Components
- ✅ DCS World 2.9 or higher
- ✅ MOOSE Framework (latest version)
- ✅ Trigger zones in mission editor
- ✅ BLUEHQ and REDHQ groups
Mission Prerequisites
- At least one trigger zone per capture point
- Exact zone name matching between editor and Lua config
- Both HQ groups must exist (can be hidden/inactive)
📞 Support & Resources
Get Help
- Discord Community: https://discord.gg/7wBVWKK3
- Author: F99th-TracerFacer
- GitHub Issues: Report bugs or request features
Additional Resources
📄 License
This script is provided free for use in DCS World missions. Feel free to modify and distribute.
🙏 Credits
- Author: F99th-TracerFacer
- Framework: MOOSE by FlightControl
- Community: DCS World Mission Makers
🎯 Version History
Version 2.0 (Current)
- ✨ Full dual coalition support (RED & BLUE)
- ✨ Tactical information markers with MGRS coordinates
- ✨ Auto-victory detection and countdown
- ✨ F10 radio menu commands
- ✨ Periodic status reports
- ✨ Enhanced visual feedback system
- ✨ Configurable zone ownership via Lua tables
Version 1.0
- Initial release
- Basic zone capture mechanics
- Single coalition focus
🎮 Happy Mission Making! 🚁
Created with ❤️ for the DCS World Community