mirror of
https://github.com/iTracerFacer/DCS_MissionDev.git
synced 2025-12-03 04:14:46 +00:00
Updatd AWACS
This commit is contained in:
parent
a43724c1af
commit
2fcdcdc744
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +1,5 @@
|
|||||||
-- Define the red and blue zones
|
-- Define the red and blue zones
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local redZones = {
|
local redZones = {
|
||||||
ZONE:New("FrontLine1"),
|
ZONE:New("FrontLine1"),
|
||||||
ZONE:New("FrontLine2"),
|
ZONE:New("FrontLine2"),
|
||||||
@ -38,27 +36,5 @@ Blue_Drone = SPAWN:New("BLUE DRONE")
|
|||||||
:InitLimit(1, 99)
|
:InitLimit(1, 99)
|
||||||
:SpawnScheduled(1, 0.5)
|
:SpawnScheduled(1, 0.5)
|
||||||
|
|
||||||
-- Function to set the drone as a FAC after it spawns
|
|
||||||
Blue_Drone:OnSpawnGroup(function(spawnGroup)
|
|
||||||
local droneGroup = spawnGroup -- Reference to the spawned group
|
|
||||||
local droneUnit = droneGroup:GetUnit(1) -- Get the first unit in the group
|
|
||||||
|
|
||||||
if droneUnit then
|
|
||||||
-- Define a FAC task for the drone
|
|
||||||
local facTask = {
|
|
||||||
id = "FAC",
|
|
||||||
params = {
|
|
||||||
callsign = 1, -- Arbitrary callsign (e.g., "Enfield")
|
|
||||||
frequency = 255.0, -- Frequency for communication
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Set the FAC task to the drone
|
|
||||||
droneUnit:SetTask(facTask)
|
|
||||||
|
|
||||||
env.info("Blue Drone is now a FAC and ready to designate targets.")
|
|
||||||
else
|
|
||||||
env.info("No valid unit found in Blue Drone group.")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|||||||
@ -1,102 +1,40 @@
|
|||||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
-- Red AWACS
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- Define the event handler class for Red AWACS
|
------------------------------------------------------------------------------------------------------------------
|
||||||
RedAwacsEventHandler = EVENTHANDLER:New()
|
|
||||||
|
|
||||||
-- Handle the Birth event for Red AWACS
|
|
||||||
function RedAwacsEventHandler:OnEventBirth(EventData)
|
|
||||||
if EventData.IniDCSGroupName == "RED EWR AWACS" then
|
|
||||||
MESSAGE:New("AWACS has spawned!", 15):ToRed()
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handle the Dead event for Red AWACS
|
|
||||||
function RedAwacsEventHandler:OnEventDead(EventData)
|
|
||||||
if EventData.IniDCSGroupName == "RED EWR AWACS" then
|
|
||||||
MESSAGE:New("AWACS has been destroyed!", 15):ToRed()
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handle the Hit event for Red AWACS
|
|
||||||
function RedAwacsEventHandler:OnEventHit(EventData)
|
|
||||||
if EventData.IniDCSGroupName == "RED EWR AWACS" then
|
|
||||||
MESSAGE:New("AWACS is under attack!", 15):ToRed()
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Create the Red AWACS spawn object
|
|
||||||
Red_Awacs = SPAWN:New("RED EWR AWACS")
|
|
||||||
:InitLimit(1, 99)
|
|
||||||
:InitRepeatOnLanding()
|
|
||||||
:SpawnScheduled(300, 0.5)
|
|
||||||
|
|
||||||
-- Add the event handler to the Red AWACS group
|
|
||||||
RedAwacsEventHandler:HandleEvent(EVENTS.Birth)
|
|
||||||
RedAwacsEventHandler:HandleEvent(EVENTS.Dead)
|
|
||||||
RedAwacsEventHandler:HandleEvent(EVENTS.Hit)
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
-- Blue AWACS
|
-- Blue AWACS
|
||||||
------------------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Define the event handler class for
|
-- Patrol zone.
|
||||||
BlueAwacsEventHandler = EVENTHANDLER:New()
|
local BlueAwacsZone = ZONE:New("BLUE AWACS ZONE")
|
||||||
|
|
||||||
-- Handle the Birth event for Blue AWACS
|
-- AWACS mission. Orbit at 22000 ft, 350 KIAS, heading 270 for 20 NM.
|
||||||
function BlueAwacsEventHandler:OnEventBirth(EventData)
|
local BlueAWACS=AUFTRAG:NewAWACS(BlueAwacsZone:GetCoordinate(), 22000, 350, 270, 20)
|
||||||
if EventData.IniDCSGroupName == "BLUE EWR AWACS" then
|
BlueAWACS:SetTime("8:00", "24:00") -- Set time of operation to 8:00 to 24:00.
|
||||||
MESSAGE:New("AWACS has spawned!", 15):ToBlue()
|
BlueAWACS:SetTACAN(29, "DXS") -- Set TACAN to 29Y.
|
||||||
|
BlueAWACS:SetRadio(251) -- Set radio to 225 MHz AM.
|
||||||
|
|
||||||
end
|
-- Create a flightgroup and set default callsign to Darkstar 1-1
|
||||||
end
|
local BlueAWACSFlightGroup=FLIGHTGROUP:New("BLUE EWR AWACS")
|
||||||
|
BlueAWACSFlightGroup:SetDefaultCallsign(CALLSIGN.AWACS.Darkstar, 1)
|
||||||
|
|
||||||
-- Handle the Dead event for Blue AWACS
|
-- Assign mission to pilot.
|
||||||
function BlueAwacsEventHandler:OnEventDead(EventData)
|
BlueAWACSFlightGroup:AddMission(BlueAWACS)
|
||||||
if EventData.IniDCSGroupName == "BLUE EWR AWACS" then
|
|
||||||
MESSAGE:New("AWACS has been destroyed!", 15):ToBlue()
|
|
||||||
|
|
||||||
end
|
------------------------------------------------------------------------------------------------------------------
|
||||||
end
|
-- Red AWACS
|
||||||
|
------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Handle the Hit event for Blue AWACS
|
-- Patrol zone.
|
||||||
function BlueAwacsEventHandler:OnEventHit(EventData)
|
local RedAwacsZone = ZONE:New("RED AWACS ZONE")
|
||||||
if EventData.IniDCSGroupName == "BLUE EWR AWACS" then
|
|
||||||
MESSAGE:New("AWACS is under attack!", 15):ToBlue()
|
|
||||||
|
|
||||||
end
|
-- AWACS mission. Orbit at 22000 ft, 350 KIAS, heading 90 for 20 NM.
|
||||||
end
|
local RedAWACS = AUFTRAG:NewAWACS(RedAwacsZone:GetCoordinate(), 22000, 350, 90, 20)
|
||||||
|
RedAWACS:SetTime("8:00", "24:00") -- Set time of operation to 8:00 to 24:00.
|
||||||
|
RedAWACS:SetTACAN(30, "RXS") -- Set TACAN to 30Y.
|
||||||
|
RedAWACS:SetRadio(252) -- Set radio to 252 MHz AM.
|
||||||
|
|
||||||
-- Create the Blue AWACS spawn object
|
-- Create a flightgroup and set default callsign to Magic 1-1
|
||||||
Blue_Awacs = SPAWN:New("BLUE EWR AWACS")
|
local RedAWACSFlightGroup = FLIGHTGROUP:New("RED EWR AWACS")
|
||||||
:InitLimit(1, 99)
|
RedAWACSFlightGroup:SetDefaultCallsign(CALLSIGN.AWACS.Magic, 1)
|
||||||
:InitRepeatOnLanding()
|
|
||||||
:SpawnScheduled(300, 0.5)
|
|
||||||
|
|
||||||
-- Add the event handler to the Blue AWACS group
|
-- Assign mission to pilot.
|
||||||
BlueAwacsEventHandler:HandleEvent(EVENTS.Birth)
|
RedAWACSFlightGroup:AddMission(RedAWACS)
|
||||||
BlueAwacsEventHandler:HandleEvent(EVENTS.Dead)
|
|
||||||
BlueAwacsEventHandler:HandleEvent(EVENTS.Hit)
|
|
||||||
|
|
||||||
-- function to destroy the AWACS if it's alive and then respawn it for the specified coalition.
|
|
||||||
function ResetAwacs(coalition)
|
|
||||||
if coalition == "blue" then
|
|
||||||
Blue_Awacs:Destroy()
|
|
||||||
Blue_Awacs:Spawn()
|
|
||||||
elseif coalition == "red" then
|
|
||||||
Red_Awacs:Destroy()
|
|
||||||
Red_Awacs:Spawn()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Create a mission menu to reset the awacs for the specified coalition.
|
|
||||||
MenuCoalitionBlue = MENU_COALITION:New(coalition.side.BLUE, "Reset AWACS", missionMenu)
|
|
||||||
MenuCoalitionBlueAwacs = MENU_COALITION_COMMAND:New(coalition.side.BLUE, "Reset Blue AWACS", MenuCoalitionBlue, ResetAwacs, "blue")
|
|
||||||
|
|
||||||
MenuCoalitionRed = MENU_COALITION:New(coalition.side.RED, "Reset AWACS", missionMenu)
|
|
||||||
MenuCoalitionRedAwacs = MENU_COALITION_COMMAND:New(coalition.side.RED, "Reset Red AWACS", MenuCoalitionRed, ResetAwacs, "red")
|
|
||||||
Loading…
x
Reference in New Issue
Block a user