diff --git a/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.3.miz b/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.3.miz index 7e932f8..630b88d 100644 Binary files a/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.3.miz and b/DCS_Afgainistan/Insurgent_Sandstorm/F99th-Insurgent_Sandstorm_1.2.3.miz differ diff --git a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua index 0e64749..45bb691 100644 --- a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua +++ b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_DynamicGroundBattle.lua @@ -221,6 +221,49 @@ local blueArmorTemplates = { ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- DO NOT EDIT BELOW THIS LINE ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Function to handle warehouse destruction +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) +end + +-- Create an event handler class +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 + end + end + for _, warehouse in ipairs(blueWarehouses) do + if warehouse:GetName() == unitName then + onWarehouseDestroyed(unitName, "Blue") + return + end + end + 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 + -- Function to add mark points on the map for each warehouse in the provided list local function addMarkPoints(warehouses, coalition) diff --git a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm_Awacs.lua b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm_Awacs.lua index c68a77d..76ca59f 100644 --- a/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm_Awacs.lua +++ b/DCS_Afgainistan/Insurgent_Sandstorm/Moose_InsurgentSandstorm_Awacs.lua @@ -1,4 +1,18 @@ + +BlueAWACS = SPAWN:New("BLUE EWR AWACS") + :InitLimit(1, 99) + :SpawnScheduled(1, 0.5) + +RedAWACS = SPAWN:New("RED EWR AWACS") + :InitLimit(1, 99) + :SpawnScheduled(1, 0.5) + + + + + + --[[ ------------------------------------------------------------------------------------------------------------------ -- Blue AWACS ------------------------------------------------------------------------------------------------------------------ @@ -37,4 +51,6 @@ local RedAWACSFlightGroup = FLIGHTGROUP:New("RED EWR AWACS") RedAWACSFlightGroup:SetDefaultCallsign(CALLSIGN.AWACS.Magic, 1) -- Assign mission to pilot. -RedAWACSFlightGroup:AddMission(RedAWACS) \ No newline at end of file +RedAWACSFlightGroup:AddMission(RedAWACS) + +]] \ No newline at end of file