MOOSE demonstration missions [skip ci]

This commit is contained in:
Applevangelist
2022-02-16 15:09:12 +00:00
parent c106ffdb3d
commit a4231a0c2e
502 changed files with 723 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
---------------------------------------------------------------------------------------------------------------------------------------
-- AIRWING: Fighter Wing
--
-- Kutaisi is the home of the 35th Fighter Wing. For simplicity, the wing consists of only one squadron.
-- That is the 13th Fighter Squadron ("Panthers") who are flying F-16C Vipers.
--
-- An airwing needs a physical structure (e.g. a static warehouse or an aircraft carrier).
-- If that is destroyed, the airwing and its resources are lost as well.
--
-- The central ingredient of airwings are squadrons. Each squadron consists of a single type of airframes.
-- A squadron has certain "capabilities", i.e. mission types it can execute. These need to be set by the mission designer.
-- Each capability can be given a "performance". That is how good this squadron is at this mission.
--
-- Another important factor for an operational airwing are payloads (weapons). Without payloads most missions can not be executed.
-- Therefore payloads also have to be added to the airwing. They are reduced when an asset group of the wing is lauchned on a mission
-- and returned when the asset safely returns to the wing.
--
-- An airwing will always choose the best available squadron for a given mission. The actual choice depends on the performance of the
-- available squadrons and the performance of the available payloads.
--
-- Here, we give the airwing two missions:
--
-- * A CAP mission is assigned to engage all enemy air targets in CAP zone Alpha.
-- * A BAI mission is assigned to attack a group of unarmed trucks at the abandoned airfield near Kobuleti.
--
---------------------------------------------------------------------------------------------------------------------------------------
---
-- Define Squadron(s)
---
-- Squadron of five F-16s two ships (10 airframes in total).
local FS13=SQUADRON:New("F-16 Template", 5, "13th Fighter Squadron") --Ops.Squadron#SQUADRON
FS13:SetGrouping(2) -- Two-ships. Good to have a wingmen.
FS13:SetModex(100) -- Onboard numbers are 100, 101, ...
FS13:SetCallsign(CALLSIGN.Aircraft.Ford) -- Call sign is Ford.
FS13:SetRadio(260) -- Squadon communicates on 260 MHz AM.
FS13:SetSkill(AI.Skill.EXCELLENT) -- These guy are really good.
FS13:AddMissionCapability({AUFTRAG.Type.ORBIT, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.CAP, AUFTRAG.Type.ESCORT}, 90) --Highly specialized in A2A.
FS13:AddMissionCapability({AUFTRAG.Type.BAI, AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBRUNWAY}, 80) --Also very good at A2G.
---
-- Define Airwing
---
-- Create an airwing.
local FW35=AIRWING:New("Warehouse Kutaisi", "35th Fighter Wing") --Ops.AirWing#AIRWING
-- Add squadron(s) to airwing.
FW35:AddSquadron(FS13)
---
-- Airwing Payloads
---
-- Add 10 payloads of AIM-120s used for Intercep, CAP and escort missions. Performance is set to 80, i.e. considered a good loadout for these mission types.
FW35:NewPayload("F-16 Payload AIM-120B*6, Fuel*2", 10, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.CAP, AUFTRAG.Type.ESCORT}, 80)
-- Add 15 payloads of MK-82AIRs used for BAI, bombing, and runway bombing missions. Performance is set to 50, i.e. considered to be mediocre. If there we better loadouts, these would be preferred.
FW35:NewPayload("F-16 Payload AIM-120*2, AIM-9X*2, MK-82AIR*4, FUEL*2, TGP", 15, {AUFTRAG.Type.BAI, AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBRUNWAY}, 50)
---
-- Start Airwing
---
-- Start airwing.
FW35:Start()
---
-- FSM Events
---
--- Function called each time a flight of the airwing goes on a mission.
function FW35:OnAfterFlightOnMission(From, Event, To, FlightGroup, Mission)
local flightgroup=FlightGroup --Ops.FlightGroup#FLIGHTGROUP
local mission=Mission --Ops.Auftrag#AUFTRAG
-- Info message.
local text=string.format("Flight group %s on %s mission %s", flightgroup:GetName(), mission:GetType(), mission:GetName())
env.info(text)
MESSAGE:New(text, 300):ToAll()
end
---
-- Define Targets
---
-- Practice target consising of 5 fire trucks located at the old airfield near Kobuleti forming an X.
local target=TARGET:New(GROUP:FindByName("Red Target X-1"))
---
-- Define Missions
---
-- CAP zone.
local zoneCAP=ZONE:New("CAP Alpha"):DrawZone()
-- CAP mission at zone CAP Alpha. Altitude 12,000 ft, speed 350 KIAS, heading 090 degrees for 20 NM. Auto engage all enemy air targets.
local mCAP=AUFTRAG:NewCAP(zoneCAP, 12000, 350, nil, 090, 20, {"Air"})
-- BAI mission for target group at the Kobuleti X. The mission is repeated up to three times if it fails.
local mBAI=AUFTRAG:NewBAI(target):SetRepeatOnFailure(3)
-- Assign mission to airwing.
FW35:AddMission(mCAP)
FW35:AddMission(mBAI)
---
-- Misc
---
--- Display mission status on screen.
local function MissionStatus()
local text="Missions:"
for _,_mission in pairs(FW35.missionqueue) do
local m=_mission --Ops.Auftrag#AUFTRAG
text=text..string.format("\n- %s %s %s*%d/%d [%d %%] (%s*%d/%d)",
m:GetName(), m:GetState():upper(), m:GetTargetName(), m:CountMissionTargets(), m:GetTargetInitialNumber(), m:GetTargetDamage(), m:GetType(), m:CountOpsGroups(), m:GetNumberOfRequiredAssets())
end
-- Payloads
text=text.."\n\nAvailable Payloads:"
for _,aname in pairs(AUFTRAG.Type) do
local n=FW35:CountPayloadsInStock({aname})
if n>0 then
text=text..string.format("\n%s %d", aname, n)
end
end
-- Info message to all.
MESSAGE:New(text, 25):ToAll()
end
-- Display primary and secondary mission status every 60 seconds.
TIMER:New(MissionStatus):Start(5, 30)

