diff --git a/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.4.miz b/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.4.miz new file mode 100644 index 0000000..2053f6d Binary files /dev/null and b/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.4.miz differ diff --git a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua index 45bb691..f3a4a7e 100644 --- a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua +++ b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua @@ -109,7 +109,7 @@ local SPAWN_SCHED_RED_INFANTRY = 1800 -- Spawn Red Infantry groups every 1800 se local INIT_RED_ARMOR = 15 -- Initial number of Red Armor groups local MAX_RED_ARMOR = 200 -- Maximum number of Red Armor groups -local SPAWN_SCHED_RED_ARMOR = 300 -- Spawn Red Armor groups every 300 seconds +local SPAWN_SCHED_RED_ARMOR = 900 -- Spawn Red Armor groups every 300 seconds local INIT_BLUE_INFANTRY = 5 -- Initial number of Blue Infantry groups local MAX_BLUE_INFANTRY = 100 -- Maximum number of Blue Infantry groups @@ -117,9 +117,9 @@ local SPAWN_SCHED_BLUE_INFANTRY = 1800 -- Spawn Blue Infantry groups every 180 local INIT_BLUE_ARMOR = 15 -- Initial number of Blue Armor groups0 local MAX_BLUE_ARMOR = 200 -- Maximum number of Blue Armor groups -local SPAWN_SCHED_BLUE_ARMOR = 300 -- Spawn Blue Armor groups every 300 seconds +local SPAWN_SCHED_BLUE_ARMOR = 900 -- Spawn Blue Armor groups every 300 seconds -local ASSIGN_TASKS_SCHED = 600 -- Assign tasks to groups every 600 seconds. New groups added will wait this long before moving. +local ASSIGN_TASKS_SCHED = 900 -- Assign tasks to groups every 600 seconds. New groups added will wait this long before moving. @@ -226,10 +226,10 @@ local blueArmorTemplates = { local function onWarehouseDestroyed(warehouseName, coalition) local message = string.format("%s warehouse %s has been destroyed!", coalition, warehouseName) MESSAGE:New(message, 15):ToAll() - SOUND:New("beeps-and-clicks.wav"):ToAll() - - -- Assuming we have a function to update the pilot's score - -- UpdatePilotScore(pilotName, score) + USERSOUND:New("beeps-and-clicks.wav"):ToAll() + env.info(message) + + end -- Create an event handler class @@ -237,33 +237,40 @@ local WarehouseEventHandler = EVENTHANDLER:New() -- Define the event handler function function WarehouseEventHandler:OnEventDead(EventData) - local unit = EventData.IniUnit - if unit then - local unitName = unit:GetName() - for _, warehouse in ipairs(redWarehouses) do - if warehouse:GetName() == unitName then - onWarehouseDestroyed(unitName, "Red") - return + env.info("OnEventDead triggered") + if EventData then + local unitName = EventData.IniUnitName or EventData.IniDCSUnitName + if unitName then + + -- Check red warehouses + for _, warehouse in ipairs(redWarehouses) do + if warehouse:GetName() == unitName then + onWarehouseDestroyed(unitName, "Red") + return + end end - end - for _, warehouse in ipairs(blueWarehouses) do - if warehouse:GetName() == unitName then - onWarehouseDestroyed(unitName, "Blue") - return + + -- Check blue warehouses + for _, warehouse in ipairs(blueWarehouses) do + if warehouse:GetName() == unitName then + onWarehouseDestroyed(unitName, "Blue") + return + end end + + local notWarehouseMessage = "Destroyed unit is not a warehouse: " .. unitName + env.info(notWarehouseMessage) + else + local noUnitMessage = "No unit name available in EventData" + env.info(noUnitMessage) end + else + env.info("EventData is nil") end end --- Set up event handlers for red and blue warehouses -for _, warehouse in ipairs(redWarehouses) do - WarehouseEventHandler:HandleEvent(EVENTS.Dead, warehouse) -end - -for _, warehouse in ipairs(blueWarehouses) do - WarehouseEventHandler:HandleEvent(EVENTS.Dead, warehouse) -end - +-- Set up the event handler globally +WarehouseEventHandler:HandleEvent(EVENTS.Dead) -- Function to add mark points on the map for each warehouse in the provided list local function addMarkPoints(warehouses, coalition) @@ -271,18 +278,22 @@ local function addMarkPoints(warehouses, coalition) if warehouse then local warehousePos = warehouse:GetVec3() local details - if coalition == 2 then - if warehouse:GetCoalition() == 2 then - details = "Warehouse: " .. warehouse:GetName() .. "\nThis warehouse needs to be protected.\n" - else - details = "Warehouse: " .. warehouse:GetName() .. "\nThis is a primary target as it is directly supplying enemy units.\n" - end - elseif coalition == 1 then - if warehouse:GetCoalition() == 1 then - details = "Warehouse: " .. warehouse:GetName() .. "\nThis warehouse needs to be protected.\nNearby Units:\n" - else - details = "Warehouse: " .. warehouse:GetName() .. "\nThis is a primary target as it is directly supplying enemy units.\n" + if warehouse:IsAlive() then + if coalition == 2 then + if warehouse:GetCoalition() == 2 then + details = "Warehouse: " .. warehouse:GetName() .. "\nThis warehouse needs to be protected.\n" + else + details = "Warehouse: " .. warehouse:GetName() .. "\nThis is a primary target as it is directly supplying enemy units.\n" + end + elseif coalition == 1 then + if warehouse:GetCoalition() == 1 then + details = "Warehouse: " .. warehouse:GetName() .. "\nThis warehouse needs to be protected.\nNearby Units:\n" + else + details = "Warehouse: " .. warehouse:GetName() .. "\nThis is a primary target as it is directly supplying enemy units.\n" + end end + else + details = "Warehouse: " .. warehouse:GetName() .. "\nTHIS TARGET HAS BEEN DESTROYED" end local coordinate = COORDINATE:NewFromVec3(warehousePos) @@ -947,12 +958,12 @@ local function checkWinCondition() end if blueOwned then - MESSAGE:New("Blue side wins! They own all the capture zones.", 60):ToAll() - SOUND:New("UsaTheme.ogg"):ToAll() + MESSAGE:New("Blue side wins! They own all the capture zones.", 1800):ToAll() + USERSOUND:New("UsaTheme.ogg"):ToAll() return true elseif redOwned then - MESSAGE:New("Red side wins! They own all the capture zones.", 60):ToAll() - SOUND:New("MotherRussia.ogg"):ToAll() + MESSAGE:New("Red side wins! They own all the capture zones.", 1800):ToAll() + USERSOUND:New("MotherRussia.ogg"):ToAll() return true end return false diff --git a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm.lua b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm.lua index 7113410..5bca619 100644 --- a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm.lua +++ b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm.lua @@ -3,9 +3,9 @@ local TAC_DISPLAY = false -- Set to false to disable Tacview display for AI flig -- How many red/blue aircraft are in the air by default. local RedA2ADefaultOverhead = 1.5 -local RedDefaultCAP = 2 +local RedDefaultCAP = 1 local BlueA2ADefaultOverhead = 1.5 -local BlueDefaultCAP = 2 +local BlueDefaultCAP = 1 -- Create the main mission menu. missionMenu = MENU_MISSION:New("Mission Menu") @@ -77,30 +77,30 @@ if ENABLE_SAMS then RED_SA08 = SPAWN:New("RED EWR SA08") :InitRandomizeZones(RED_AA_ZONES) :InitLimit(8, 8) - :SpawnScheduled(120, 0.5) + :SpawnScheduled(1800, 0.5) -- There are 18 units in this group. Need space for each one in the numbers. So if I want 3 SA10s i'm just rounding up to 60. RED_SA10 = SPAWN:New("RED EWR AA-SA10-1") :InitRandomizeZones(RED_AA_ZONES) :InitLimit(60, 60) - :SpawnScheduled(120, 0.5) + :SpawnScheduled(1800, 0.5) -- There are 12 units in this group. Need space for each one in the numbers. So if I want 4 SA11s i'm just rounding up to 48 RED_SA11 = SPAWN:New("RED EWR AA SA112-1") :InitRandomizeZones(RED_AA_ZONES) :InitLimit(36, 36) - :SpawnScheduled(120, 0.5) + :SpawnScheduled(1800, 0.5) -- There are 11 units in this group. Need space for each one in the numbers. So if I want 4 SA11s i'm just rounding up to 44 RED_SA06 = SPAWN:New("RED EWR SA6") :InitRandomizeZones(RED_AA_ZONES) :InitLimit(33, 33) - :SpawnScheduled(120, 0.5) + :SpawnScheduled(1800, 0.5) RED_SA02 = SPAWN:New("RED EWR SA2") :InitRandomizeZones(RED_AA_ZONES) :InitLimit(60, 60) - :SpawnScheduled(120, 0.5) + :SpawnScheduled(1800, 0.5) end ------------------------------------------------------------------------------------------------------------------------------------------------------