View File

@@ -0,0 +1,6 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
cd "_unpacked"
. 7z a -r -y -tzip "..\$file.miz" *
cd ..

View File

@@ -0,0 +1,7 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
Remove-Item .\_unpacked -Force -Recurse
md "_unpacked"
cd "_unpacked"
. 7z x -r -y "..\$file.miz" *

View File

@@ -0,0 +1,152 @@
---
-- US Airwing at Andersen: BOMBING with ESCORT
--
-- This is a training mission involving a larger amount of bombers from Andersen Airbase.
-- Target are boming circles at Farallon de Medinilla (FdM).
--
-- Two missions with 5 bombers each are assigned. The missions is scheduled for 0805 and 0810 hours, respectively.
--
-- First mission will target "FdM Bombing Circle-1". Each bomber group requires one escort flight (if no escort flights are available, the mission will not start).
-- Bombers will ingress from West to East at 25,000 ft and egress South at 15,000 ft.
--
-- Second mission will target "FdM Bombing Circle-2". Each bomber group requires zero to one escort flight (if escort flights are available they will be assigned, if not, bombers will go without escort).
-- Bombers will ingress from East to West at 30,000 ft and egress South at 18,000 ft.
--
-- Escorts are provided by the "1st US Fighter Squad". This squad has 20 groups but only 8 payloads for escort missions available. Therefore, the first mission will get their escort (as required).
-- However, for the second mission only three out of five bomber groups will have an escort flight.
--
-- Other features:
-- * Each squadron has their own parking spots assigned.
-- * Twenty bombers will be on Alert5 (spawned on the airbase) with loadouts for bombing runs.
-- * Each mission has a separate push time set, i.e. bombers will orbit at the incress position until the push time is reached.
---
-- Blue (US) side.
local US={}
US.Squad={} -- US squadrons.
US.Wing={} -- US airwings.
US.Commander=nil --Ops.Commander#COMMANDER
-- Create a Hornet Squadron.
US.Squad.fsq01=SQUADRON:New("F/A-18C Template", 20, "1st US Fighter Squad") --Ops.Squadron#SQUADRON
US.Squad.fsq01:AddMissionCapability({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.ESCORT}, 100)
US.Squad.fsq01:AddMissionCapability({AUFTRAG.Type.ALERT5})
US.Squad.fsq01:SetModex(100)
US.Squad.fsq01:SetGrouping(1)
US.Squad.fsq01:SetParkingIDs({167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191})
US.Squad.fsq01:SetMissionRange(200)
US.Squad.fsq01:SetRadio(251, radio.modulation.AM)
-- US.Squad.fsq01:SetCallsign(CALLSIGN.Aircraft.Colt)
-- Create a B-52 Squadron.
US.Squad.bsq01=SQUADRON:New("B-52H Template", 10, "1st US Bomber Squad") --Ops.Squadron#SQUADRON
US.Squad.bsq01:AddMissionCapability({AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 80)
US.Squad.bsq01:AddMissionCapability({AUFTRAG.Type.ALERT5})
US.Squad.bsq01:SetModex(200)
US.Squad.bsq01:SetGrouping(1)
US.Squad.bsq01:SetParkingIDs({111, 112, 113, 114, 115, 116, 117, 118, 195, 196})
US.Squad.bsq01:SetMissionRange(200)
US.Squad.bsq01:SetRadio(252, radio.modulation.AM)
--US.Squad.bsq01:SetCallsign(CALLSIGN.Aircraft.Dodge)
-- Create a B-1B Squadron.
US.Squad.bsq02=SQUADRON:New("B-1B Template", 10, "2nd US Bomber Squad") --Ops.Squadron#SQUADRON
US.Squad.bsq02:AddMissionCapability({AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 80)
US.Squad.bsq02:AddMissionCapability({AUFTRAG.Type.ALERT5})
US.Squad.bsq02:SetModex(200)
US.Squad.bsq02:SetParkingIDs({80, 81, 82, 83, 84, 85, 86, 87, 88, 89})
US.Squad.bsq02:SetGrouping(1)
US.Squad.bsq02:SetMissionRange(200)
US.Squad.bsq02:SetRadio(253, radio.modulation.AM)
--US.Squad.bsq02:SetCallsign(CALLSIGN.Aircraft.Chevy)
-- Create a new airwing.
US.Wing.Andersen=AIRWING:New("Warehouse Andersen", "US AW Andersen") --Ops.AirWing#AIRWING
-- Add squadrons to airwing.
for _,squad in pairs(US.Squad) do
US.Wing.Andersen:AddSquadron(squad)
end
---
-- Payloads
---
-- F/A-18 Payloads
US.Wing.Andersen:NewPayload("F/A-18C Payload AIM-9M*6, AIM-7M*2, FUEL*2", 8, {AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.ESCORT}, 80)
-- B-52 Payloads.
US.Wing.Andersen:NewPayload("B-52H Payload Mk 82*51", 10, {AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 80)
US.Wing.Andersen:NewPayload("B-52H Payload Mk-84*18", 10, {AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 70)
US.Wing.Andersen:NewPayload("B-52H Payload Mk20*18", 2, {AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 60)
-- B-1 Payloads.
US.Wing.Andersen:NewPayload("B-1B Payload GBU-31*24", 10, {AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 80)
US.Wing.Andersen:NewPayload("B-1B Payload GBU-38*48", 10, {AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 70)
US.Wing.Andersen:NewPayload("B-1B Payload Mk-82*84", 10, {AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBCARPET, AUFTRAG.Type.BOMBRUNWAY}, 60)
-- Start airwing.
US.Wing.Andersen:Start()
---
-- Missions
---
-- Zones for ingress, target and egress.
local ZoneWest=ZONE:New("Ingress West"):DrawZone()
local ZoneEast=ZONE:New("Ingress East"):DrawZone()
local ZoneSouth=ZONE:New("Egress South"):DrawZone()
local ZoneFdM1=ZONE:New("FdM Bombing Circle-1"):DrawZone()
local ZoneFdM2=ZONE:New("FdM Bombing Circle-2"):DrawZone()
-- Alert 5 mission for bombing. This will place 20 groups with payload capable of BOMBING missions on the airbase in uncontrolled state.
local alert5=AUFTRAG:NewALERT5(AUFTRAG.Type.BOMBING)
alert5:SetRequiredAssets(20)
US.Wing.Andersen:AddMission(alert5)
-- Bombing mission with 5 groups. Each one requires one escort asset. Ingress West, egress South of the target.
-- Mission starts 0805 hours. Push time is 0900 hours. We explicitly assign this to the 1st Bomber Squad.
local bombing1=AUFTRAG:NewBOMBING(ZoneFdM1, 20000)
bombing1:SetPriority(10)
bombing1:SetRequiredAssets(5)
bombing1:SetMissionWaypointCoord(ZoneWest:GetCoordinate())
bombing1:SetMissionAltitude(25000)
bombing1:SetMissionEgressCoord(ZoneSouth:GetCoordinate(), 15000)
bombing1:SetTime("8:05")
bombing1:SetPushTime("9:00")
bombing1:AssignSquadrons({US.Squad.bsq01})
bombing1:SetRequiredEscorts(1, 1)
-- Bombing mission with 5 asset groups. Each one requires one escort asset. Ingress East, egress South of the target.
-- Mission starts at 0815 hours. Push time is 0920 hours. We explicitly assign this to the 2nd Bomber Squad.
local bombing2=AUFTRAG:NewBOMBING(ZoneFdM2, 25000)
bombing2:SetPriority(50)
bombing2:SetRequiredAssets(5)
bombing2:SetMissionWaypointCoord(ZoneEast:GetCoordinate())
bombing2:SetMissionAltitude(30000)
bombing2:SetMissionEgressCoord(ZoneSouth:GetCoordinate(), 18000)
bombing2:SetRequiredEscorts(0, 1)
bombing2:AssignSquadrons({US.Squad.bsq02})
bombing2:SetTime("8:15")
bombing2:SetPushTime("09:20")
-- Assign mission to Airwing at Andersen.
US.Wing.Andersen:AddMission(bombing1)
US.Wing.Andersen:AddMission(bombing2)
--- Function called each time a flight group is send on a mission.
function US.Wing.Andersen:OnAfterFlightOnMission(From, Event, To, FlightGroup, Mission)
local flightgroup=FlightGroup --Ops.FlightGroup#FLIGHTGROUP
local mission=Mission --Ops.Auftrag#AUFTRAG
--- Function called when the flight group gets low on fuel (default < 25% fuel remaining).
function flightgroup:OnAfterFuelLow(From, Event, To)
local text=string.format("Running low on fuel %.2f. Returning to base!", flightgroup:GetFuelMin())
env.info(string.format("FF %s: %s", flightgroup:GetName(), text))
MESSAGE:New(text, 120, flightgroup:GetName()):ToAll()
end
end

View File

@@ -0,0 +1,6 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
cd "_unpacked"
. 7z a -r -y -tzip "..\$file.miz" *
cd ..

View File

@@ -0,0 +1,7 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
Remove-Item .\_unpacked -Force -Recurse
md "_unpacked"
cd "_unpacked"
. 7z x -r -y "..\$file.miz" *

View File

@@ -0,0 +1,393 @@
------------------------------------------------------------
-- The Battle of Tunb
------------------------------------------------------------
--
-- US SitRep
-- =========
--
-- Carrier airwing CVW-9 is attacking Tunb island.
--
-- Our intel has identified several important targets on
-- Tunb island. But they are protected by air defenses.
--
-- Our plan is to
--
-- 1. Gain air superiority by destroying
-- 1.1 The S-75 search radar
-- 1.2 The runway of Tunb AFB
-- 1.3 The Grisha cruising near the island
--
-- 2. Once this is achieved we will attack the targets
-- 2.1 The remaining S-75 launchers
-- 2.2 Scud launchers
-- 2.3 Warehouse holding important red assets
-- 2.4 Infantry (because we can)
--
-- Other assets:
--
-- * Rescue Helo
-- * Recovery Tanker
-- * AWACS
--
-- Remarks:
--
-- * Spawning on the carrier works surprisingly well but is
-- by far not perfect.
-- Therefore, it is important to delay mission starts in
-- order not to have too many aircraft spawn at once.
-- Also introduced an AIRBOSS to separate launches and
-- recoveries.
-- * We use the Super Carrier module because it leads to
-- fewer collisions on the deck, when aircraft are taxiing.
--
------------------------------------------------------------
------------------------------------------------------------
-- BLUE Side: The almighty US
------------------------------------------------------------
-- Blue (US) side.
local US={}
US.Squad={} -- US squadrons.
US.Wing={} -- US airwings.
US.Target={} -- Targets for US forces.
---
-- US Carrier Airwing CVW-9 (CVN-74 USS Stennis)
--
-- CVW-9 Squadrons (October 2010):
--
-- * VFA-14 Tophatters F/A-18E Super Hornet (Modex 100-199) --> F/A-18C Hornet
-- * VFA-41 Black Aces F/A-18F Super Hornet (Modex 200-299) --> F/A-18C Hornet
-- * VFA-97 Warhawks F/A-18F Super Hornet (Modex 300-399) --> F-14B Tomcat
-- * VFA 151 Vigilantes F/A-18E Super Hornet (Modex 400-499) --> S-3B Tanker
-- * VAQ-133 Wizards EA-18G Growler (Modex 500-599) --> Not modelled
-- * VAW-117 Wallbangers E-2C Haweye (Modex 600-609) --> E-2D Hawkeye
-- * HSC-14 Chargers MH-60S Seahawk (Modex 610-699) --> SH-60B Seahawk
-- * HSM-71 Raptors MH-60R Seahawk (Modex 700-?) --> SH-60B Seahawk
-- * VRC-30 Providers C-2A Greyhound (Modex ?-?) --> Not modelled (Could be done with the Military Aircraft Mod)
---
---
-- CVW-9 Squadrons
---
-- VFA-14 Tophatters: Hornet*4*2, Callsign Dodge, Modex 100+, Skill Excellent, specialized on SEAD missions.
US.Squad.VFA14=SQUADRON:New("F-18 Group", 4, "VFA-14 (Tophatters)") --Ops.Squadron#SQUADRON
US.Squad.VFA14:SetGrouping(2)
US.Squad.VFA14:SetModex(100)
US.Squad.VFA14:SetCallsign(CALLSIGN.Aircraft.Dodge)
US.Squad.VFA14:SetRadio(251)
US.Squad.VFA14:SetLivery("VFA-34")
US.Squad.VFA14:SetSkill(AI.Skill.EXCELLENT)
US.Squad.VFA14:AddMissionCapability({AUFTRAG.Type.SEAD, AUFTRAG.Type.ANTISHIP}, 100)
US.Squad.VFA14:AddMissionCapability({AUFTRAG.Type.BAI, AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBRUNWAY}, 50)
-- VFA-41 Black Aces: Hornet*4*2, Callsign Chevy, Modex 200+, Skill Good, A2G specialists.
US.Squad.VFA41=SQUADRON:New("F-18 Group", 4, "VFA-41 (Black Aces)") --Ops.Squadron#SQUADRON
US.Squad.VFA41:SetGrouping(2)
US.Squad.VFA41:SetModex(200)
US.Squad.VFA41:SetCallsign(CALLSIGN.Aircraft.Chevy)
US.Squad.VFA14:SetRadio(252)
US.Squad.VFA41:SetLivery("VFA-83")
US.Squad.VFA41:SetSkill(AI.Skill.GOOD)
US.Squad.VFA41:AddMissionCapability({AUFTRAG.Type.BAI, AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBRUNWAY}, 100)
US.Squad.VFA41:AddMissionCapability({AUFTRAG.Type.SEAD, AUFTRAG.Type.ANTISHIP}, 50)
-- VFA-97 Warhawks: Tomcat*8*2, Callsign Ford, Modex 300+, Skill High, specialized on CAP and INTERCEPT missions.
US.Squad.VFA97=SQUADRON:New("F-14 Group", 8, "VFA-97 (Warhawks)") --Ops.Squadron#SQUADRON
US.Squad.VFA97:SetGrouping(2)
US.Squad.VFA97:SetModex(300)
US.Squad.VFA97:SetCallsign(CALLSIGN.Aircraft.Ford)
US.Squad.VFA97:SetLivery("VF-102 Diamondbacks")
US.Squad.VFA97:SetSkill(AI.Skill.HIGH)
US.Squad.VFA97:SetFuelLowRefuel(true)
US.Squad.VFA97:SetFuelLowThreshold(30)
US.Squad.VFA97:SetTurnoverTime(30, 5)
US.Squad.VFA97:AddMissionCapability({AUFTRAG.Type.GCICAP, AUFTRAG.Type.INTERCEPT}, 100)
-- VFA-151 Vigilantes: S-3B Tanker*4, Callsign Texaco, Modex 400+, Skill Excellent, specialized on TANKER missions.
US.Squad.VFA151=SQUADRON:New("S-3B Tanker Group", 4, "VFA-151 (Vigilantes)") --Ops.Squadron#SQUADRON
US.Squad.VFA151:SetModex(400)
US.Squad.VFA151:SetCallsign(CALLSIGN.Tanker.Texaco)
US.Squad.VFA151:AddTacanChannel(64, 66) -- Squad uses TACAN channels 64, 65, 66
US.Squad.VFA151:SetSkill(AI.Skill.EXCELLENT)
US.Squad.VFA151:AddMissionCapability({AUFTRAG.Type.TANKER}, 100)
-- VAW-117 Wallbangers: Hawkeye*4, Callsign Wizard, Modex 600+, Skill Average, AWACS
US.Squad.VAW117=SQUADRON:New("E-2D Group", 4, "VAW-117 (Wallbangers)") --Ops.Squadron#SQUADRON
US.Squad.VAW117:SetModex(600)
US.Squad.VAW117:SetCallsign(CALLSIGN.AWACS.Wizard)
US.Squad.VAW117:SetLivery("VAW-125 Tigertails")
US.Squad.VAW117:SetSkill(AI.Skill.AVERAGE)
US.Squad.VAW117:AddMissionCapability({AUFTRAG.Type.AWACS})
-- HSC-14 Chargers: Seahawk*4, Callsign Pontiac, Modex 610+, Skill Good, specialized on Anti-ship missions.
US.Squad.HSC14=SQUADRON:New("SH-60B Group", 9, "HSC-14 (Chargers)") --Ops.Squadron#SQUADRON
US.Squad.HSC14:SetModex(610)
US.Squad.HSC14:SetCallsign(CALLSIGN.Aircraft.Pontiac)
US.Squad.HSC14:SetLivery("Hellenic Navy")
US.Squad.HSC14:SetSkill(AI.Skill.GOOD)
US.Squad.HSC14:AddMissionCapability(AUFTRAG.Type.ANTISHIP, 100) -- Specialized on Anti-Ship
US.Squad.HSC14:AddMissionCapability(AUFTRAG.Type.RESCUEHELO, 20) -- Can also do Rescue ops if required.
-- HSM-71 Raptors: Seahawk*4, Callsign Spingfield, Modex 700+, Skill Average, specialized on Rescue missions.
US.Squad.HSM71=SQUADRON:New("SH-60B Group", 2, "HSM-71 (Raptors)") --Ops.Squadron#SQUADRON
US.Squad.HSM71:SetModex(700)
US.Squad.HSM71:SetCallsign(CALLSIGN.Aircraft.Springfield)
US.Squad.HSM71:SetSkill(AI.Skill.AVERAGE)
US.Squad.HSM71:AddMissionCapability({AUFTRAG.Type.RESCUEHELO}, 100)
---
-- CVW-9 Airwing
---
-- Create an airwing.
US.Wing.CVW9=AIRWING:New("USS Stennis", "CVW-9") --Ops.AirWing#AIRWING
-- Set patrol points for CAP, AWACS and tanker missions.
US.Wing.CVW9:AddPatrolPointCAP(ZONE:FindByName("Zone US CAP Alpha"):GetCoordinate(), 20000, 300, 270, 15)
US.Wing.CVW9:AddPatrolPointAWACS(ZONE:FindByName("Zone US AWACS Alpha"):GetCoordinate(), 30000, 350, 90, 25)
US.Wing.CVW9:AddPatrolPointTANKER(ZONE:FindByName("Zone US Tanker Alpha"):GetCoordinate(), 20000, 350, 270, 25)
US.Wing.CVW9:SetNumberCAP(1)
US.Wing.CVW9:SetNumberAWACS(1)
US.Wing.CVW9:SetNumberTankerProbe(1)
US.Wing.CVW9:SetNumberRescuehelo(1)
-- Add squadrons to airwing.
for _,squad in pairs(US.Squad) do
US.Wing.CVW9:AddSquadron(squad)
end
---
-- CVW-9 Payloads
---
-- F-18 payloads.
local pF18_Harpoon=US.Wing.CVW9:NewPayload("F-18 Payload AGM-84D Harpoon", 5, {AUFTRAG.Type.ANTISHIP}, 100)
local pF18_Harm=US.Wing.CVW9:NewPayload("F-18 Payload AGM-88C HARM", 8, {AUFTRAG.Type.SEAD}, 100)
-- Mavs for BAI but also anti-ship and SEAD.
local pF18_Mav=US.Wing.CVW9:NewPayload("F-18 Payload AGM-65E", 5, {AUFTRAG.Type.BAI}, 80)
US.Wing.CVW9:AddPayloadCapability(pF18_Mav, {AUFTRAG.Type.ANTISHIP, AUFTRAG.Type.SEAD}, 20) -- Mavs can do ANTISHIP and SEAD as well but are less performant than Harpoon or HARMs.
-- MK-83 dumb bombs for AG missions.
local pF18_MK83=US.Wing.CVW9:NewPayload("F-18 Payload MK-83", 30, {AUFTRAG.Type.BAI, AUFTRAG.Type.BOMBING, AUFTRAG.Type.BOMBRUNWAY}, 50)
-- F-14 payloads for CAP and INTERCEPT. Phoenix are first, sparrows are second choice.
US.Wing.CVW9:NewPayload("F-14 Payload AIM-54C", 2, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.GCICAP, AUFTRAG.Type.CAP}, 80)
US.Wing.CVW9:NewPayload("F-14 Payload AIM-7M", 20, {AUFTRAG.Type.INTERCEPT, AUFTRAG.Type.GCICAP, AUFTRAG.Type.CAP})
-- SH-60 payloads.
US.Wing.CVW9:NewPayload("SH-60B Group", 50, {AUFTRAG.Type.ORBIT, AUFTRAG.Type.RESCUEHELO})
US.Wing.CVW9:NewPayload("SH-60B Payload AGM-119 Penguin", 20, AUFTRAG.Type.ANTISHIP, 100)
---
-- Start CVW-9
---
-- Start airwing.
US.Wing.CVW9:Start()
---
-- How to win the Battle of Tunb: Targets for the BLUE Side
---
-- Primary targets
US.Target.S75=GROUP:FindByName("S-75 Group") --Wrapper.Group#GROUP
US.Target.TunbAFB=AIRBASE:FindByName(AIRBASE.PersianGulf.Tunb_Island_AFB) --Wrapper.Airbase#AIRBASE
US.Target.Grisha=GROUP:FindByName("Grisha Group") --Wrapper.Group#GROUP
-- Secondary targets
US.Target.Scud=GROUP:FindByName("Red Scud Alpha Group") --Wrapper.Group#GROUP
US.Target.Warehouse=STATIC:FindByName("Warehouse Tunb Island AFB") --Wrapper.Static#STATIC
US.Target.Infantry=GROUP:FindByName("Red Infantry Platoon Alpha Group") --Wrapper.Group#GROUP
---
-- Airboss
--
-- Note: we need this or we still get crashes of taxiing AI on deck.
---
-- Set up an airboss to handle the recovery.
local airboss=AIRBOSS:New("USS Stennis")
airboss:Start()
--- Flight enters marshal.
function airboss:OnAfterMarshal(From, Event, To, flight)
local Rstart, Rstop=airboss:GetNextRecoveryTime(true)
-- No future window or window is opened more than 20 min later.
if Rstart<0 or Rstart-timer.getAbsTime()>20*60 then
airboss:AddRecoveryWindow(5*60, 25*60, 1, nil, true, 20, false)
end
end
---
-- Define missions for CVW-9
--
-- Note: in order to deconflict the carrier deck, we start missions with at certain times or under certain conditions.
---
--- Function returns true, is a unit of a give name is dead.
local function UnitDead(name)
local unit=UNIT:FindByName(name)
if not unit then
return true
else
return not unit:IsAlive()
end
end
--- Function returns true, if the target of a mission was damaged by more than X %. Default 50 %.
local function MissionDamage(Mission, DamageInPercent)
local mission=Mission --Ops.Auftrag#AUFTRAG
return mission:GetTargetDamage() > (DamageInPercent or 50)
end
--- Function returns true, when the carrier is not recovering so aircraft can be launched.
local function CarrierNotRecovering()
return airboss:IsIdle()
end
-- Missions
local mission={}
---
-- Primary Missions
---
-- SEAD mission on the S-75 site. Mission is a success, if the search radar is destroyed.
mission.S75_1=AUFTRAG:NewSEAD(US.Target.S75) --Ops.Auftrag#AUFTRAG
mission.S75_1:SetPriority(1, nil, 1)
mission.S75_1:SetRepeatOnFailure(999)
mission.S75_1:SetRequiredAssets(1)
mission.S75_1:AssignSquadrons({US.Squad.VFA14}) -- We explicitly assign VFA-14 to do the job!
mission.S75_1:SetTime(5*60) -- We wait to let the rescue helo and AWACS take off.
mission.S75_1:SetMissionEgressCoord(ZONE:FindByName("Zone US CAP Alpha"):GetCoordinate(), 5000)
mission.S75_1:AddConditionSuccess(UnitDead, "S75 #001") -- "S75 #001" is the name of the search radar unit.
-- Anti-ship strike to destroy the Grisha after S-75 search radar is dead.
mission.Grisha1=AUFTRAG:NewANTISHIP(US.Target.Grisha, 8000) --Ops.Auftrag#AUFTRAG
mission.Grisha1:SetPriority(1, nil, 1)
mission.Grisha1:SetMissionAltitude(8000)
mission.Grisha1:SetRepeatOnFailure(3)
mission.Grisha1:SetRequiredAssets(4)
mission.Grisha1:AssignSquadrons({US.Squad.VFA14, US.Squad.VFA41}) -- We explicitly assign VFA-14 and VFA-41 to do the job!
mission.Grisha1:AddConditionStart(UnitDead, "S75 #001")
mission.Grisha1:AddConditionStart(CarrierNotRecovering)
-- DEAD mission to finish off the S-75. Mission is started, once the search radar was destroyed.
mission.S75_2=AUFTRAG:NewBAI(US.Target.S75, 10000) --Ops.Auftrag#AUFTRAG
mission.S75_2:SetPriority(1, nil, 1)
mission.S75_2:SetMissionAltitude(10000)
mission.S75_2:SetRepeatOnFailure(3)
mission.S75_2:SetRequiredAssets(2)
mission.S75_2:AddConditionStart(UnitDead, "Grisha")
mission.S75_2:AddConditionStart(CarrierNotRecovering)
-- BOMB RUNWAY mission to destroy the runway at Tunb AFB once the S-75 is 50% damaged but not before 10 min after mission start.
mission.TunbAFB=AUFTRAG:NewBOMBRUNWAY(US.Target.TunbAFB) --Ops.Auftrag#AUFTRAG
mission.TunbAFB:SetPriority(2, nil, 1)
mission.TunbAFB:SetRepeatOnFailure(6)
mission.TunbAFB:SetRequiredAssets(2)
mission.TunbAFB:AddConditionStart(UnitDead, "Grisha")
mission.TunbAFB:AddConditionStart(CarrierNotRecovering)
---
-- Secondary Missions
---
-- BOMBING mission to destroy a warehouse. This could hold an enemy airwing.
mission.Warehouse=AUFTRAG:NewBOMBING(US.Target.Warehouse, 15000) --Ops.Auftrag#AUFTRAG
mission.Warehouse:SetPriority(50, nil, 2)
mission.Warehouse:SetRepeatOnFailure(3)
mission.Warehouse:AddConditionStart(CarrierNotRecovering)
-- BAI to destroy Scud lauchers.
mission.Scud=AUFTRAG:NewBAI(US.Target.Scud) --Ops.Auftrag#AUFTRAG
mission.Scud:SetPriority(20, nil, 2)
mission.Scud:SetRepeatOnFailure(3)
mission.Scud:SetMissionAltitude(5000)
mission.Scud:SetRequiredAssets(2)
mission.Scud:AddConditionStart(CarrierNotRecovering)
-- BAI to destroy some infantry group.
mission.Infantry=AUFTRAG:NewBAI(US.Target.Infantry) --Ops.Auftrag#AUFTRAG
mission.Infantry:SetPriority(50, nil, 2)
mission.Infantry:SetRequiredAssets(2)
mission.Infantry:SetRepeatOnFailure(3)
mission.Infantry:SetMissionAltitude(6000)
mission.Infantry:AddConditionStart(CarrierNotRecovering)
-- Assign missions to airwing CVW-9.
for _,auftrag in pairs(mission) do
US.Wing.CVW9:AddMission(auftrag)
end
--- Display mission status on screen.
local function MissionStatus()
local Ndead=0
local Nkill=0
local text="Primary Missions:"
for _,_mission in pairs(mission) do
local m=_mission --Ops.Auftrag#AUFTRAG
if m:GetImportance()<=1 then
text=text..string.format("\n- %s %s %s*%d/%d [%d %%] (%s*%d/%d)",
m:GetName(), m:GetState():upper(), m:GetTargetName(), m:CountMissionTargets(), m:GetTargetInitialNumber(), m:GetTargetDamage(), m:GetType(), m:CountOpsGroups(), m:GetNumberOfRequiredAssets())
end
Ndead=Ndead+m:GetCasualties()
Nkill=Nkill+m:GetKills()
end
text=text.."\n\nSecondary Missions:"
for _,_mission in pairs(mission) do
local m=_mission --Ops.Auftrag#AUFTRAG
if m:GetImportance()>=2 then
text=text..string.format("\n- %s %s %s*%d/%d [%d %%] (%s*%d/%d)",
m:GetName(), m:GetState():upper(), m:GetTargetName(), m:CountMissionTargets(), m:GetTargetInitialNumber(), m:GetTargetDamage(), m:GetType(), m:CountOpsGroups(), m:GetNumberOfRequiredAssets())
end
Ndead=Ndead+m:GetCasualties()
Nkill=Nkill+m:GetKills()
end
local Nassets=US.Wing.CVW9:CountAssets()
-- Casualties & kills.
text=text..string.format("\n\nAssets: %d | Kills: %d | Casualties: %d", Nassets, Nkill, Ndead)
-- CVN-74 info.
local Rstart, Rstop=airboss:GetNextRecoveryTime()
text=text..string.format("\n\n CVN-74 %s: Marshal %d, Pattern %d, Recovery %s-%s", airboss:GetState(), #airboss.Qmarshal, #airboss.Qpattern, Rstart, Rstop)
-- Display mission status on screen.
MESSAGE:New(text, 60, nil, true):ToAll()
-- Check if battle is won? Assume we won... but all missions need to be a SUCCESS.
local battlewon=true
for _,_mission in pairs(mission) do
local m=_mission --Ops.Auftrag#AUFTRAG
if not m:IsSuccess() then
battlewon=false -- Nope, not yet.
end
end
if battlewon then
US.Wing.CVW9:_Fireworks()
MESSAGE:New("Hurray! Tunb island is ours.", 60):ToAll()
end
end
-- Display primary and secondary mission status every 60 seconds.
TIMER:New(MissionStatus):Start(5, 60)

View File

@@ -0,0 +1,6 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
cd "_unpacked"
. 7z a -r -y -tzip "..\$file.miz" *
cd ..

View File

@@ -0,0 +1,7 @@
$dir = split-path -parent $MyInvocation.MyCommand.Definition
cd $dir
$file = Split-Path $dir -leaf
Remove-Item .\_unpacked -Force -Recurse
md "_unpacked"
cd "_unpacked"
. 7z x -r -y "..\$file.miz" *