From 05cec436390012f59b041eee822bf7f916dd8d36 Mon Sep 17 00:00:00 2001 From: funkyfranky Date: Mon, 1 Jan 2024 10:48:03 +0000 Subject: [PATCH] Updated Moose.lua --- .../AID-008 - AI_A2A - CAP Grouping Test.lua | 54 +- .../AID-009 - AI_A2A - Border Test.lua | 60 +- .../AID-010 - AI_A2A - RTB and ReEngage.lua | 100 +- ...-011 - AI_A2A - RTB Fuel Treshold test.lua | 102 +- ...-012 - AI_A2A - CAP Time Interval Test.lua | 102 +- .../AID-A2A-013 - Intercept Test.lua | 94 +- ...AID-014 - AI_A2A - DisengageRange Test.lua | 96 +- .../AID-015 - AI_A2A - Takeoff Test.lua | 106 +- .../AID-016 - AI_A2A - Refuel Tanker Test.lua | 100 +- ...AID-017 - AI_A2A - Spawn Altitude Test.lua | 88 +- ...18 - AI_A2A - Unlimited Resources Test.lua | 90 +- .../AID-019 - AI_A2A - Engage Range Test.lua | 62 +- .../AID-A2A-020 - GCI RTB and ReEngage.lua | 120 +- .../AID-021 - AI_A2A - GCI Radius Test.lua | 84 +- .../AID-022 - AI_A2A - GCI Overhead.lua | 98 +- .../AID-A2A-030 - CAP RTB and ReEngage.lua | 108 +- .../AID-A2A-031 - CAP out of fuel.lua | 70 +- .../AID-032 - AI_A2A - CAP Damage.lua | 92 +- ...A2A - CAP Independent Detection in EWR.lua | 94 +- ...A2A - CAP Independent Detection in EWR.lua | 94 +- ...ependent Detection in EWR with Clients.lua | 98 +- .../AID-A2A-050 - Resources.lua | 136 +- .../AID-A2A-051 - Airbase Capture.lua | 134 +- ...60 - AI_A2A - Takeoff From Runway Test.lua | 134 +- ...AI_A2A - Takeoff From Ship Runway Test.lua | 122 +- .../AID-070 - AI_A2A - CAP - Player Exit.lua | 78 +- .../AID-071 - AI_A2A - GCI - Player Exit.lua | 74 +- .../AID-A2A-100 - Demonstration.lua | 256 +- .../AID-A2A-190 - Communication.lua | 262 +- .../AID-A2A-200 - GCICAP Demonstration.lua | 150 +- ...210 - NTTR AI_A2A_GCICAP Demonstration.lua | 108 +- .../NTTR AI_A2A_GCICAP Test.lua | 108 +- .../TAC_NTTR_V.2A_GCICAP_SCRIPT.lua | 3496 ++++++++--------- ...- NORMANDY AI_A2A_GCICAP Demonstration.lua | 54 +- .../AID-A2A-700 - Sound Check English.lua | 284 +- ...001 - Detection and Attack Helicopters.lua | 96 +- ...2G-002 - Patrol and Engage Helicopters.lua | 102 +- ...ction and Attack one Group Helicopters.lua | 104 +- ...ction and Attack one Group Helicopters.lua | 104 +- .../AID-A2G-100 - DefenseRadius.lua | 100 +- .../AID-A2G-110 - Default Engage Limit.lua | 90 +- .../AID-A2G-190 - Communication.lua | 160 +- ...2G-191 - Communication Engage One Unit.lua | 126 +- .../AID-A2G-210 - Depart from Ramp.lua | 84 +- .../AID-A2G-211 - Depart from Hot.lua | 84 +- .../AID-A2G-212 - Depart from Runway.lua | 90 +- .../AID-A2G-213 - Depart from Air.lua | 90 +- .../AID-A2G-250 - Visible before start.lua | 94 +- .../AID-A2G-300 - CAS Helicopters.lua | 62 +- .../AID-A2G-310 - CAS Helicopters Patrol.lua | 66 +- .../AID-A2G-350 - CAS Airplanes.lua | 122 +- .../AID-A2G-351 - CAS Airplanes.lua | 90 +- .../AID-A2G-352 - CAS Airplanes.lua | 90 +- .../AID-A2G-360 - CAS Airplanes Patrol.lua | 86 +- .../AID-A2G-361 - CAS Airplanes Patrol.lua | 80 +- ...A2G-362 - CAS Airplanes Patrol Visible.lua | 94 +- ...-A2G-363 - CAS Airplanes Patrol Refuel.lua | 88 +- .../AID-A2G-400 - BAI Helicopters.lua | 72 +- .../AID-A2G-550 - SEAD Airplanes.lua | 122 +- ...Detection Zones and Attack Helicopters.lua | 92 +- ...01 - Detection Zones and Defense Limit.lua | 96 +- ...2G-702 - Patrol and Engage Sound Check.lua | 118 +- .../AID-A2G-900 - A fun A2G Mission.lua | 56 +- .../AID-A2G-901 - A fun A2G Mission.lua | 70 +- .../AID-A2G-902 - A fun A2G Mission.lua | 88 +- .../AID-A2G-903 - A fun A2G Mission.lua | 110 +- .../AID-A2G-001 - Detection and Engage.lua | 112 +- ...2 - Patrol during Detection and Engage.lua | 132 +- .../AIB-002 - Patrol AI.lua | 86 +- ...-003 - Two coalitions InitCleanUp test.lua | 48 +- .../AIB-004 - Respawn Test when Destroyed.lua | 94 +- ...IB-005 - Patrol AI and Randomize Zones.lua | 102 +- .../AIB-006 - Declutter AI at Airbases.lua | 86 +- ...s For all airports and both coalitions.lua | 326 +- .../AIC-APC-000 - APC/AIC-APC-000 - APC.lua | 40 +- ...PC-001 - APC with Cargo declared in ME.lua | 36 +- .../AIC-APC-002 - APC Move by Game Master.lua | 24 +- ...AIC-APC-003 - APC Troops and Equipment.lua | 28 +- .../AIC-APC-004 - APC Pickup.lua | 58 +- .../AIC-APC-001 - Troops Relocate APC.lua | 58 +- .../AIC-APC-010 - Multiple APC.lua | 26 +- .../AIC-APC-011 - APC Pickup and Deploy.lua | 84 +- .../AI_Cargo.lua | 1166 +++--- .../AIC-PLN-000 - Airplane.lua | 74 +- .../AID-CGO-100 - APC - Pickup and Deploy.lua | 26 +- ...-CGO-110 - APC - Deploy at Group Zones.lua | 34 +- ...GO-120 - APC - Pickup and Deploy Large.lua | 26 +- .../AID-CGO-140 - APC - Event Handling.lua | 344 +- ...PC - Manpads against enemy helicopters.lua | 42 +- ... Manpads and not defending the carrier.lua | 52 +- ...-CGO-152 - APC - Defending the carrier.lua | 56 +- ...-160 - APC - Spawning of cargo objects.lua | 86 +- ...O-200 - Helicopter - Pickup and Deploy.lua | 26 +- ...GO-201 - Helicopter - DeployZone Orbit.lua | 28 +- ...- Helicopter - Spawning of Helicopters.lua | 36 +- ...03 - Helicopter - Spawning of Infantry.lua | 60 +- .../AID-CGO-210 - Helicopter - Home.lua | 26 +- ...0 - Helicopter - Randomize Coordinates.lua | 32 +- ... - Helicopter - DeployZone Probability.lua | 34 +- ...- Helicopter - Unloaded Event Handling.lua | 352 +- ...- Helicopter - Front-Line Enforcements.lua | 412 +- ...CGO-300 - Airplane - Pickup and Deploy.lua | 34 +- ... Airplane - Pickup and Deploy Multiple.lua | 42 +- ...ID-CGO-340 - Airplane - Event Handling.lua | 306 +- .../AIC-HEL-000 - Helicopter.lua | 76 +- .../AIC-HEL-000 - Helicopter.lua | 76 +- 106 files changed, 7510 insertions(+), 7510 deletions(-) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-008 - CAP Grouping Test/AID-008 - AI_A2A - CAP Grouping Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-008 - CAP Grouping Test/AID-008 - AI_A2A - CAP Grouping Test.lua index 6a99afe218..759947cc3f 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-008 - CAP Grouping Test/AID-008 - AI_A2A - CAP Grouping Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-008 - CAP Grouping Test/AID-008 - AI_A2A - CAP Grouping Test.lua @@ -1,27 +1,27 @@ ---- --- Name: AID-008 - AI_A2A - CAP Grouping Test --- Author: FlightControl --- Date Created: 06 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" } ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200 ) -A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 10, 30, 1 ) -A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) +--- +-- Name: AID-008 - AI_A2A - CAP Grouping Test +-- Author: FlightControl +-- Date Created: 06 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" } ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200 ) +A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 10, 30, 1 ) +A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-009 - Border Test/AID-009 - AI_A2A - Border Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-009 - Border Test/AID-009 - AI_A2A - Border Test.lua index 7eb50e410a..3c3088e11a 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-009 - Border Test/AID-009 - AI_A2A - Border Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-009 - Border Test/AID-009 - AI_A2A - Border Test.lua @@ -1,30 +1,30 @@ ---- --- Name: AID-009 - AI_A2A - Border Test --- Author: FlightControl --- Date Created: 06 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Setup the border zone. --- In this case the border is a POLYGON, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - -A2ADispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Sochi", 1000, 1500 ) +--- +-- Name: AID-009 - AI_A2A - Border Test +-- Author: FlightControl +-- Date Created: 06 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Setup the border zone. +-- In this case the border is a POLYGON, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Sochi", 1000, 1500 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-010 - RTB and ReEngage/AID-010 - AI_A2A - RTB and ReEngage.lua b/AI/AI_A2A_Dispatcher/AID-A2A-010 - RTB and ReEngage/AID-010 - AI_A2A - RTB and ReEngage.lua index 3ee9b57687..1170c6d005 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-010 - RTB and ReEngage/AID-010 - AI_A2A - RTB and ReEngage.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-010 - RTB and ReEngage/AID-010 - AI_A2A - RTB and ReEngage.lua @@ -1,50 +1,50 @@ ---- --- Name: AID-010 - AI_A2A - RTB and ReEngage --- Author: FlightControl --- Date Created: 30 May 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) - -A2ADispatcher:SetDefaultTakeoffFromParkingCold() -A2ADispatcher:SetDefaultLandingAtEngineShutdown() - --- Blue attack simulation - -local Frequency = 180 - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 8, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) - +--- +-- Name: AID-010 - AI_A2A - RTB and ReEngage +-- Author: FlightControl +-- Date Created: 30 May 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) + +A2ADispatcher:SetDefaultTakeoffFromParkingCold() +A2ADispatcher:SetDefaultLandingAtEngineShutdown() + +-- Blue attack simulation + +local Frequency = 180 + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 8, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-011 - RTB Fuel Treshold test/AID-011 - AI_A2A - RTB Fuel Treshold test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-011 - RTB Fuel Treshold test/AID-011 - AI_A2A - RTB Fuel Treshold test.lua index 961536b879..b619f66c84 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-011 - RTB Fuel Treshold test/AID-011 - AI_A2A - RTB Fuel Treshold test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-011 - RTB Fuel Treshold test/AID-011 - AI_A2A - RTB Fuel Treshold test.lua @@ -1,51 +1,51 @@ ---- --- Name: AID-011 - AI_A2A - RTB Fuel Threshold test --- Author: FlightControl --- Date Created: 30 Jul 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Set the fuel treshold to 40%. Airplanes will return when only 40% of fuel left in the tank. -A2ADispatcher:SetDefaultFuelThreshold( 0.4 ) - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronOverhead( "Sochi", 1 ) -A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) - --- CAP Squadron execution. - -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) - -A2ADispatcher:SetSquadronTakeoffFromParkingHot("Sochi") -A2ADispatcher:SetSquadronLandingAtEngineShutdown("Sochi") - - +--- +-- Name: AID-011 - AI_A2A - RTB Fuel Threshold test +-- Author: FlightControl +-- Date Created: 30 Jul 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Set the fuel treshold to 40%. Airplanes will return when only 40% of fuel left in the tank. +A2ADispatcher:SetDefaultFuelThreshold( 0.4 ) + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronOverhead( "Sochi", 1 ) +A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) + +-- CAP Squadron execution. + +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) + +A2ADispatcher:SetSquadronTakeoffFromParkingHot("Sochi") +A2ADispatcher:SetSquadronLandingAtEngineShutdown("Sochi") + + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-012 - CAP Time Interval Test/AID-012 - AI_A2A - CAP Time Interval Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-012 - CAP Time Interval Test/AID-012 - AI_A2A - CAP Time Interval Test.lua index efbc4a4bb5..47005e4104 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-012 - CAP Time Interval Test/AID-012 - AI_A2A - CAP Time Interval Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-012 - CAP Time Interval Test/AID-012 - AI_A2A - CAP Time Interval Test.lua @@ -1,51 +1,51 @@ ---- --- Name: AID-012 - AI_A2A - CAP Time Interval Test --- Author: FlightControl --- Date Created: 30 Jul 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - - -A2ADispatcher:SetTacticalDisplay( true ) - -A2ADispatcher:SetDefaultCapLimit( 2 ) -A2ADispatcher:SetDefaultCapTimeInterval( 300, 300 ) -- Spawn each 5 minutes. - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronOverhead( "Sochi", 1 ) -A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) - --- CAP Squadron execution. - -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) - - -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) - -A2ADispatcher:SetSquadronTakeoffFromParkingHot("Sochi") -A2ADispatcher:SetSquadronLandingAtEngineShutdown("Sochi") - - +--- +-- Name: AID-012 - AI_A2A - CAP Time Interval Test +-- Author: FlightControl +-- Date Created: 30 Jul 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +A2ADispatcher:SetDefaultCapLimit( 2 ) +A2ADispatcher:SetDefaultCapTimeInterval( 300, 300 ) -- Spawn each 5 minutes. + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronOverhead( "Sochi", 1 ) +A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) + +-- CAP Squadron execution. + +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) + + +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) + +A2ADispatcher:SetSquadronTakeoffFromParkingHot("Sochi") +A2ADispatcher:SetSquadronLandingAtEngineShutdown("Sochi") + + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-013 - Intercept Test/AID-A2A-013 - Intercept Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-013 - Intercept Test/AID-A2A-013 - Intercept Test.lua index 5812b35678..c61df867a5 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-013 - Intercept Test/AID-A2A-013 - Intercept Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-013 - Intercept Test/AID-A2A-013 - Intercept Test.lua @@ -1,47 +1,47 @@ ---- --- Name: AID-A2A-013 - Intercept Test --- Author: FlightControl --- Date Created: 31 Jul 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Test intercept. -A2ADispatcher:SetIntercept( 450 ) - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" }, 20 ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) -A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Sochi" ) - -A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Gelend" ) -A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Gelend" ) - -A2ADispatcher:Start() - +--- +-- Name: AID-A2A-013 - Intercept Test +-- Author: FlightControl +-- Date Created: 31 Jul 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Test intercept. +A2ADispatcher:SetIntercept( 450 ) + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" }, 20 ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) +A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Sochi" ) + +A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Gelend" ) +A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Gelend" ) + +A2ADispatcher:Start() + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-014 - DisengageRange Test/AID-014 - AI_A2A - DisengageRange Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-014 - DisengageRange Test/AID-014 - AI_A2A - DisengageRange Test.lua index 4497adbaac..86e6d1f4b5 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-014 - DisengageRange Test/AID-014 - AI_A2A - DisengageRange Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-014 - DisengageRange Test/AID-014 - AI_A2A - DisengageRange Test.lua @@ -1,48 +1,48 @@ ---- --- Name: AID-014 - AI_A2A - DisengageRange Test --- Author: FlightControl --- Date Created: 31 Jul 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Test intercept. -A2ADispatcher:SetIntercept( 450 ) - --- Test an other disengage radius. -A2ADispatcher:SetDisengageRadius( 150000 ) - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" }, 20 ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) - - -A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Gelend" ) - - +--- +-- Name: AID-014 - AI_A2A - DisengageRange Test +-- Author: FlightControl +-- Date Created: 31 Jul 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Test intercept. +A2ADispatcher:SetIntercept( 450 ) + +-- Test an other disengage radius. +A2ADispatcher:SetDisengageRadius( 150000 ) + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" }, 20 ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) + + +A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Gelend" ) + + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-015 - Takeoff Test/AID-015 - AI_A2A - Takeoff Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-015 - Takeoff Test/AID-015 - AI_A2A - Takeoff Test.lua index 2796f41b4c..cb7aea1b09 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-015 - Takeoff Test/AID-015 - AI_A2A - Takeoff Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-015 - Takeoff Test/AID-015 - AI_A2A - Takeoff Test.lua @@ -1,53 +1,53 @@ ---- --- Name: AID-015 - AI_A2A - Takeoff Test --- Author: FlightControl --- Date Created: 01 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Test intercept. -A2ADispatcher:SetIntercept( 450 ) - --- Test an other disengage radius. -A2ADispatcher:SetDisengageRadius( 20000 ) - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" }, 20 ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) - -A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Gelend" ) - -A2ADispatcher:SetSquadron( "Anapa", AIRBASE.Caucasus.Anapa_Vityazevo, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Anapa", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffInAir( "Anapa" ) - -A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Novo", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) +--- +-- Name: AID-015 - AI_A2A - Takeoff Test +-- Author: FlightControl +-- Date Created: 01 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Test intercept. +A2ADispatcher:SetIntercept( 450 ) + +-- Test an other disengage radius. +A2ADispatcher:SetDisengageRadius( 20000 ) + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" }, 20 ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) + +A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Gelend" ) + +A2ADispatcher:SetSquadron( "Anapa", AIRBASE.Caucasus.Anapa_Vityazevo, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Anapa", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffInAir( "Anapa" ) + +A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Novo", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-016 - Refuel Tanker Test/AID-016 - AI_A2A - Refuel Tanker Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-016 - Refuel Tanker Test/AID-016 - AI_A2A - Refuel Tanker Test.lua index 30f98a5842..42ceeccfc8 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-016 - Refuel Tanker Test/AID-016 - AI_A2A - Refuel Tanker Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-016 - Refuel Tanker Test/AID-016 - AI_A2A - Refuel Tanker Test.lua @@ -1,50 +1,50 @@ ---- --- Name: AID-016 - AI_A2A - Refuel Tanker Test --- Author: FlightControl --- Date Created: 01 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Test intercept. -A2ADispatcher:SetIntercept( 450 ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 ) -A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 ) -A2ADispatcher:SetSquadronCapInterval("Sochi", 2, 30, 600, 1 ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) - - -A2ADispatcher:SetDefaultFuelThreshold( 0.9 ) -A2ADispatcher:SetDefaultTanker( "Tanker" ) - - -A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-30" }, 20 ) -A2ADispatcher:SetSquadronCap( "Gelend", ZONE:New( "PatrolZoneGelend" ), 4000, 8000, 600, 800, 1000, 1300 ) -A2ADispatcher:SetSquadronCapInterval( "Gelend", 2, 30, 600, 1 ) -A2ADispatcher:SetSquadronGci( "Gelend", 900, 1200 ) - -A2ADispatcher:SetSquadronFuelThreshold( "Gelend", 0.8 ) -A2ADispatcher:SetSquadronTanker( "Gelend", "TankerGelend" ) - - +--- +-- Name: AID-016 - AI_A2A - Refuel Tanker Test +-- Author: FlightControl +-- Date Created: 01 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Test intercept. +A2ADispatcher:SetIntercept( 450 ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 ) +A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 ) +A2ADispatcher:SetSquadronCapInterval("Sochi", 2, 30, 600, 1 ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) + + +A2ADispatcher:SetDefaultFuelThreshold( 0.9 ) +A2ADispatcher:SetDefaultTanker( "Tanker" ) + + +A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-30" }, 20 ) +A2ADispatcher:SetSquadronCap( "Gelend", ZONE:New( "PatrolZoneGelend" ), 4000, 8000, 600, 800, 1000, 1300 ) +A2ADispatcher:SetSquadronCapInterval( "Gelend", 2, 30, 600, 1 ) +A2ADispatcher:SetSquadronGci( "Gelend", 900, 1200 ) + +A2ADispatcher:SetSquadronFuelThreshold( "Gelend", 0.8 ) +A2ADispatcher:SetSquadronTanker( "Gelend", "TankerGelend" ) + + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-017 - Spawn Altitude Test/AID-017 - AI_A2A - Spawn Altitude Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-017 - Spawn Altitude Test/AID-017 - AI_A2A - Spawn Altitude Test.lua index cb451153cb..6f536f82ec 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-017 - Spawn Altitude Test/AID-017 - AI_A2A - Spawn Altitude Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-017 - Spawn Altitude Test/AID-017 - AI_A2A - Spawn Altitude Test.lua @@ -1,44 +1,44 @@ ---- --- Name: AID-017 - AI_A2A - Spawn Altitude Test --- Author: FlightControl --- Date Created: 05 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - --- Set the default takeoff method in the air. -A2ADispatcher:SetDefaultTakeoffInAir() - --- Set the default takeoff altitude at 2000 meters. -A2ADispatcher:SetDefaultTakeoffInAirAltitude( 2000 ) -- Takeoff by default at 2000 meters. - - --- Spawn for Sochi airbase. -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 ) -A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 ) -A2ADispatcher:SetSquadronCapInterval("Sochi", 2, 30, 600, 1 ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) - - --- Spawn for Gelend airbase. -A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-30" }, 20 ) -A2ADispatcher:SetSquadronCap( "Gelend", ZONE:New( "PatrolZoneGelend" ), 4000, 8000, 600, 800, 1000, 1300 ) -A2ADispatcher:SetSquadronCapInterval( "Gelend", 2, 30, 600, 1 ) -A2ADispatcher:SetSquadronGci( "Gelend", 900, 1200 ) - --- Let Gelend squadron take off in the air at 4000 meters. -A2ADispatcher:SetSquadronTakeoffInAir( "Gelend", 4000 ) -- Takeoff in Gelend at 4000 meters. - - --- Run the mission and observe the spawning altitudes. +--- +-- Name: AID-017 - AI_A2A - Spawn Altitude Test +-- Author: FlightControl +-- Date Created: 05 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Set the default takeoff method in the air. +A2ADispatcher:SetDefaultTakeoffInAir() + +-- Set the default takeoff altitude at 2000 meters. +A2ADispatcher:SetDefaultTakeoffInAirAltitude( 2000 ) -- Takeoff by default at 2000 meters. + + +-- Spawn for Sochi airbase. +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-34" }, 20 ) +A2ADispatcher:SetSquadronCap( "Sochi", ZONE:New( "PatrolZone" ), 4000, 8000, 600, 800, 1000, 1300 ) +A2ADispatcher:SetSquadronCapInterval("Sochi", 2, 30, 600, 1 ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) + + +-- Spawn for Gelend airbase. +A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-30" }, 20 ) +A2ADispatcher:SetSquadronCap( "Gelend", ZONE:New( "PatrolZoneGelend" ), 4000, 8000, 600, 800, 1000, 1300 ) +A2ADispatcher:SetSquadronCapInterval( "Gelend", 2, 30, 600, 1 ) +A2ADispatcher:SetSquadronGci( "Gelend", 900, 1200 ) + +-- Let Gelend squadron take off in the air at 4000 meters. +A2ADispatcher:SetSquadronTakeoffInAir( "Gelend", 4000 ) -- Takeoff in Gelend at 4000 meters. + + +-- Run the mission and observe the spawning altitudes. diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-018 - Unlimited Resources Test/AID-018 - AI_A2A - Unlimited Resources Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-018 - Unlimited Resources Test/AID-018 - AI_A2A - Unlimited Resources Test.lua index 818e34171b..e1f5e88b02 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-018 - Unlimited Resources Test/AID-018 - AI_A2A - Unlimited Resources Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-018 - Unlimited Resources Test/AID-018 - AI_A2A - Unlimited Resources Test.lua @@ -1,45 +1,45 @@ ---- --- Name: AID-018 - AI_A2A - Unlimited Resources Test --- Author: FlightControl --- Date Created: 05 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - - -A2ADispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. --- Unlimited resources, as the Resources parameter of the :SetSquadron method is not given. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" } ) -A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) - -A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Gelend" ) - -A2ADispatcher:SetSquadron( "Anapa", AIRBASE.Caucasus.Anapa_Vityazevo, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Anapa", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Anapa" ) - -A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Novo", 800, 1200 ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Novo" ) - +--- +-- Name: AID-018 - AI_A2A - Unlimited Resources Test +-- Author: FlightControl +-- Date Created: 05 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + + +A2ADispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. +-- Unlimited resources, as the Resources parameter of the :SetSquadron method is not given. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP MIG-31" } ) +A2ADispatcher:SetSquadronGci( "Sochi", 900, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Sochi" ) + +A2ADispatcher:SetSquadron( "Gelend", AIRBASE.Caucasus.Gelendzhik, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Gelend", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Gelend" ) + +A2ADispatcher:SetSquadron( "Anapa", AIRBASE.Caucasus.Anapa_Vityazevo, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Anapa", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Anapa" ) + +A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Novo", 800, 1200 ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Novo" ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-019 - Engage Range Test/AID-019 - AI_A2A - Engage Range Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-019 - Engage Range Test/AID-019 - AI_A2A - Engage Range Test.lua index 1e359cacbb..5c576b2e18 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-019 - Engage Range Test/AID-019 - AI_A2A - Engage Range Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-019 - Engage Range Test/AID-019 - AI_A2A - Engage Range Test.lua @@ -1,31 +1,31 @@ ---- --- Name: AID-019 - AI_A2A - Engage Range Test --- Author: FlightControl --- Date Created: 06 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a radius of 50km where any airborne friendly --- without an assignment within 50km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 50000 ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" } ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200 ) -A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 10, 30, 1 ) - +--- +-- Name: AID-019 - AI_A2A - Engage Range Test +-- Author: FlightControl +-- Date Created: 06 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a radius of 50km where any airborne friendly +-- without an assignment within 50km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 50000 ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27" } ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200 ) +A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 10, 30, 1 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-020 - GCI RTB and ReEngage/AID-A2A-020 - GCI RTB and ReEngage.lua b/AI/AI_A2A_Dispatcher/AID-A2A-020 - GCI RTB and ReEngage/AID-A2A-020 - GCI RTB and ReEngage.lua index 958046a556..36229dbafa 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-020 - GCI RTB and ReEngage/AID-A2A-020 - GCI RTB and ReEngage.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-020 - GCI RTB and ReEngage/AID-A2A-020 - GCI RTB and ReEngage.lua @@ -1,60 +1,60 @@ ---- --- Name: AID-A2A-020 - GCI RTB and ReEngage --- Author: FlightControl --- Date Created: 30 May 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) ---A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Center, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Kras1", 900, 1200 ) - -A2ADispatcher:SetSquadron( "Kras2", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Kras2", 900, 1200 ) - -A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "May", 900, 1200 ) - - - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - -A2ADispatcher:Start() - --- Blue attack simulation - -local Frequency = 300 - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 8, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) - +--- +-- Name: AID-A2A-020 - GCI RTB and ReEngage +-- Author: FlightControl +-- Date Created: 30 May 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +--A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Center, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Kras1", 900, 1200 ) + +A2ADispatcher:SetSquadron( "Kras2", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Kras2", 900, 1200 ) + +A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "May", 900, 1200 ) + + + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + +A2ADispatcher:Start() + +-- Blue attack simulation + +local Frequency = 300 + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 8, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-021 - GCI Radius Test/AID-021 - AI_A2A - GCI Radius Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-021 - GCI Radius Test/AID-021 - AI_A2A - GCI Radius Test.lua index 005dec8589..9f04adff59 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-021 - GCI Radius Test/AID-021 - AI_A2A - GCI Radius Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-021 - GCI Radius Test/AID-021 - AI_A2A - GCI Radius Test.lua @@ -1,42 +1,42 @@ ---- --- Name: AID-021 - AI_A2A - GCI Radius Test --- Author: FlightControl --- Date Created: 30 May 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - -A2ADispatcher:SetGciRadius( 100000 ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Center, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Kras1", 900, 1200 ) - -A2ADispatcher:SetSquadron( "Kras2", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Kras2", 900, 1200 ) - -A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "May", 900, 1200 ) - - - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - +--- +-- Name: AID-021 - AI_A2A - GCI Radius Test +-- Author: FlightControl +-- Date Created: 30 May 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + +A2ADispatcher:SetGciRadius( 100000 ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Center, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Kras1", 900, 1200 ) + +A2ADispatcher:SetSquadron( "Kras2", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Kras2", 900, 1200 ) + +A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "May", 900, 1200 ) + + + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-022 - GCI Overhead/AID-022 - AI_A2A - GCI Overhead.lua b/AI/AI_A2A_Dispatcher/AID-A2A-022 - GCI Overhead/AID-022 - AI_A2A - GCI Overhead.lua index ef77cdb41b..d635243097 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-022 - GCI Overhead/AID-022 - AI_A2A - GCI Overhead.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-022 - GCI Overhead/AID-022 - AI_A2A - GCI Overhead.lua @@ -1,49 +1,49 @@ ---- --- Name: AID-022 - AI_A2A - GCI Overhead --- Author: FlightControl --- Date Created: 05 Sep 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "May", 900, 1200 ) -A2ADispatcher:SetSquadronOverhead( "May", 0.25 ) - -A2ADispatcher:SetSquadron( "Kras", AIRBASE.Caucasus.Krasnodar_Center, { "SQ CCCP SU-27" } ) -A2ADispatcher:SetSquadronGci( "Kras", 900, 1200 ) -A2ADispatcher:SetSquadronOverhead( "Kras", 1.5 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - --- Blue attack simulation - -local Frequency = 30 - -BlueSpawn2 = SPAWN - :New( "RT NATO" ) - :InitLimit( 1, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) - +--- +-- Name: AID-022 - AI_A2A - GCI Overhead +-- Author: FlightControl +-- Date Created: 05 Sep 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "May", 900, 1200 ) +A2ADispatcher:SetSquadronOverhead( "May", 0.25 ) + +A2ADispatcher:SetSquadron( "Kras", AIRBASE.Caucasus.Krasnodar_Center, { "SQ CCCP SU-27" } ) +A2ADispatcher:SetSquadronGci( "Kras", 900, 1200 ) +A2ADispatcher:SetSquadronOverhead( "Kras", 1.5 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + +-- Blue attack simulation + +local Frequency = 30 + +BlueSpawn2 = SPAWN + :New( "RT NATO" ) + :InitLimit( 1, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-030 - CAP RTB and ReEngage/AID-A2A-030 - CAP RTB and ReEngage.lua b/AI/AI_A2A_Dispatcher/AID-A2A-030 - CAP RTB and ReEngage/AID-A2A-030 - CAP RTB and ReEngage.lua index c737f8b2cd..897aa41b2a 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-030 - CAP RTB and ReEngage/AID-A2A-030 - CAP RTB and ReEngage.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-030 - CAP RTB and ReEngage/AID-A2A-030 - CAP RTB and ReEngage.lua @@ -1,54 +1,54 @@ ---- --- Name: AID-A2A-030 - CAP RTB and ReEngage --- Author: FlightControl --- Date Created: 30 May 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) ---Detection:BoundDetectedZones() - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 200000 ) - -A2ADispatcher:SetDisengageRadius( 200000 ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", 800, 1200, 4000, 8000, CAPZoneWest, 600, 800, 4000, 8000, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 4, 30, 120, 1 ) - -A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCapV2( "May", 800, 1200, 400, 500, "RADIO", CAPZoneWest, 600, 800, 4000, 8000, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120, 1 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - --- Blue attack simulation - -local Frequency = 150 - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 6, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) - +--- +-- Name: AID-A2A-030 - CAP RTB and ReEngage +-- Author: FlightControl +-- Date Created: 30 May 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) +--Detection:BoundDetectedZones() + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 200000 ) + +A2ADispatcher:SetDisengageRadius( 200000 ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", 800, 1200, 4000, 8000, CAPZoneWest, 600, 800, 4000, 8000, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 4, 30, 120, 1 ) + +A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCapV2( "May", 800, 1200, 400, 500, "RADIO", CAPZoneWest, 600, 800, 4000, 8000, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120, 1 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + +-- Blue attack simulation + +local Frequency = 150 + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 6, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-031 - CAP out of fuel/AID-A2A-031 - CAP out of fuel.lua b/AI/AI_A2A_Dispatcher/AID-A2A-031 - CAP out of fuel/AID-A2A-031 - CAP out of fuel.lua index 86e23456f0..4f834949f4 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-031 - CAP out of fuel/AID-A2A-031 - CAP out of fuel.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-031 - CAP out of fuel/AID-A2A-031 - CAP out of fuel.lua @@ -1,35 +1,35 @@ ---- --- Name: AID-A2A-031 - CAP out of fuel --- Author: FlightControl --- Date Created: 30 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 1, 30, 120, 1 ) - -A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCapV2( "May", 1000, 1200, 30, 30, "RADIO", CAPZoneWest, 600, 800, 4000, 8000, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120, 1 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - +--- +-- Name: AID-A2A-031 - CAP out of fuel +-- Author: FlightControl +-- Date Created: 30 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 1, 30, 120, 1 ) + +A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCapV2( "May", 1000, 1200, 30, 30, "RADIO", CAPZoneWest, 600, 800, 4000, 8000, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120, 1 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-032 - CAP Damage/AID-032 - AI_A2A - CAP Damage.lua b/AI/AI_A2A_Dispatcher/AID-A2A-032 - CAP Damage/AID-032 - AI_A2A - CAP Damage.lua index 593405cd35..bc8ac1a207 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-032 - CAP Damage/AID-032 - AI_A2A - CAP Damage.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-032 - CAP Damage/AID-032 - AI_A2A - CAP Damage.lua @@ -1,46 +1,46 @@ ---- --- Name: AID-032 - AI_A2A - CAP Damage --- Author: FlightControl --- Date Created: 29 Oct 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP MIG-31" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 2, 30, 120, 1 ) - ---A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) ---CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) ---A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) ---A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120, 1 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingAtEngineShutdown() - --- Blue attack simulation - -local Frequency = 300 - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 6, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) +--- +-- Name: AID-032 - AI_A2A - CAP Damage +-- Author: FlightControl +-- Date Created: 29 Oct 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP MIG-31" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 2, 30, 120, 1 ) + +--A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) +--CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +--A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +--A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120, 1 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingAtEngineShutdown() + +-- Blue attack simulation + +local Frequency = 300 + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 6, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-040 - CAP Independent Detection in EWR/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua b/AI/AI_A2A_Dispatcher/AID-A2A-040 - CAP Independent Detection in EWR/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua index 234f37407c..2446a50124 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-040 - CAP Independent Detection in EWR/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-040 - CAP Independent Detection in EWR/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua @@ -1,47 +1,47 @@ ---- --- Name: AID-040 - AI_A2A - CAP Independent Detection in EWR --- Author: FlightControl --- Date Created: 30 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - - -A2ADispatcher:SetEngageRadius( 90000 ) --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 4, 30, 120 ) - ---A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) ---CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) ---A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) ---A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - --- Blue attack simulation - -local Frequency = 180 - -BlueSpawn2 = SPAWN - :New( "RT NATO" ) - :InitLimit( 2, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) +--- +-- Name: AID-040 - AI_A2A - CAP Independent Detection in EWR +-- Author: FlightControl +-- Date Created: 30 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +A2ADispatcher:SetEngageRadius( 90000 ) +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 4, 30, 120 ) + +--A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) +--CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +--A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +--A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + +-- Blue attack simulation + +local Frequency = 180 + +BlueSpawn2 = SPAWN + :New( "RT NATO" ) + :InitLimit( 2, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua b/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua index 234f37407c..2446a50124 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-040 - AI_A2A - CAP Independent Detection in EWR.lua @@ -1,47 +1,47 @@ ---- --- Name: AID-040 - AI_A2A - CAP Independent Detection in EWR --- Author: FlightControl --- Date Created: 30 Aug 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - - -A2ADispatcher:SetEngageRadius( 90000 ) --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 4, 30, 120 ) - ---A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) ---CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) ---A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) ---A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - --- Blue attack simulation - -local Frequency = 180 - -BlueSpawn2 = SPAWN - :New( "RT NATO" ) - :InitLimit( 2, 40 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - :InitDelayOn() - :SpawnScheduled( Frequency, 0.5 ) +--- +-- Name: AID-040 - AI_A2A - CAP Independent Detection in EWR +-- Author: FlightControl +-- Date Created: 30 Aug 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +A2ADispatcher:SetEngageRadius( 90000 ) +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 4, 30, 120 ) + +--A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) +--CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +--A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +--A2ADispatcher:SetSquadronCapInterval( "May", 1, 30, 120 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + +-- Blue attack simulation + +local Frequency = 180 + +BlueSpawn2 = SPAWN + :New( "RT NATO" ) + :InitLimit( 2, 40 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + :InitDelayOn() + :SpawnScheduled( Frequency, 0.5 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-041 - AI_A2A - CAP Independent Detection in EWR with Clients.lua b/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-041 - AI_A2A - CAP Independent Detection in EWR with Clients.lua index 9a92002ab0..2fa9bb138a 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-041 - AI_A2A - CAP Independent Detection in EWR with Clients.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-041 - CAP Independent Detection in EWR with Clients/AID-041 - AI_A2A - CAP Independent Detection in EWR with Clients.lua @@ -1,49 +1,49 @@ ---- --- Name: AID-041 - AI_A2A - CAP Independent Detection in EWR with Clients --- Author: FlightControl --- Date Created: 01 Sep 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) -Detection:SetRefreshTimeInterval( 10 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) -A2ADispatcher:SetRefreshTimeInterval( 10 ) - - -A2ADispatcher:SetEngageRadius( 90000 ) --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 2, 30, 120 ) - -A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "May", 2, 30, 120 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - --- Blue attack simulation - ---local Frequency = 600 --- ---BlueSpawn2 = SPAWN --- :New( "RT NATO" ) --- :InitLimit( 2, 40 ) --- :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) --- :InitRandomizeRoute( 0, 0, 30000 ) --- :InitDelayOn() --- :SpawnScheduled( Frequency, 0.5 ) +--- +-- Name: AID-041 - AI_A2A - CAP Independent Detection in EWR with Clients +-- Author: FlightControl +-- Date Created: 01 Sep 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) +Detection:SetRefreshTimeInterval( 10 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) +A2ADispatcher:SetRefreshTimeInterval( 10 ) + + +A2ADispatcher:SetEngageRadius( 90000 ) +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" } ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 2, 30, 120 ) + +A2ADispatcher:SetSquadron( "May", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP SU-27" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "May", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "May", 2, 30, 120 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + +-- Blue attack simulation + +--local Frequency = 600 +-- +--BlueSpawn2 = SPAWN +-- :New( "RT NATO" ) +-- :InitLimit( 2, 40 ) +-- :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) +-- :InitRandomizeRoute( 0, 0, 30000 ) +-- :InitDelayOn() +-- :SpawnScheduled( Frequency, 0.5 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-050 - Resources/AID-A2A-050 - Resources.lua b/AI/AI_A2A_Dispatcher/AID-A2A-050 - Resources/AID-A2A-050 - Resources.lua index 0187eec441..f6b136402f 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-050 - Resources/AID-A2A-050 - Resources.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-050 - Resources/AID-A2A-050 - Resources.lua @@ -1,68 +1,68 @@ ---- --- Name: AID-A2A-050 - Resources --- Author: FlightControl --- Date Created: 21 Sep 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 250000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27" }, 6 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Mineralnye", 1 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mineralnye" ) - - --- Setup the visibility before start. -A2ADispatcher:SetSquadronVisible( "Mineralnye" ) - --- CAP Squadron execution. -CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) -A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) -A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 1, 30, 60, 1 ) -A2ADispatcher:SetSquadronFuelThreshold( "Mineralnye", 0.20 ) - --- GCI Squadron execution. ---A2ADispatcher:SetSquadronGci( "Mineralnye", 900, 1200 ) - --- Blue attack simulation -local Frequency = 60 - ---BlueSpawn1 = SPAWN --- :New( "RT NATO 1" ) --- :InitLimit( 2, 10 ) --- :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) --- :InitRandomizeRoute( 0, 0, 30000 ) --- --:InitDelayOn() --- :SpawnScheduled( Frequency, 0.4 ) +--- +-- Name: AID-A2A-050 - Resources +-- Author: FlightControl +-- Date Created: 21 Sep 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 250000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27" }, 6 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Mineralnye", 1 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mineralnye" ) + + +-- Setup the visibility before start. +A2ADispatcher:SetSquadronVisible( "Mineralnye" ) + +-- CAP Squadron execution. +CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 1, 30, 60, 1 ) +A2ADispatcher:SetSquadronFuelThreshold( "Mineralnye", 0.20 ) + +-- GCI Squadron execution. +--A2ADispatcher:SetSquadronGci( "Mineralnye", 900, 1200 ) + +-- Blue attack simulation +local Frequency = 60 + +--BlueSpawn1 = SPAWN +-- :New( "RT NATO 1" ) +-- :InitLimit( 2, 10 ) +-- :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) +-- :InitRandomizeRoute( 0, 0, 30000 ) +-- --:InitDelayOn() +-- :SpawnScheduled( Frequency, 0.4 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-051 - Airbase Capture/AID-A2A-051 - Airbase Capture.lua b/AI/AI_A2A_Dispatcher/AID-A2A-051 - Airbase Capture/AID-A2A-051 - Airbase Capture.lua index ef5461079d..7feefb7dbe 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-051 - Airbase Capture/AID-A2A-051 - Airbase Capture.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-051 - Airbase Capture/AID-A2A-051 - Airbase Capture.lua @@ -1,67 +1,67 @@ ---- --- Name: AID-A2A-050 - Resources --- Author: FlightControl --- Date Created: 21 Sep 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 250000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27" }, 30 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Mineralnye", 1 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Air ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) - - --- CAP Squadron execution. ---CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) ---A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) ---A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) - --- GCI Squadron execution. -A2ADispatcher:SetSquadronGci( "Mineralnye", 900, 1200 ) - -CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) - - --- Blue attack simulation -local Frequency = 60 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) +--- +-- Name: AID-A2A-050 - Resources +-- Author: FlightControl +-- Date Created: 21 Sep 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 250000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27" }, 30 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Mineralnye", 1 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Air ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) + + +-- CAP Squadron execution. +--CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +--A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +--A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) + +-- GCI Squadron execution. +A2ADispatcher:SetSquadronGci( "Mineralnye", 900, 1200 ) + +CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) + + +-- Blue attack simulation +local Frequency = 60 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-060 - Takeoff From Runway Test/AID-060 - AI_A2A - Takeoff From Runway Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-060 - Takeoff From Runway Test/AID-060 - AI_A2A - Takeoff From Runway Test.lua index 782075ed45..f7ffb75693 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-060 - Takeoff From Runway Test/AID-060 - AI_A2A - Takeoff From Runway Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-060 - Takeoff From Runway Test/AID-060 - AI_A2A - Takeoff From Runway Test.lua @@ -1,67 +1,67 @@ ---- --- Name: AID-060 - AI_A2A - Takeoff From Runway Test --- Author: FlightControl --- Date Created: 21 Sep 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 250000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27" }, 20 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Mineralnye", 1 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Runway ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) - - --- CAP Squadron execution. ---CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) ---A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) ---A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) - --- GCI Squadron execution. -A2ADispatcher:SetSquadronGci( "Mineralnye", 900, 1200 ) - -CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) - - --- Blue attack simulation -local Frequency = 60 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) +--- +-- Name: AID-060 - AI_A2A - Takeoff From Runway Test +-- Author: FlightControl +-- Date Created: 21 Sep 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 250000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27" }, 20 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Mineralnye", 1 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Runway ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) + + +-- CAP Squadron execution. +--CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +--A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +--A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) + +-- GCI Squadron execution. +A2ADispatcher:SetSquadronGci( "Mineralnye", 900, 1200 ) + +CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) + + +-- Blue attack simulation +local Frequency = 60 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-061 - Takeoff From Ship Runway Test/AID-061 - AI_A2A - Takeoff From Ship Runway Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-061 - Takeoff From Ship Runway Test/AID-061 - AI_A2A - Takeoff From Ship Runway Test.lua index cd77e2a15d..c0bb328de6 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-061 - Takeoff From Ship Runway Test/AID-061 - AI_A2A - Takeoff From Ship Runway Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-061 - Takeoff From Ship Runway Test/AID-061 - AI_A2A - Takeoff From Ship Runway Test.lua @@ -1,61 +1,61 @@ ---- --- Name: AID-061 - AI_A2A - Takeoff From Ship Runway Test --- Author: FlightControl --- Date Created: 21 Sep 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 250000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Kuznetsov", "Kuznetsov", { "SQ CCCP SU-33" }, 20 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Kuznetsov", 1.2 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Kuznetsov", 1 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Kuznetsov", AI_A2A_DISPATCHER.Takeoff.Runway ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtRunway( "Kuznetsov" ) - - --- CAP Squadron execution. ---CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) ---A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) ---A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) - --- GCI Squadron execution. -A2ADispatcher:SetSquadronGci( "Kuznetsov", 900, 1200 ) - -CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) - - --- Blue attack simulation -local Frequency = 60 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) +--- +-- Name: AID-061 - AI_A2A - Takeoff From Ship Runway Test +-- Author: FlightControl +-- Date Created: 21 Sep 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 250000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Kuznetsov", "Kuznetsov", { "SQ CCCP SU-33" }, 20 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Kuznetsov", 1.2 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Kuznetsov", 1 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Kuznetsov", AI_A2A_DISPATCHER.Takeoff.Runway ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtRunway( "Kuznetsov" ) + + +-- CAP Squadron execution. +--CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +--A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +--A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 2, 30, 60, 1 ) + +-- GCI Squadron execution. +A2ADispatcher:SetSquadronGci( "Kuznetsov", 900, 1200 ) + +CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) + + +-- Blue attack simulation +local Frequency = 60 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-070 - CAP - Player Exit/AID-070 - AI_A2A - CAP - Player Exit.lua b/AI/AI_A2A_Dispatcher/AID-A2A-070 - CAP - Player Exit/AID-070 - AI_A2A - CAP - Player Exit.lua index c6cb4334df..b5bd26d0f7 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-070 - CAP - Player Exit/AID-070 - AI_A2A - CAP - Player Exit.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-070 - CAP - Player Exit/AID-070 - AI_A2A - CAP - Player Exit.lua @@ -1,39 +1,39 @@ ---- --- Name: AID-070 - AI_A2A - CAP - Player Exit --- Author: FlightControl --- Date Created: 30 Oct 2017 --- --- Test Scenario(s): --- --- Now take a seat in the client plane as a player. --- Do the following tests after the plane has been spawned. --- 1. Immediately exit the plane. --- 2. Only exit the plane once the defender is engaged. --- 3. Let the defender shoot you. --- In all these scenarios, observe if the defender is continuing its patrol. - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Kras1", 1, 30, 120, 1 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - +--- +-- Name: AID-070 - AI_A2A - CAP - Player Exit +-- Author: FlightControl +-- Date Created: 30 Oct 2017 +-- +-- Test Scenario(s): +-- +-- Now take a seat in the client plane as a player. +-- Do the following tests after the plane has been spawned. +-- 1. Immediately exit the plane. +-- 2. Only exit the plane once the defender is engaged. +-- 3. Let the defender shoot you. +-- In all these scenarios, observe if the defender is continuing its patrol. + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Kras1", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Kras1", 1, 30, 120, 1 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-071 - GCI - Player Exit/AID-071 - AI_A2A - GCI - Player Exit.lua b/AI/AI_A2A_Dispatcher/AID-A2A-071 - GCI - Player Exit/AID-071 - AI_A2A - GCI - Player Exit.lua index edec7d2c46..0cb00283b4 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-071 - GCI - Player Exit/AID-071 - AI_A2A - GCI - Player Exit.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-071 - GCI - Player Exit/AID-071 - AI_A2A - GCI - Player Exit.lua @@ -1,37 +1,37 @@ ---- --- Name: AID-071 - AI_A2A - GCI - Player Exit --- Author: FlightControl --- Date Created: 30 Oct 2017 --- --- Test Scenario(s): --- --- Now take a seat in the client plane as a player. --- Do the following tests after the plane has been spawned. --- 1. Immediately exit the plane. --- 2. Only exit the plane once the defender is engaged. --- 3. Let the defender shoot you. --- In all these scenarios, observe if the defender is returning to base. - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - -A2ADispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) -A2ADispatcher:SetSquadronGci( "Kras1", 800, 1200 ) - -A2ADispatcher:SetDefaultTakeoffInAir() -A2ADispatcher:SetDefaultLandingNearAirbase() - +--- +-- Name: AID-071 - AI_A2A - GCI - Player Exit +-- Author: FlightControl +-- Date Created: 30 Oct 2017 +-- +-- Test Scenario(s): +-- +-- Now take a seat in the client plane as a player. +-- Do the following tests after the plane has been spawned. +-- 1. Immediately exit the plane. +-- 2. Only exit the plane once the defender is engaged. +-- 3. Let the defender shoot you. +-- In all these scenarios, observe if the defender is returning to base. + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +A2ADispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2ADispatcher:SetSquadron( "Kras1", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "SQ CCCP SU-27" }, 20 ) +A2ADispatcher:SetSquadronGci( "Kras1", 800, 1200 ) + +A2ADispatcher:SetDefaultTakeoffInAir() +A2ADispatcher:SetDefaultLandingNearAirbase() + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-100 - Demonstration/AID-A2A-100 - Demonstration.lua b/AI/AI_A2A_Dispatcher/AID-A2A-100 - Demonstration/AID-A2A-100 - Demonstration.lua index 56550090d8..69280c1a0f 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-100 - Demonstration/AID-A2A-100 - Demonstration.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-100 - Demonstration/AID-A2A-100 - Demonstration.lua @@ -1,128 +1,128 @@ ---- --- Name: AID-A2A-100 - Demonstration --- Author: FlightControl --- Date Created: 30 May 2017 - - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 120000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD" }, 16 ) -A2ADispatcher:SetSquadron( "Maykop", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP MIG-31" }, 20 ) -A2ADispatcher:SetSquadron( "Mozdok", AIRBASE.Caucasus.Mozdok, { "SQ CCCP MIG-31" }, 16 ) -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD", "SQ CCCP SU-34", "SQ CCCP MIG-31", "SQ CCCP MIG-29S" }, 40 ) -A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 16 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) -A2ADispatcher:SetSquadronOverhead( "Maykop", 1 ) -A2ADispatcher:SetSquadronOverhead( "Mozdok", 1 ) -A2ADispatcher:SetSquadronOverhead( "Sochi", 2 ) -A2ADispatcher:SetSquadronOverhead( "Novo", 1.5 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Mineralnye", 4 ) -A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) -A2ADispatcher:SetSquadronGrouping( "Novo", 3 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Sochi" ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Mozdok" ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Maykop" ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) -A2ADispatcher:SetSquadronLandingNearAirbase( "Sochi" ) -A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mozdok" ) -A2ADispatcher:SetSquadronLandingNearAirbase( "Maykop" ) -A2ADispatcher:SetSquadronLanding( "Novo", AI_A2A_DISPATCHER.Landing.AtRunway ) - - --- CAP Squadron execution. -CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) -A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) -A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 6, 30, 60, 1 ) - -CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) -A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) -A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - -CAPZoneMiddle = ZONE:New( "CAP Zone Middle") -A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) -A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - --- GCI Squadron execution. -A2ADispatcher:SetSquadronGci( "Mozdok", 900, 1200 ) -A2ADispatcher:SetSquadronGci( "Novo", 900, 2100 ) -A2ADispatcher:SetSquadronGci( "Maykop", 900, 1200 ) - --- Set the squadrons visible before startup. -A2ADispatcher:SetSquadronVisible( "Mineralnye" ) -A2ADispatcher:SetSquadronVisible( "Sochi" ) -A2ADispatcher:SetSquadronVisible( "Mozdok" ) -A2ADispatcher:SetSquadronVisible( "Maykop" ) ---A2ADispatcher:SetSquadronVisible( "Novo" ) - - ---CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) - - --- Blue attack simulation -local Frequency = 300 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn3 = SPAWN - :New( "RT NATO 3" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn4 = SPAWN - :New( "RT NATO 4" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - +--- +-- Name: AID-A2A-100 - Demonstration +-- Author: FlightControl +-- Date Created: 30 May 2017 + + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 120000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD" }, 16 ) +A2ADispatcher:SetSquadron( "Maykop", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP MIG-31" }, 20 ) +A2ADispatcher:SetSquadron( "Mozdok", AIRBASE.Caucasus.Mozdok, { "SQ CCCP MIG-31" }, 16 ) +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD", "SQ CCCP SU-34", "SQ CCCP MIG-31", "SQ CCCP MIG-29S" }, 40 ) +A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 16 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) +A2ADispatcher:SetSquadronOverhead( "Maykop", 1 ) +A2ADispatcher:SetSquadronOverhead( "Mozdok", 1 ) +A2ADispatcher:SetSquadronOverhead( "Sochi", 2 ) +A2ADispatcher:SetSquadronOverhead( "Novo", 1.5 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Mineralnye", 4 ) +A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) +A2ADispatcher:SetSquadronGrouping( "Novo", 3 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Sochi" ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Mozdok" ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Maykop" ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) +A2ADispatcher:SetSquadronLandingNearAirbase( "Sochi" ) +A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mozdok" ) +A2ADispatcher:SetSquadronLandingNearAirbase( "Maykop" ) +A2ADispatcher:SetSquadronLanding( "Novo", AI_A2A_DISPATCHER.Landing.AtRunway ) + + +-- CAP Squadron execution. +CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 6, 30, 60, 1 ) + +CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +CAPZoneMiddle = ZONE:New( "CAP Zone Middle") +A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) +A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +-- GCI Squadron execution. +A2ADispatcher:SetSquadronGci( "Mozdok", 900, 1200 ) +A2ADispatcher:SetSquadronGci( "Novo", 900, 2100 ) +A2ADispatcher:SetSquadronGci( "Maykop", 900, 1200 ) + +-- Set the squadrons visible before startup. +A2ADispatcher:SetSquadronVisible( "Mineralnye" ) +A2ADispatcher:SetSquadronVisible( "Sochi" ) +A2ADispatcher:SetSquadronVisible( "Mozdok" ) +A2ADispatcher:SetSquadronVisible( "Maykop" ) +--A2ADispatcher:SetSquadronVisible( "Novo" ) + + +--CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) + + +-- Blue attack simulation +local Frequency = 300 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn3 = SPAWN + :New( "RT NATO 3" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn4 = SPAWN + :New( "RT NATO 4" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-190 - Communication/AID-A2A-190 - Communication.lua b/AI/AI_A2A_Dispatcher/AID-A2A-190 - Communication/AID-A2A-190 - Communication.lua index 6125a776c1..1fe69b2467 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-190 - Communication/AID-A2A-190 - Communication.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-190 - Communication/AID-A2A-190 - Communication.lua @@ -1,131 +1,131 @@ ---- --- Name: AID-A2A-100 - Demonstration --- Author: FlightControl --- Date Created: 30 May 2017 - - -local CommandCenter = COMMANDCENTER:New( GROUP:FindByName( "HQ" ), "HQ" ) - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) -A2ADispatcher:SetCommandCenter(CommandCenter) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 120000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD" }, 16 ) -A2ADispatcher:SetSquadron( "Maykop", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP MIG-31" }, 20 ) -A2ADispatcher:SetSquadron( "Mozdok", AIRBASE.Caucasus.Mozdok, { "SQ CCCP MIG-31" }, 16 ) -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD", "SQ CCCP SU-34", "SQ CCCP MIG-31", "SQ CCCP MIG-29S" }, 40 ) -A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 16 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) -A2ADispatcher:SetSquadronOverhead( "Maykop", 1 ) -A2ADispatcher:SetSquadronOverhead( "Mozdok", 1 ) -A2ADispatcher:SetSquadronOverhead( "Sochi", 2 ) -A2ADispatcher:SetSquadronOverhead( "Novo", 1.5 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Mineralnye", 4 ) -A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) -A2ADispatcher:SetSquadronGrouping( "Novo", 3 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Sochi" ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Mozdok" ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Maykop" ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) -A2ADispatcher:SetSquadronLandingNearAirbase( "Sochi" ) -A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mozdok" ) -A2ADispatcher:SetSquadronLandingNearAirbase( "Maykop" ) -A2ADispatcher:SetSquadronLanding( "Novo", AI_A2A_DISPATCHER.Landing.AtRunway ) - - --- CAP Squadron execution. ---CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) ---A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) ---A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 6, 30, 60, 1 ) - ---CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) ---A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) ---A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - ---CAPZoneMiddle = ZONE:New( "CAP Zone Middle") ---A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) ---A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - --- GCI Squadron execution. -A2ADispatcher:SetSquadronGci( "Mozdok", 900, 1200 ) -A2ADispatcher:SetSquadronGci( "Novo", 900, 2100 ) -A2ADispatcher:SetSquadronGci( "Maykop", 900, 1200 ) - --- Set the squadrons visible before startup. ---A2ADispatcher:SetSquadronVisible( "Mineralnye" ) ---A2ADispatcher:SetSquadronVisible( "Sochi" ) ---A2ADispatcher:SetSquadronVisible( "Mozdok" ) ---A2ADispatcher:SetSquadronVisible( "Maykop" ) ---A2ADispatcher:SetSquadronVisible( "Novo" ) - - ---CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) - - --- Blue attack simulation -local Frequency = 300 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn3 = SPAWN - :New( "RT NATO 3" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn4 = SPAWN - :New( "RT NATO 4" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - +--- +-- Name: AID-A2A-100 - Demonstration +-- Author: FlightControl +-- Date Created: 30 May 2017 + + +local CommandCenter = COMMANDCENTER:New( GROUP:FindByName( "HQ" ), "HQ" ) + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) +A2ADispatcher:SetCommandCenter(CommandCenter) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 120000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD" }, 16 ) +A2ADispatcher:SetSquadron( "Maykop", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP MIG-31" }, 20 ) +A2ADispatcher:SetSquadron( "Mozdok", AIRBASE.Caucasus.Mozdok, { "SQ CCCP MIG-31" }, 16 ) +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD", "SQ CCCP SU-34", "SQ CCCP MIG-31", "SQ CCCP MIG-29S" }, 40 ) +A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 16 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) +A2ADispatcher:SetSquadronOverhead( "Maykop", 1 ) +A2ADispatcher:SetSquadronOverhead( "Mozdok", 1 ) +A2ADispatcher:SetSquadronOverhead( "Sochi", 2 ) +A2ADispatcher:SetSquadronOverhead( "Novo", 1.5 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Mineralnye", 4 ) +A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) +A2ADispatcher:SetSquadronGrouping( "Novo", 3 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Sochi" ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Mozdok" ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Maykop" ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) +A2ADispatcher:SetSquadronLandingNearAirbase( "Sochi" ) +A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mozdok" ) +A2ADispatcher:SetSquadronLandingNearAirbase( "Maykop" ) +A2ADispatcher:SetSquadronLanding( "Novo", AI_A2A_DISPATCHER.Landing.AtRunway ) + + +-- CAP Squadron execution. +--CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +--A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +--A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 6, 30, 60, 1 ) + +--CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +--A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +--A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +--CAPZoneMiddle = ZONE:New( "CAP Zone Middle") +--A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) +--A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +-- GCI Squadron execution. +A2ADispatcher:SetSquadronGci( "Mozdok", 900, 1200 ) +A2ADispatcher:SetSquadronGci( "Novo", 900, 2100 ) +A2ADispatcher:SetSquadronGci( "Maykop", 900, 1200 ) + +-- Set the squadrons visible before startup. +--A2ADispatcher:SetSquadronVisible( "Mineralnye" ) +--A2ADispatcher:SetSquadronVisible( "Sochi" ) +--A2ADispatcher:SetSquadronVisible( "Mozdok" ) +--A2ADispatcher:SetSquadronVisible( "Maykop" ) +--A2ADispatcher:SetSquadronVisible( "Novo" ) + + +--CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) + + +-- Blue attack simulation +local Frequency = 300 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn3 = SPAWN + :New( "RT NATO 3" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn4 = SPAWN + :New( "RT NATO 4" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-200 - GCICAP Demonstration/AID-A2A-200 - GCICAP Demonstration.lua b/AI/AI_A2A_Dispatcher/AID-A2A-200 - GCICAP Demonstration/AID-A2A-200 - GCICAP Demonstration.lua index aa673655d9..792429dff1 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-200 - GCICAP Demonstration/AID-A2A-200 - GCICAP Demonstration.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-200 - GCICAP Demonstration/AID-A2A-200 - GCICAP Demonstration.lua @@ -1,75 +1,75 @@ ---- --- Name: AID-A2A-200 - GCICAP Demonstration --- Author: FlightControl --- Date Created: 05 July 2017 - - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2 ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( true ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - - - -A2ADispatcher:SetDefaultTakeoffFromParkingCold() -A2ADispatcher:SetDefaultLandingAtEngineShutdown() -A2ADispatcher:SetDefaultFuelThreshold( 0.20 ) -A2ADispatcher:SetIntercept( 100 ) -A2ADispatcher:SetDisengageRadius( 100000 ) -A2ADispatcher:SetEngageRadius( 50000 ) -A2ADispatcher:SetGciRadius( 100000 ) - -A2ADispatcher:Start() - -------------------------------- - - - - - - - - - --- Blue attack simulation -local Frequency = 600 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 3 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 2, 3 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn3 = SPAWN - :New( "RT NATO 3" ) - :InitLimit( 2, 3 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn4 = SPAWN - :New( "RT NATO 4" ) - :InitLimit( 2, 3 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - +--- +-- Name: AID-A2A-200 - GCICAP Demonstration +-- Author: FlightControl +-- Date Created: 05 July 2017 + + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_GCICAP:New( { "DF CCCP" }, { "SQ CCCP" }, { "CAP Zone" }, 2 ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( true ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + + + +A2ADispatcher:SetDefaultTakeoffFromParkingCold() +A2ADispatcher:SetDefaultLandingAtEngineShutdown() +A2ADispatcher:SetDefaultFuelThreshold( 0.20 ) +A2ADispatcher:SetIntercept( 100 ) +A2ADispatcher:SetDisengageRadius( 100000 ) +A2ADispatcher:SetEngageRadius( 50000 ) +A2ADispatcher:SetGciRadius( 100000 ) + +A2ADispatcher:Start() + +------------------------------- + + + + + + + + + +-- Blue attack simulation +local Frequency = 600 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 3 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 2, 3 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn3 = SPAWN + :New( "RT NATO 3" ) + :InitLimit( 2, 3 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn4 = SPAWN + :New( "RT NATO 4" ) + :InitLimit( 2, 3 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/AID-210 - NTTR AI_A2A_GCICAP Demonstration.lua b/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/AID-210 - NTTR AI_A2A_GCICAP Demonstration.lua index 21114438a7..4bf78b201f 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/AID-210 - NTTR AI_A2A_GCICAP Demonstration.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/AID-210 - NTTR AI_A2A_GCICAP Demonstration.lua @@ -1,54 +1,54 @@ - - --- RED - ---- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. -A2A_GCICAP_Red = AI_A2A_GCICAP:New( { "RED EWR" }, { "4477th" }, { }, 2 ) - -A2A_GCICAP_Red:SetBorderZone( ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) ) - --- Enable the tactical display panel. This is to see what this dispatcher is doing. ---A2A_GCICAP_Red:SetTacticalDisplay( true ) - - --- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly --- without an assignment within 150km radius from a detected target, will engage that target. -A2A_GCICAP_Red:SetEngageRadius( 150000 ) - --- The default take-off method is planes takeoff right in the air. --- Here we specify to take off from a parking space, with engines already running. -A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Tonopah_Test_Range_Airfield ) ---A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( "Groom Lake AFB" ) - - --- BLUE - - ---- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. --- EWR network groups start with BLUE EWR. --- Squadron templates which are placed above the colored airbase, start with 104th or 105th or 106th. --- Perform CAP in a polygon zone placed near 104th, which is Nellis. --- Perform 2 CAP. -A2A_GCICAP_Blue = AI_A2A_GCICAP:New( { "BLUE EWR" }, { "104th", "105th", "106th" }, { "104th CAP" }, 2 ) - -A2A_GCICAP_Blue:SetBorderZone( ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) ) - --- Enable the tactical display panel. This is to see what this dispatcher is doing. ---A2A_GCICAP_Blue:SetTacticalDisplay( true ) - - --- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly --- without an assignment within 150km radius from a detected target, will engage that target. -A2A_GCICAP_Blue:SetEngageRadius( 150000 ) - --- The default take-off method is planes takeoff right in the air. --- Here we specify other take off options. -A2A_GCICAP_Blue:SetSquadronTakeoffFromRunway( AIRBASE.Nevada.Boulder_City_Airport ) -- Takeoff from the runway. -A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingCold( AIRBASE.Nevada.McCarran_International_Airport ) -- Takeoff from parking spot, with engines shut off. ---A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Nellis_AFB ) -- Takaeoff from parking spot, engines running. - --- The Nellis airbase contains a squadron that flies an F-5... Less modern airplane. --- So it needs a stronger "overhead". -A2A_GCICAP_Blue:SetSquadronOverhead( AIRBASE.Nevada.Nellis_AFB, 2 ) -- When 2 airplanes are attacking, we spawn 4 airplanes for defense. -A2A_GCICAP_Blue:SetSquadronGrouping( AIRBASE.Nevada.Nellis_AFB, 2 ) -- We group the spawned defence airplanes per 2 units. - + + +-- RED + +--- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. +A2A_GCICAP_Red = AI_A2A_GCICAP:New( { "RED EWR" }, { "4477th" }, { }, 2 ) + +A2A_GCICAP_Red:SetBorderZone( ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) ) + +-- Enable the tactical display panel. This is to see what this dispatcher is doing. +--A2A_GCICAP_Red:SetTacticalDisplay( true ) + + +-- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly +-- without an assignment within 150km radius from a detected target, will engage that target. +A2A_GCICAP_Red:SetEngageRadius( 150000 ) + +-- The default take-off method is planes takeoff right in the air. +-- Here we specify to take off from a parking space, with engines already running. +A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Tonopah_Test_Range_Airfield ) +--A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( "Groom Lake AFB" ) + + +-- BLUE + + +--- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. +-- EWR network groups start with BLUE EWR. +-- Squadron templates which are placed above the colored airbase, start with 104th or 105th or 106th. +-- Perform CAP in a polygon zone placed near 104th, which is Nellis. +-- Perform 2 CAP. +A2A_GCICAP_Blue = AI_A2A_GCICAP:New( { "BLUE EWR" }, { "104th", "105th", "106th" }, { "104th CAP" }, 2 ) + +A2A_GCICAP_Blue:SetBorderZone( ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) ) + +-- Enable the tactical display panel. This is to see what this dispatcher is doing. +--A2A_GCICAP_Blue:SetTacticalDisplay( true ) + + +-- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly +-- without an assignment within 150km radius from a detected target, will engage that target. +A2A_GCICAP_Blue:SetEngageRadius( 150000 ) + +-- The default take-off method is planes takeoff right in the air. +-- Here we specify other take off options. +A2A_GCICAP_Blue:SetSquadronTakeoffFromRunway( AIRBASE.Nevada.Boulder_City_Airport ) -- Takeoff from the runway. +A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingCold( AIRBASE.Nevada.McCarran_International_Airport ) -- Takeoff from parking spot, with engines shut off. +--A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Nellis_AFB ) -- Takaeoff from parking spot, engines running. + +-- The Nellis airbase contains a squadron that flies an F-5... Less modern airplane. +-- So it needs a stronger "overhead". +A2A_GCICAP_Blue:SetSquadronOverhead( AIRBASE.Nevada.Nellis_AFB, 2 ) -- When 2 airplanes are attacking, we spawn 4 airplanes for defense. +A2A_GCICAP_Blue:SetSquadronGrouping( AIRBASE.Nevada.Nellis_AFB, 2 ) -- We group the spawned defence airplanes per 2 units. + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/NTTR AI_A2A_GCICAP Test.lua b/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/NTTR AI_A2A_GCICAP Test.lua index 21114438a7..4bf78b201f 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/NTTR AI_A2A_GCICAP Test.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/NTTR AI_A2A_GCICAP Test.lua @@ -1,54 +1,54 @@ - - --- RED - ---- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. -A2A_GCICAP_Red = AI_A2A_GCICAP:New( { "RED EWR" }, { "4477th" }, { }, 2 ) - -A2A_GCICAP_Red:SetBorderZone( ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) ) - --- Enable the tactical display panel. This is to see what this dispatcher is doing. ---A2A_GCICAP_Red:SetTacticalDisplay( true ) - - --- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly --- without an assignment within 150km radius from a detected target, will engage that target. -A2A_GCICAP_Red:SetEngageRadius( 150000 ) - --- The default take-off method is planes takeoff right in the air. --- Here we specify to take off from a parking space, with engines already running. -A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Tonopah_Test_Range_Airfield ) ---A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( "Groom Lake AFB" ) - - --- BLUE - - ---- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. --- EWR network groups start with BLUE EWR. --- Squadron templates which are placed above the colored airbase, start with 104th or 105th or 106th. --- Perform CAP in a polygon zone placed near 104th, which is Nellis. --- Perform 2 CAP. -A2A_GCICAP_Blue = AI_A2A_GCICAP:New( { "BLUE EWR" }, { "104th", "105th", "106th" }, { "104th CAP" }, 2 ) - -A2A_GCICAP_Blue:SetBorderZone( ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) ) - --- Enable the tactical display panel. This is to see what this dispatcher is doing. ---A2A_GCICAP_Blue:SetTacticalDisplay( true ) - - --- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly --- without an assignment within 150km radius from a detected target, will engage that target. -A2A_GCICAP_Blue:SetEngageRadius( 150000 ) - --- The default take-off method is planes takeoff right in the air. --- Here we specify other take off options. -A2A_GCICAP_Blue:SetSquadronTakeoffFromRunway( AIRBASE.Nevada.Boulder_City_Airport ) -- Takeoff from the runway. -A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingCold( AIRBASE.Nevada.McCarran_International_Airport ) -- Takeoff from parking spot, with engines shut off. ---A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Nellis_AFB ) -- Takaeoff from parking spot, engines running. - --- The Nellis airbase contains a squadron that flies an F-5... Less modern airplane. --- So it needs a stronger "overhead". -A2A_GCICAP_Blue:SetSquadronOverhead( AIRBASE.Nevada.Nellis_AFB, 2 ) -- When 2 airplanes are attacking, we spawn 4 airplanes for defense. -A2A_GCICAP_Blue:SetSquadronGrouping( AIRBASE.Nevada.Nellis_AFB, 2 ) -- We group the spawned defence airplanes per 2 units. - + + +-- RED + +--- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. +A2A_GCICAP_Red = AI_A2A_GCICAP:New( { "RED EWR" }, { "4477th" }, { }, 2 ) + +A2A_GCICAP_Red:SetBorderZone( ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) ) + +-- Enable the tactical display panel. This is to see what this dispatcher is doing. +--A2A_GCICAP_Red:SetTacticalDisplay( true ) + + +-- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly +-- without an assignment within 150km radius from a detected target, will engage that target. +A2A_GCICAP_Red:SetEngageRadius( 150000 ) + +-- The default take-off method is planes takeoff right in the air. +-- Here we specify to take off from a parking space, with engines already running. +A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Tonopah_Test_Range_Airfield ) +--A2A_GCICAP_Red:SetSquadronTakeoffFromParkingHot( "Groom Lake AFB" ) + + +-- BLUE + + +--- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. +-- EWR network groups start with BLUE EWR. +-- Squadron templates which are placed above the colored airbase, start with 104th or 105th or 106th. +-- Perform CAP in a polygon zone placed near 104th, which is Nellis. +-- Perform 2 CAP. +A2A_GCICAP_Blue = AI_A2A_GCICAP:New( { "BLUE EWR" }, { "104th", "105th", "106th" }, { "104th CAP" }, 2 ) + +A2A_GCICAP_Blue:SetBorderZone( ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) ) + +-- Enable the tactical display panel. This is to see what this dispatcher is doing. +--A2A_GCICAP_Blue:SetTacticalDisplay( true ) + + +-- Initialize the dispatcher, setting up a radius of 150km where any airborne friendly +-- without an assignment within 150km radius from a detected target, will engage that target. +A2A_GCICAP_Blue:SetEngageRadius( 150000 ) + +-- The default take-off method is planes takeoff right in the air. +-- Here we specify other take off options. +A2A_GCICAP_Blue:SetSquadronTakeoffFromRunway( AIRBASE.Nevada.Boulder_City_Airport ) -- Takeoff from the runway. +A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingCold( AIRBASE.Nevada.McCarran_International_Airport ) -- Takeoff from parking spot, with engines shut off. +--A2A_GCICAP_Blue:SetSquadronTakeoffFromParkingHot( AIRBASE.Nevada.Nellis_AFB ) -- Takaeoff from parking spot, engines running. + +-- The Nellis airbase contains a squadron that flies an F-5... Less modern airplane. +-- So it needs a stronger "overhead". +A2A_GCICAP_Blue:SetSquadronOverhead( AIRBASE.Nevada.Nellis_AFB, 2 ) -- When 2 airplanes are attacking, we spawn 4 airplanes for defense. +A2A_GCICAP_Blue:SetSquadronGrouping( AIRBASE.Nevada.Nellis_AFB, 2 ) -- We group the spawned defence airplanes per 2 units. + diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/TAC_NTTR_V.2A_GCICAP_SCRIPT.lua b/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/TAC_NTTR_V.2A_GCICAP_SCRIPT.lua index fb9660f8c2..1e9fb1e07b 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/TAC_NTTR_V.2A_GCICAP_SCRIPT.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-210 - GCICAP Demonstration/TAC_NTTR_V.2A_GCICAP_SCRIPT.lua @@ -1,1748 +1,1748 @@ ---[[ -Copyright (c) 2016 Snafu, Stonehouse, Rivvern, Chameleon Silk, lukrop. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute copies of the Software, -and to permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software and the Software shall not be -included in whole or part in any sort of paid for software or paid for downloadable -content (DLC) without the express permission of the copyright holders. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -]] - ---[[-- -## Overview -Autonomous GCI and CAP script for DCS: World. -The script provides an autonomous model of combat air patrols and ground controlled -interceptors for use with DCS World by mission builders. - -After minimal setup the script will automatically spawn CAP and GCI flights for two -sides and give them patrol and intercept tasks as well as returning them to base when -threats cease to be detected. - -Originally created by Snafu, enhanced and further modified by Stonehouse, -Rivvern, Chameleon Silk. - -Rewritten by lukrop. - -## Links - -Github repository: - -@script GCICAP -@author Snafu -@author Stonehouse -@author Rivvern -@author Chameleon Silk -@author lukrop -@copyright 2016 Snafu, Stonehouse, Rivvern, Chameleon Silk, lukrop. -@license Modified MIT. See LICENSE file. -]] - -gcicap = {} -gcicap.red = {} -gcicap.red.gci = {} -gcicap.red.cap = {} -gcicap.blue = {} -gcicap.blue.gci = {} -gcicap.blue.cap = {} -gcicap.cap = {} -gcicap.gci = {} - ---- Sets how verbose the log output will be. --- Possible values are "none", "info", "warning" and "error". --- I recommend "error" for production. -gcicap.log_level = "error" - ---- Interval, in seconds, of main function. --- Default 30 seconds. -gcicap.interval = 30 - ---- Interval, in seconds, GCI flights get vectors on targets. --- AI GCI flights don't use their radar, to be as stealth as --- possible, relying on those vectors. --- Default 15 seconds. -gcicap.vector_interval = 15 - ---- How far does a target have to move before an intercept is revectored -gcicap.revector_threshold = 15000 - ---- Initial spawn delay between CAPs --- Default 30 seconds. -gcicap.initial_spawn_delay = 30 - ---- Enable/disable borders for the red side. --- CAP units only engage if enemy units intrude their airspace -gcicap.red.borders_enabled = true - ---- Enable/disable borders for the blue side. --- CAP units only engage if enemy units intrude their airspace -gcicap.blue.borders_enabled = true - ---- CAP minimum altitudes in meters. --- Default 4500 -gcicap.cap.min_alt = 6100 - ---- CAP maximum altitudes in meters. --- Default 7500 -gcicap.cap.max_alt = 10500 - ---- Speed for CAP flights on their CAP route. --- speed is in m/s. Default 220. -gcicap.cap.speed = 220 - ---- Speed for GCI flights on intercept --- speed is in m/s. Default 300. -gcicap.gci.speed = 300 - ---- Maximum engage distance for CAP flights as long as they are on patrol. --- this might be overruled by an intercept vector given from --- ground control (EWR). Default 15000. -gcicap.cap.max_engage_distance = 15000 - ---- Minimum red CAP VUL time in minutes. --- Minimum time the red CAP flight will orbit on station. -gcicap.red.cap.vul_time_min = 25 - ---- Maximum red CAP VUL time in minutes. --- Maximum time the red CAP flight will orbit on station. -gcicap.red.cap.vul_time_max = 40 - ---- Minimum blue CAP VUL time in minutes. -gcicap.blue.cap.vul_time_min = 25 - ---- Maximum blue CAP VUL time in minutes. -gcicap.blue.cap.vul_time_max = 30 - ---- Use race-track orbit for CAP flights --- If true CAPs will use a race-track pattern for orbit --- between two points in the CAP zone. -gcicap.cap.race_track_orbit = false - ---[[ INOP at the time ---- Minimum leg length for red CAP orbits in meters. -gcicap.red.cap.leg_min = 10000 - ---- Maximum leg length for red CAP orbits in meters. -gcicap.red.cap.leg_min = 20000 - ---- Minimum leg length for blue CAP orbits in meters. -gcicap.blue.cap.leg_min = 10000 - ---- Maximum leg length for blue CAP orbits in meters. -gcicap.blue.cap.leg_min = 20000 -]]-- - ---- Enable/disable red CAP flights airborne start. --- set to true for CAP flight to start airborne at script initialisation --- (mission start), false for taking off from the airfield. --- Default true. -gcicap.red.cap.start_airborne = false - ---- Enable/disable blue CAP flights airborne start. -gcicap.blue.cap.start_airborne = false - ---- Amount of red CAP zones. --- placed with triggerzones in the ME. -gcicap.red.cap.zones_count = 4 - ---- Amount of blue CAP zones. -gcicap.blue.cap.zones_count = 4 - ---- Amount of red CAP groups concurrently in the air. -gcicap.red.cap.groups_count = 3 - ---- Amount of blue CAP groups concurrently in the air. -gcicap.blue.cap.groups_count = 2 - ---- Group size of red CAP flights. --- Can be "2", "4" or "randomized" --- --- If "2" it consists of 2 planes, if "4" it consists of 4 planes --- if "randomized", the CAP groups consist of either 2 or 4 planes -gcicap.red.cap.group_size = "randomized" - ---- Group size of blue CAP flights. --- See @{gcicap.red.cap.group_size} -gcicap.blue.cap.group_size = "4" - ---- Maximum amount of concurrent red intercepts. -gcicap.red.gci.groups_count = 3 - ---- Maximum amount of concurrent blue intercepts. -gcicap.blue.gci.groups_count = 2 - ---- Group size of red GCI flights. --- Can be "2", "4" or "dynamic" --- --- If "2" it consists of 2 planes, if "4" it consists of 4 planes --- if "dynamic", the GCI groups consist of as much aircrafts --- as the intruder group. -gcicap.red.gci.group_size = "dynamic" - ---- Group size of blue GCI flights. --- See @{gcicap.red.gci.group_size} -gcicap.blue.gci.group_size = "dynamic" - ---- Enable/disable GCI messages for red -gcicap.red.gci.messages = false - ---- Enable/disable GCI messages for blue -gcicap.blue.gci.messages = false - ---- How long a GCI message will be shown in seconds. -gcicap.gci.message_time = 5 - ---- Display GCI messages with metric measurment for red. --- If false the imperial system is used. -gcicap.red.gci.messages_metric = true - ---- Display GCI messages with metric measurment for blue. --- If false the imperial system is used. -gcicap.blue.gci.messages_metric = false - ---- Names of red groups which will receive GCI messages. --- Leave blank for all groups of coalition --- @usage gcicap.red.gci.messages_to = { "my group 1", "GCI Flight" } -gcicap.red.gci.messages_to = {} - ---- Names of blue groups which will receive GCI messages. --- See @{gcicap.red.gci.messages_to} for format. -gcicap.blue.gci.messages_to = {} - ---- How red CAP flights are spawned. --- can be "parking", "takeoff" or "air" and defines the way the fighters spawn --- takeoff is NOT RECOMMENDED currently since their occur timing issues with tasking --- if a flight is queued for takeoff and not already in the game world while getting tasked --- --- Default 'parking' -gcicap.red.cap.spawn_mode = "parking" - ---- How red GCI flights are spawned. --- @see gcicap.red.cap.spawn_mode -gcicap.red.gci.spawn_mode = "parking" - ---- How blue CAP flights are spawned. --- @see gcicap.red.cap.spawn_mode -gcicap.blue.cap.spawn_mode = "parking" - ---- How blue GCI flights are spawned. --- @see gcicap.red.cap.spawn_mode -gcicap.blue.gci.spawn_mode = "parking" - ---- Hide or reveal blue air units in the mission. -gcicap.blue.hide_groups = false - ---- Hide or reveal red air units in the mission. -gcicap.red.hide_groups = false - ---- Enable/disable red CAP flights. -gcicap.red.cap.enabled = true - ---- Enable/disable blue CAP flights. -gcicap.blue.cap.enabled = true - ---- Enable/disable red GCI flights. -gcicap.red.gci.enabled = true - ---- Enable/disable blue GCI flights. -gcicap.blue.gci.enabled = true - ---- Enabel/disable resource limitation for red. --- If set to true limits the amount of groups a side can spawn. -gcicap.red.limit_resources = false - ---- Enabel/disable resource limitation for blue. --- @see gcicap.red.limit_resources -gcicap.blue.limit_resources = false - ---- Amount of groups(!) red has at it's disposal. --- In other words how many Groups of airplanes --- this side can spawn. -gcicap.red.supply = 24 - ---- Amount of groups(!) red has at it's disposal. --- @see gcicap.red.supply -gcicap.blue.supply = 24 - ---- Name of the trigger zone which defines red CAP zones. --- This will be postfixed with the number of --- the zone. e.g. "redCAPzone3" or "blueCAPzone1". --- --- Default: 'redCAPzone'. -gcicap.red.cap.zone_name = 'redCAPzone' - ---- Name of the trigger zone which defines blue CAP zones. --- Default: 'blueCAPzone'. --- @see gcicap.red.cap.zone_name -gcicap.blue.cap.zone_name = 'blueCAPzone' - ---- Name of group which waypoints define the red border. --- Default: 'redborder'. -gcicap.red.border_group = 'redborder' - ---- Name of group which waypoints define the blue border. --- Default: 'blueborder'. -gcicap.blue.border_group = 'blueborder' - ---- GCI template unit's names prefix. -gcicap.gci.template_prefix = '__GCI__' - ---- CAP template unit's names prefix. -gcicap.cap.template_prefix = '__CAP__' - ---- Count of template units. --- Remember that this means you need that many --- template units for each type. E.g. if the template_count is 2 you --- would need two GCI and two CAP template units for each side. -gcicap.template_count = 4 - ---- Wether red will also acquire targets by AWACS aircraft. --- This is is currently broken since isTargetDetected doesn't --- seem to work with AWACS airplanes. Needs a workaround. --- --- Default false. -gcicap.red.awacs = false - ---- Wether blue will also acquire targets by AWACS aircraft. --- @see gcicap.red.awacs -gcicap.blue.awacs = true - ---- Garbage collector move timeout --- If a unit (aircraft) is on the ground and didn't move --- since this timeout, in seconds, it will be removed. --- This applies only to aircraft spawned by GCICAP. -gcicap.move_timeout = 300 - --- shortcut to the bullseye -gcicap.red.bullseye = coalition.getMainRefPoint(coalition.side.RED) -gcicap.blue.bullseye = coalition.getMainRefPoint(coalition.side.BLUE) - -gcicap.sides = { "red", "blue" } -gcicap.tasks = { "cap", "gci" } - -gcicap.log = mist.Logger:new("GCICAP", gcicap.log_level) - -do - --- Flight class. - -- @type gcicap.Flight - gcicap.Flight = {} - - local function getFlightIndex(group) - if type(group) ~= "string" then - if group:getName() then - group = group:getName() - else - return false - end - end - for i, side in pairs(gcicap.sides) do - for j, task in pairs(gcicap.tasks) do - for n = 1, #gcicap[side][task].flights do - if gcicap[side][task].flights[n].group_name == group then - return {side = side, task = task, index = n} - end - end - end - end - return false - end - - --- Returns the flight for the given group. - -- @tparam string|Group group this can be a Group object - -- or the group name. - -- @treturn gcicap.Flight the flight for the given group. - function gcicap.Flight.getFlight(group) - f = getFlightIndex(group) - if f then - return gcicap[f.side][f.task].flights[f.index] - else - return false - end - end - - --- Creates a new flight. - -- @tparam Group group group of the flight. - -- @tparam Airbase airbase homplate of the new flight. - -- @tparam string task task of the new flight. Can be "cap" or "gci". - -- @param param task parameter. This can be a zone table if it's a - -- CAP flight or it could be a target unit if it's a GCI flight. - function gcicap.Flight:new(group, airbase, task, param) - if group:isExist() then - local side = gcicap.coalitionToSide(group:getCoalition()) - local f = {} - f.side = side - f.give_up = false - f.group = group - f.group_name = group:getName() - f.airbase = airbase - f.task = task - -- is the flight RTB? - f.rtb = false - f.in_zone = false - - if task == "cap" then - f.zone = param - f.zone_name = param.name - f.intercepting = false - f.vul_time = math.random(gcicap[side].cap.vul_time_min, - gcicap[side].cap.vul_time_max) - else -- task should be "gci" - f.target = param - f.target_group = param.group - f.intercepting = true - f.intercept_point = { x = 0, y = 0, z = 0 } - end - - -- get current timestamp - local timestamp = timer.getAbsTime() - f.units_moved = {} - -- set timestamp for each unit - -- this is later used for garbage collection checks - for u, unit in pairs(group:getUnits()) do - f.units_moved[u] = {} - f.units_moved[u].unit = unit - f.units_moved[u].last_moved = timestamp - f.units_moved[u].spawned_at = timestamp - end - - setmetatable(f, self) - self.__index = self - - table.insert(gcicap[side][task].flights, f) - gcicap.log:info("Registered flight: $1", f.group_name) - - return f - else - return nil - end - end - - --- Removes the flight - -- @tparam gcicap.Flight self flight object - function gcicap.Flight:remove() - if self.zone then - -- if we didn't already leave the zone do it now. - self:leaveCAPZone() - end - local f = getFlightIndex(self.group_name) - local r = table.remove(gcicap[f.side][f.task].flights, f.index) - if r then - gcicap.log:info("Removing flight $1 with index $2", r.group_name, f.index) - end - end - - --- Decreases active flights counter in this flights zone. - -- Actually just decreases the active flights - -- counter of a zone. Does NOT task the flight itself. - function gcicap.Flight:leaveCAPZone() - if self.in_zone then - local zone = self.zone - if zone.patrol_count <= 1 then - zone.patrol_count = 0 - else - zone.patrol_count = zone.patrol_count - 1 - end - self.in_zone = false - - -- get current time - local time_now = timer.getAbsTime() - -- get time on station by substracting vul start time from current time - -- and convert it to minutes - local time_on_station = 0 - if self.vul_start then - time_on_station = (time_now - self.vul_start) / 60 - end - local vul_diff = self.vul_time - time_on_station - -- set new vul time only if more than 5 minutes - if vul_diff > 5 then - self.vul_time = vul_diff - else - self.vul_time = 0 - end - end - end - - --- Increases active flights counter in this flights zone. - -- Actually just increases the active flights - -- counter of a zone. Does NOT task the flight itself. - function gcicap.Flight:enterCAPZone() - if not self.in_zone then - self.intercepting = false - self.in_zone = true - local zone = self.zone - zone.patrol_count = zone.patrol_count + 1 - end - end - - --- Tasks the flight to search and engage the target. - -- @tparam Unit intruder target unit. - -- @tparam[opt] boolean cold whether the flight should not destroy - -- the target and just follow it. Default false. - function gcicap.Flight:vectorToTarget(intruder, cold) - local target = nil - if intruder.group then - target = gcicap.getFirstActiveUnit(intruder.group) - end - if target == nil or intruder.group == nil then return end - - -- check if interceptor even still exists - if self.group:isExist() then - if target:isExist() and target:inAir() and self.give_up ~= true then - local target_pos = target:getPoint() - local ctl = self.group:getController() - - local gci_task = { - id = 'Mission', - params = { - route = { - points = { - [1] = { - alt = target_pos.y, - x = target_pos.x, - y = target_pos.z, - speed = gcicap.gci.speed, - action = "Turning Point", - type = "Turning Point", - task = { - id = "ComboTask", - params = { - tasks = { - [1] = { - number = 1, - key = "CAP", - id = "EngageTargets", - enabled = true, - auto = true, - params = { - targetTypes = { [1] = "Air" }, - priority = 0 - } - } - } - } - } - }, - [2] = { - alt = target_pos.y, - x = target_pos.x, - y = target_pos.z, - speed = gcicap.gci.speed, - action = "Turning Point", - type = "Turning Point", - task = { - -- i don't really like this WrappedAction but it's needed in - -- the case the CGI completes this waypoint because of lack/loss - -- of target - id = 'WrappedAction', - params = { - action = { - id = 'Script', - params = { - command = "local group = ...\ - local flight = gcicap.Flight.getFlight(group)\ - if flight then\ - flight.give_up = true\ - if flight.zone then\ - if flight.intercepting then\ - flight:taskWithCAP()\ - end\ - else\ - if not flight.target then\ - flight:taskWithRTB()\ - end\ - end\ - else\ - gcicap.log:error('Could not find flight')\ - end" - } - } - } - } - } - } - } - } - } - - -- checkout of the patrol zone - if self.zone and not self.intercepting then - self:leaveCAPZone() - end - - intruder.intercepted = true - -- only set/reset the task if the target has moved significantly since last GCI update - if mist.utils.get3DDist( target_pos, self.intercept_point ) > gcicap.revector_threshold then - -- if there's still an EWR detecting or we are responding to the initial call - -- then set the target position. do not allow revectoring if no EWR is detecting us now - if (Unit.isExist(intruder.detected_by) and intruder.detected_by:isActive()) then - self.give_up = false - self.intercept_point = mist.utils.deepCopy(target_pos) - ctl:setTask(gci_task) - gcicap.log:info("Vectoring $1 to $2 ($3)", self.group:getName(), - intruder.group:getName(), target:getName()) - - else - gcicap.log:info("Cannot revector $1 to $2 because no longer detecting",self.group:getName(),intruder.group:getName()) - end - end - self.intercepting = true - - -- taskEngageGroup provides omniscient knowledge of where the group to be attacked is, which sucks - if not cold then - --gcicap.taskEngageGroup(self.group, intruder.group) - gcicap.taskEngage(self.group, 15000) - end - - -- reschedule function until either the interceptor or the intruder is dead - mist.scheduleFunction(gcicap.Flight.vectorToTarget, {self, intruder, cold}, - timer.getTime() + gcicap.vector_interval) - - else -- the target is dead or we had to give up, resume CAP or RTB - if self.zone then - -- send CAP back to work only if still intercepting - if self.intercepting then - self:taskWithCAP() - end - else - self.intercepting = false - -- send GCI back to homeplate - self:taskWithRTB() - end - end - else - -- our interceptor group is dead let's see if the - -- intruder is still there and set him to not beeing intercepted anymore - if target:isExist() then - intruder.intercepted = false - end - end - end - - --- Tasks flight with combat air patrol. - -- Creates waypoints inside it's assigned zone and tasks - -- the flight with patroling along the route. - -- @tparam[opt] boolean cold If set to true the flight won't - -- engage any enemy unit's it detects by itself. Default false. - function gcicap.Flight:taskWithCAP(cold) - -- only task with CAP if ther is still vul time left - if self.vul_time == 0 then - -- send flight RTB if no vul time left. - gcicap.log:info("No vul time left for $1", self.group_name) - self:taskWithRTB() - else - local group = self.group - local ctl = group:getController() - local side = gcicap.coalitionToSide(group:getCoalition()) - local start_pos = gcicap.getFirstActiveUnit(group):getPoint() - local leg_dist = math.random(gcicap[side].cap.leg_min, gcicap[side].cap.leg_max) - local cap_route = gcicap.buildCAPRoute(start_pos, self.zone.name, self.vul_time, leg_dist) - local cap_task = { - id = 'Mission', - params = { - route = cap_route - } - } - - self.intercepting = false - self.intercept_point = { x = 0, y = 0, z = 0 } - ctl:setTask(cap_task) - self:enterCAPZone() - ctl:setOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_SEARCH_IF_REQUIRED) - - if not cold then - gcicap.taskEngage(group) - end - gcicap.log:info("Tasking $1 with CAP in zone $2", group:getName(), self.zone.name) - end - end - - --- Tasks the flight to return to it's homeplate. - -- @tparam[opt] Airbase airbase optionally use this as homeplate/airbase - -- to return to. - -- @tparam[opt] boolean cold If set to true the flight won't - -- engage any targets it detects on the way back to base. - -- Default false. - function gcicap.Flight:taskWithRTB(airbase, cold) - if not airbase then - airbase = self.airbase - end - - if self.zone then - self:leaveCAPZone() - local side = self.side - -- let's try to spawn a new CAP flight as soon as the current one is tasked with RTB. - -- never spawn more than 2 x the groups_count, to prevent spam in case something ever goes wrong. - if (not gcicap[side].limit_resources or - (gcicap[side].limit_resources and gcicap[side].supply > 0)) - and #gcicap[side].cap.flights < gcicap[side].cap.groups_count * 2 then - gcicap.spawnCAP(side, self.zone, gcicap[side].cap.spawn_mode) - end - end - self.rtb = true - local group = self.group - local ctl = group:getController() - local af_pos = mist.utils.makeVec2(airbase:getPoint()) - local af_id = airbase:getID() - local rtb_task = { - id = 'Mission', - params = { - route = { - points = { - [1] = { - alt = gcicap.cap.min_alt, - alt_type = "BARO", - speed = gcicap.cap.speed, - x = af_pos.x, - y = af_pos.y, - aerodromeId = af_id, - type = "Land", - action = "Landing", - } - } - } - } - } - - ctl:setTask(rtb_task) - - if not cold then - -- only engage if enemy is inside of 10km of the leg - gcicap.taskEngage(group, 10000) - end - - gcicap.log:info("Tasking $1 with RTB to $2", group:getName(), airbase:getName()) - end - - --- Functions - -- @section gcicap - - --- Clean up inactive/stuck flights. - local function garbageCollector(side) - local timestamp = timer.getAbsTime() - for t, task in pairs(gcicap.tasks) do - for f, flight in pairs(gcicap[side][task].flights) do - if flight.group then - if flight.group:isExist() then - for u = 1, #flight.units_moved do - local unit = flight.units_moved[u].unit - -- check if unit exists - if unit then - if unit:isExist() then - -- if unit is in air we won't do anything - if not unit:inAir() then - -- check if unit is moving - local mag = mist.vec.mag(unit:getVelocity()) - if mag == 0 then - -- get the last time the unit moved - local last_moved = flight.units_moved[u].last_moved - if timestamp - last_moved > gcicap.move_timeout then - gcicap.log:info("Cleaning up $1", flight.group:getName()) - flight.group:destroy() - flight:remove() - end - else - flight.units_moved[u].last_moved = timestamp - end - end - end - end - end - else - flight:remove() - end - else - flight:remove() - end - end - end - end - - local function checkForTemplateUnits(side) - if gcicap[side].gci.enabled then - for i = 1, gcicap.template_count do - local unit = gcicap.gci.template_prefix..side..i - if not Unit.getByName(unit) then - gcicap.log:alert("GCI template unit missing: $1", unit) - return false - end - end - end - if gcicap[side].cap.enabled then - for i = 1, gcicap.template_count do - local unit = gcicap.cap.template_prefix..side..i - if not Unit.getByName(unit) then - gcicap.log:alert("CAP template unit missing: $1", unit) - return false - end - end - end - if gcicap[side].borders_enabled then - if not Group.getByName(gcicap[side].border_group) then - gcicap.log:alert("Border group is missing: $1", gcicap[side].border_group) - return false - end - end - return true - end - - local function checkForTriggerZones(side) - for i = 1, gcicap[side].cap.zones_count do - local zone_name = gcicap[side].cap.zone_name..i - if not trigger.misc.getZone(zone_name) then - gcicap.log:alert("CAP trigger zone is missing: $1", zone_name) - return false - end - end - return true - end - - local function manageCAP(side) - local patroled_zones = 0 - - for i = 1, #gcicap[side].cap.zones do - local zone = gcicap[side].cap.zones[i] - gcicap.log:info("Zone $1 has $2 patrols", zone.name, zone.patrol_count) - - -- see if we can send a new CAP into the zone - if zone.patrol_count <= 0 then - -- first check if we already hit the maximum amounts of routine CAP groups - if #gcicap[side].cap.flights < gcicap[side].cap.groups_count then - -- check if we limit resources and if we have enough supplies - -- if we don't limit resource or have enough supplies we spawn - if not gcicap[side].limit_resources or - (gcicap[side].limit_resources and gcicap[side].supply > 0) then - -- finally spawn it - gcicap.spawnCAP(side, gcicap[side].cap.zones[i], gcicap[side].cap.spawn_mode) - end - end - else - patroled_zones = patroled_zones + 1 - end - end - -- if all zones are patroled and we still have cap groups left - -- send them to a random zone - if #gcicap[side].cap.flights < gcicap[side].cap.groups_count then - if not gcicap[side].limit_resources or - (gcicap[side].limit_resources and gcicap[side].supply > 0) then - local random_zone = math.random(1, #gcicap[side].cap.zones) - gcicap.spawnCAP(side, gcicap[side].cap.zones[random_zone], gcicap[side].cap.spawn_mode) - end - end - gcicap.log:info("$1 patrols in $2/$3 zones with $4 flights", - side, patroled_zones, gcicap[side].cap.zones_count, #gcicap[side].cap.flights) - end - - local function handleIntrusion(side) - for i = 1, #gcicap[side].intruders do - local intruder = gcicap[side].intruders[i] - if intruder.group then - if intruder.group:isExist() then - -- check if we need to do something about him - if not intruder.intercepted then - -- first check if we have something to work with - if #gcicap[side].cap.flights > 0 - or #gcicap[side].gci.flights > 0 - or #gcicap[side].gci.flights < gcicap[side].gci.groups_count then - -- get closest flight to intruder if there is any - local closest = nil - local intruder_unit = gcicap.getFirstActiveUnit(intruder.group) - local closest_flights = gcicap.getClosestFlightsToUnit(side, intruder_unit) - -- we found close flights - local flight_avail = false - if closest_flights then - for j = 1, #closest_flights do - closest = closest_flights[j] - --fligh_avail = (not closest.flight.rtb) and (not closest.flight.intercepting) - flight_avail = (not closest.flight.intercepting) - if flight_avail then - gcicap.log:info("Found flight $1 which is avaliable for tasking.", - closest.flight.group:getName()) - break - end - end - end - if flight_avail then - -- check if we have a airfield which is closer to the unit than the closest flight - -- but add some distance to the airfield since it takes time for a potential spawned - -- flight to take-off - local closest_af, af_distance = gcicap.getClosestAirfieldToUnit(side, intruder_unit) - af_distance = af_distance + 15000 -- add 15km - if closest.distance < af_distance or af_distance == -1 then - -- task flight with intercept - closest.flight.give_up = false - closest.flight:vectorToTarget(intruder) - return - end - if (not gcicap[side].limit_resources - or (gcicap[side].limit_resources and gcicap[side].supply > 0)) - and #gcicap[side].gci.flights < gcicap[side].gci.groups_count - and gcicap[side].gci.enabled then - -- spawn CGI - gcicap.log:info("Airfield closer to intruder than flight or no flight available. Spawning GCI") - local gci = gcicap.spawnGCI(side, intruder) - end - else - if (not gcicap[side].limit_resources - or (gcicap[side].limit_resources and gcicap[side].supply > 0)) - and #gcicap[side].gci.flights < gcicap[side].gci.groups_count - and gcicap[side].gci.enabled then - -- spawn CGI - gcicap.log:info("No CAP flights or already airborne GCI. Spawning GCI") - local gci = gcicap.spawnGCI(side, intruder) - end - end - end - end - end - else - -- the intruder group doesn't exist (anymore) remove it - table.remove(gcicap[side].intruders, i) - end - end - end - - -- returns airfields of given side which are marked with - -- triggerzones (triggerzone name is exactly the same as airfield name). - local function getAirfields(side) - local coal_airfields = coalition.getAirbases(gcicap.sideToCoalition(side)) - local gcicap_airfields = {} - - -- loop over all coalition airfields - for i = 1, #coal_airfields do - -- get name of airfield - local af_name = coal_airfields[i]:getName() - if not string.match(af_name, "FARP") then - -- check if a triggerzone exists with that exact name - if mist.DBs.zonesByName[af_name] then - -- add it to our airfield list for gcicap - gcicap_airfields[#gcicap_airfields + 1] = coal_airfields[i] - end - end - end - - if #gcicap_airfields == 0 then - gcicap.log:warn("No airbase for $1 found", side) - end - return gcicap_airfields - end - - -- returns all currently active aircraft of the given side - -- parameter side has to be "red" or "blue" - local function getAllActiveAircrafts(side) - local filter = { "[" .. side .. "][plane]", "[" .. side .. "][helicopter]"} - local all_aircraft = mist.makeUnitTable(filter) - local active_aircraft = {} - - for i = 1, #all_aircraft do - local ac = Unit.getByName(all_aircraft[i]) - if ac ~= nil then - if Unit.isActive(ac) then - table.insert(active_aircraft, ac) - end - end - end - if #active_aircraft == 0 then - gcicap.log:warn("No active aircraft for $1 found", side) - end - return active_aircraft - end - - -- returns all currently active EWR and AWACS units of the given side - -- parameter side has to be "red" or "blue" - local function getAllActiveEWR(side) - local filter = { "[" .. side .. "][plane]", "[" .. side .. "][vehicle]", "[" .. side .. "][ship]"} - local all_vecs = mist.makeUnitTable(filter) - local active_ewr = {} - - for i = 1, #all_vecs do - local vec = Unit.getByName(all_vecs[i]) - if vec ~= nil then - if Unit.isActive(vec) then - local vec_type = Unit.getTypeName(vec) - if vec_type == "55G6 EWR" - or vec_type == "1L13 EWR" - or vec_type == "Hawk sr" - or vec_type == "Patriot str" then - table.insert(active_ewr, { unit = vec, is_awacs = false} ) - end - -- ED has a bug; the E-2D vehicle has type E-2C - if (vec_type == "A-50" and gcicap[side].awacs) - or (vec_type == "E-2C" and gcicap[side].awacs) - or (vec_type == "E-3A" and gcicap[side].awacs) then - table.insert(active_ewr, { unit = vec, is_awacs = true} ) - end - end - end - end - if #active_ewr == 0 then - gcicap.log:warn("No active EWR for $1 found", side) - end - return active_ewr - end - - local function checkForAirspaceIntrusion(side) - -- init some local vars - local border = gcicap[side].border - local active_ewr = gcicap[side].active_ewr - local intruder_count = 0 - local intruder_side = "" - local toremove = {} - if side == "red" then - -- set the side of the intruder - intruder_side = "blue" - elseif side == "blue" then - intruder_side = "red" - end - local active_ac = gcicap[intruder_side].active_aircraft - - -- only do something if we have active ewr and active aircraft - if #active_ac > 0 and #active_ewr > 0 then - -- loop over all aircraft - for i = 1, #active_ac do - local ac = active_ac[i] - local ac_detected = false - local ac_intruded = false - local ac_pos = {} - local ac_group = nil - local intruder_num = 0 - local ewr = nil - if ac ~= nil then - ac_group = ac:getGroup() - if ac_group:isExist() then - ac_pos = ac:getPoint() - - -- now loop over all ewr units - for n = 1, #active_ewr do - local ewr_controller = nil - if active_ewr[n].is_awacs then - ewr_controller = active_ewr[n].unit:getController() - else - ewr_controller = active_ewr[n].unit:getGroup():getController() - end - -- and check if the EWR detected the aircraft - if ewr_controller:isTargetDetected(ac, RADAR) then - ewr = active_ewr[n].unit - ac_detected = true - -- stop once it was detected by one EWR - break - end - end - - if ac_detected then - -- do we check borders? - if gcicap[side].borders_enabled then - ac_intruded = mist.pointInPolygon(ac_pos, border) - else - -- if not the aircarft is always intruding - ac_intruded = true - end - - if ac_intruded then - local in_list = false - -- check if we already know about the intruder - for j = 1, #gcicap[side].intruders do - if gcicap[side].intruders[j].name == ac_group:getName() then - in_list = true - intruder_num = j - break - end - end - if not in_list then - intruder_count = intruder_count + 1 - - gcicap.log:info("$1 ($2) intruded airspace of $3 detected by $4 ($5)", - ac_group:getName(), ac:getName(), side, - ewr:getGroup():getName(), ewr:getName()) - - intruder = { - name = ac_group:getName(), - --unit = ac, - group = ac_group, - detected_by = ewr, - --groupID = ac_group:getID(), - --unitID = ac:getID(), - --unitType = ac:getTypeName(), - size = ac_group:getSize(), - intercepted = false, - } - table.insert(gcicap[side].intruders, intruder) - intruder_num = #gcicap[side].intruders - end - - -- send message to all units of coalition or some specified groups - -- that we have a intruder - if gcicap[side].gci.messages then - local par = { - units = { ac:getName() }, - ref = gcicap[side].bullseye, - alt = ac_pos.y, - } - -- do we want to display in metric units? - if gcicap[side].gci.messages_metric then - par.metric = true - end - - local msg_for = {} - -- if groups are specified find their units names and add them to the list - if #gcicap[side].gci.messages_to > 0 then - msg_for.units = {} - for g, group_name in pairs(gcicap[side].gci.messages_to) do - group = Group.getByName(group_name) - if group ~= nil then - for u, unit in pairs(group:getUnits()) do - table.insert(msg_for.units, unit:getName()) - end - end - end - else - msg_for.coa = { side } - end - -- get the bearing, range and altitude from bullseye to intruder - local bra = mist.getBRString(par) - local bra_string = "Airpsace intrusion! BRA from bullseye "..bra - local msg = { - text = bra_string, - displayTime = gcicap.gci.message_time, - msgFor = msg_for, - name = "gcicap.gci.msg"..intruder_num, - } - -- finally send the message - mist.message.add(msg) - end - end -- if ac_intruded - else - -- the ac is _not_ intruding so we should remove it from the intruders list - - local in_list = false - local intruder_num = 0 - -- check if we already know about the intruder - for j = 1, #gcicap[side].intruders do - if gcicap[side].intruders[j].name == ac_group:getName() then - in_list = true - intruder_num = j - break - end - end - if in_list then toremove[#toremove + 1] = intruder_num end - end -- if ac_detected - end -- if ac_group is existing - end -- if ac ~= nil - end -- for #active_ac - end -- if active_ac > 0 and active_ewr > 0 - - -- we need to remove intruders from outside the loop - if #toremove > 0 then - for i = 1,#toremove do - intruder_count = intruder_count - 1 - gcicap.log:info("Aircraft "..gcicap[side].intruders[i].name.." no longer intruding") - table.remove(gcicap[side].intruders,i) - end - end - if intruder_count > 0 then - return true - else - return false - end - --return gcicap[side].intruders - end - - -- returns a random airfield for the given side - local function getRandomAirfield(side) - local rand = math.random(1, #gcicap[side].airfields) - return gcicap[side].airfields[rand] - end - - local function buildFirstWp(airbase, spawn_mode) - local airbase_pos = airbase:getPoint() - local airbase_id = airbase:getID() - local wp = mist.fixedWing.buildWP(airbase_pos) - - if spawn_mode == "parking" then -- start from parking area - wp.airdromeId = airbase_id - wp.type = "TakeOffParking" - wp.action = "From Parking Area" - elseif spawn_mode == "takeoff" then -- or start from runway - wp.airdromeId = airbase_id - wp.type = "TakeOff" - wp.action = "From Runway" - elseif spawn_mode == "air" then - -- randomize spawn position a little bit in case of air start - wp.x = wp.x + (50 * math.sin(math.random(10))) - wp.y = wp.y + (50 * math.sin(math.random(10))) - end - - return wp - end - - --- Converts coaltion number to side string. - -- 0 = "neutral", 1 = "red", 2 = "blue" - -- @tparam number coal coaltion number. - -- @treturn string side - function gcicap.coalitionToSide(coal) - if coal == coalition.side.NEUTRAL then return "neutral" - elseif coal == coalition.side.RED then return "red" - elseif coal == coalition.side.BLUE then return "blue" - end - end - - --- Converts side string to coaltion number. - -- 0 = "neutral", 1 = "red", 2 = "blue" - -- @tparam string side side string. - -- @treturn number coalition number. - -- @see coalitionToSide - function gcicap.sideToCoalition(side) - if side == "neutral" then return coalition.side.NEUTRAL - elseif side == "red" then return coalition.side.RED - elseif side == "blue" then return coalition.side.BLUE - end - end - - --- Returns first active unit of a group. - -- @tparam Group group group whose first active - -- unit to return. - -- @treturn Unit first active unit of group. - function gcicap.getFirstActiveUnit(group) - if group ~= nil then - -- engrish mast0r isExistsingsed - if not group:isExist() then return nil end - local units = group:getUnits() - for i = 1, group:getSize() do - if units[i] then - return units[i] - end - end - return nil - else - return nil - end - end - - --- Returns the closest airfield to unit. - -- Returned airfield is controlled by given side. This function - -- also returns the distance to the unit. - -- @tparam string side side string, either "red" or "blue". - -- The airfield returned has to be controlled by this side. - -- @tparam Unit unit unit to use as reference. - -- @treturn table @{closestAirfieldReturn} - function gcicap.getClosestAirfieldToUnit(side, unit) - if not unit then - gcicap.log:error("Couldn't find unit.") - return - end - local airfields = gcicap[side].airfields - - if #airfields == 0 then - gcicap.log:warn("There are no airfields of side $1", side) - return nil - end - - local unit_pos = mist.utils.makeVec2(unit:getPoint()) - local min_distance = -1 - local closest_af = nil - - for i = 1, #airfields do - local af = airfields[i] - local af_pos = mist.utils.makeVec2(af:getPoint()) - local distance = mist.utils.get2DDist(unit_pos, af_pos) - - if distance < min_distance or min_distance == -1 then - min_distance = distance - closest_af = af - end - end - - --- Table returned by getClosestAirfieldToUnit. - -- @table closestAirfieldReturn - -- @tfield Airbase airfield the Airbase object - -- @tfield number distance the distance in meters - -- to the unit. - --return {airfield = closest_af, distance = min_distance} - return closest_af, min_distance - end - - --- Returns the closest flights to the given unit. - -- Flights returned are of given side. This function also returns - -- their distance to the unit. The returned flights are sorted - -- by distance. First is the closest. - -- @tparam string side side whose flights to search. - -- @tparam Unit unit unit object used as reference. - -- @treturn table Array sorted by distance - -- containing @{closestFlightsReturn} tables. - function gcicap.getClosestFlightsToUnit(side, unit) - if not unit then - gcicap.log:error("Couldn't find unit.") - return - end - local closest_flights = {} - if #gcicap[side].cap.flights == 0 and #gcicap[side].gci.flights == 0 then - gcicap.log:info("No CAP or GCI flights of side $1 active", side) - return nil - else - local unit_pos = mist.utils.makeVec2(unit:getPoint()) - local min_distance = -1 - for t, task in pairs(gcicap.tasks) do - local flights = gcicap[side][task].flights - for i = 1, #flights do - if flights[i].group then - local u = gcicap.getFirstActiveUnit(flights[i].group) - if u then - local u_pos = mist.utils.makeVec2(u:getPoint()) - local distance = mist.utils.get2DDist(unit_pos, u_pos) - table.insert(closest_flights, {flight = flights[i], distance = distance }) - else - break - end - end - end - end - - -- sort closest flights - table.sort(closest_flights, function(a,b) - if a.distance < b.distance then - return true - else - return false - end - end) - - --- Table returned by getClosestFlightsToUnit. - -- @table closestFlightsReturn - -- @tfield gcicap.Flight flight object - -- @tfield number distance distance in meters from - -- the unit. - return closest_flights - end - end - - --- Returns a table containting a CAP route. - -- Route originating from given airbase, waypoints - -- are placed randomly inside given zone. Optionally - -- you can specify the amount of waypoints inside the zone. - -- @tparam string zone trigger zone name - -- @tparam number vul_time time on station - -- @tparam number leg_distance leg distance for race-track pattern orbit. - function gcicap.buildCAPRoute(start_pos, zone, vul_time, leg_distance) - local points = {} - -- make altitude consistent for the whole route. - local alt = math.random(gcicap.cap.min_alt, gcicap.cap.max_alt) - - local start_vul_script = "local group = ...\ - local flight = gcicap.Flight.getFlight(group)\ - if flight then\ - gcicap.log:info('$1 starting vul time $2 at $3',\ - flight.group_name, flight.vul_time, flight.zone.name)\ - flight.vul_start = timer.getAbsTime()\ - else\ - gcicap.log:error('Could not find flight')\ - end" - - local end_vul_script = "local group = ...\ - local flight = gcicap.Flight.getFlight(group)\ - if flight then\ - gcicap.log:info('$1 vul time over at $2',\ - flight.group_name, flight.zone.name)\ - flight:taskWithRTB()\ - else\ - gcicap.log:error('Could not find flight')\ - end" - - -- build orbit start waypoint - local orbit_start_point = mist.getRandomPointInZone(zone) - -- add a bogus waypoint so the start vul time script block - -- isn't executed instantly after tasking - points[1] = mist.fixedWing.buildWP(start_pos) - points[2] = mist.fixedWing.buildWP(orbit_start_point) - points[2].task = {} - points[2].task.id = 'ComboTask' - points[2].task.params = {} - points[2].task.params.tasks = {} - points[2].task.params.tasks[1] = { - number = 1, - auto = false, - id = 'WrappedAction', - enabled = true, - params = { - action = { - id = 'Script', - params = { - command = start_vul_script - } - } - } - } - points[2].task.params.tasks[2] = { - number = 2, - auto = false, - id = 'ControlledTask', - enabled = true, - params = { - task = { - id = 'Orbit', - params = { - altitude = alt, - pattern = 'Race-Track', - speed = gcicap.cap.speed - } - }, - stopCondition = { - duration = vul_time * 60 - } - } - } - - -- if we don't use the race-track pattern we'll add the vul end time - -- waypoint right where the start waypoint is and use the 'Circle' pattern. - local orbit_end_point - if not gcicap.cap.race_track_orbit then - points[2].task.params.tasks[2].params.task.params.pattern = 'Circle' - orbit_end_point = start_pos - else - -- build second waypoint (leg end waypoint) - --local orbit_end_point = mist.getRandPointInCircle(orbit_start_point, leg_distance, leg_distance) - orbit_end_point = mist.getRandomPointInZone(zone) - end - - points[3] = mist.fixedWing.buildWP(orbit_end_point) - points[3].task = { - id = 'WrappedAction', - params = { - action = { - id = 'Script', - params = { - command = end_vul_script - } - } - } - } - - for i = 1, 3 do - points[i].speed = gcicap.cap.speed - points[i].alt = alt - end - - -- local ground_level = land.getHeight(point) - -- -- avoid crashing into hills - -- if (alt - 100) < ground_level then - -- alt = alt + ground_level - -- end - - gcicap.log:info("Built CAP route with $1 min vul time at $2 meters in $3", vul_time, alt, zone) - - local route = {} - route.points = points - return route - end - - --- Tasks group to automatically engage any spotted targets. - -- @tparam Group group group to task. - -- @tparam[opt] number max_dist maximum engagment distance. - -- Targets further out (from the route) won't be engaged. - function gcicap.taskEngage(group, max_dist) - if not max_dist then - max_dist = gcicap.cap.max_engage_distance - end - local ctl = group:getController() - local engage = { - id = 'EngageTargets', - params = { - maxDist = max_dist, - maxDistEnabled = true, - targetTypes = { [1] = "Air" }, - priority = 0 - } - } - ctl:pushTask(engage) - end - - --- Tasks group to engage a group. - -- @tparam Group group group to task. - -- @tparam Group target group that should be engaged by - -- given group. - function gcicap.taskEngageGroup(group, target) - local ctl = group:getController() - local engage_group = { - id = 'EngageGroup', - params = { - groupId = target:getID(), - directionEnabled = false, - priority = 0, - altittudeEnabled = false, - } - } - ctl:pushTask(engage_group) - end - - --- Spawns a fighter group. - -- @tparam string side side of the newly created group. - -- Can be "red" or "blue". - -- @tparam string name new group name. - -- @tparam number size count of aircraft in the new group. - -- @tparam Airbase airbase home plate of the new group. - -- @tparam string spawn_mode How the new group will be spawned. - -- Can be 'parking' or 'air'. 'parking' will spawn them at the ramp - -- wit engines turned off. 'air' will spawn them in the air already - -- flying. - -- @tparam string task Task of the new group. Can either be 'cap', - -- for combat air patrol, or 'gci', for ground controlled intercept. - -- @tparam[opt] string zone zone name in which to spawn the unit. This only is - -- taken into account if spawn_mode is "in-zone". - -- @tparam[opt] boolean cold if set to true the newly group won't engage - -- any enemys until tasked otherwise. Default false. - -- @treturn Group|nil newly spawned group or nil on failure. - function gcicap.spawnFighterGroup(side, name, size, airbase, spawn_mode, task, zone, cold) - local template_unit_name = gcicap[task].template_prefix..side..math.random(1, gcicap.template_count) - local template_unit = Unit.getByName(template_unit_name) - if not template_unit then - gcicap.log:error("Can't find template unit $1. This should never happen.\ - Somehow the template unit got deleted.", template_unit_name) - return nil - end - local template_group = mist.getGroupData(template_unit:getGroup():getName()) - local template_unit_data = template_group.units[1] - local airbase_pos = airbase:getPoint() - local group_data = {} - local unit_data = {} - local onboard_num = template_unit_data.onboard_num - 1 - local route = {} - - local rand_point = {} - if spawn_mode == "in-zone" then - rand_point = mist.getRandomPointInZone(zone) - end - - for i = 1, size do - unit_data[i] = {} - unit_data[i].type = template_unit_data.type - unit_data[i].name = name.." Pilot "..i - if spawn_mode == "in-zone" then - unit_data[i].x = rand_point.x + (50 * math.sin(math.random(10))) - unit_data[i].y = rand_point.y + (50 * math.sin(math.random(10))) - else - unit_data[i].x = airbase_pos.x + (50 * math.sin(math.random(10))) - unit_data[i].y = airbase_pos.z + (50 * math.sin(math.random(10))) - end - unit_data[i].alt = gcicap[side].cap.min_alt - unit_data[i].onboard_num = onboard_num + i - unit_data[i].groupName = name - unit_data[i].payload = template_unit_data.payload - unit_data[i].skill = template_unit_data.skill - unit_data[i].livery_id = template_unit_data.livery_id - if side == 'blue' then - unit_data[i].callsign = {} - unit_data[i].callsign[1] = 4 -- Colt - unit_data[i].callsign[2] = gcicap[side].cap.flight_num - unit_data[i].callsign[3] = i - else - unit_data[i].callsign = 600 + gcicap[side].cap.flight_num + i - end - end - - group_data.units = unit_data - group_data.groupName = name - group_data.hidden = gcicap[side].hide_groups - --group_data.country = template_group.country - group_data.country = template_unit:getCountry() - group_data.category = template_group.category - group_data.task = "CAP" - - route.points = {} - if spawn_mode == "in-zone" then - route.points[1] = mist.fixedWing.buildWP(rand_point) - route.points[1].alt = gcicap[side].cap.min_alt - route.points[1].speed = gcicap[side].cap.speed - else - route.points[1] = buildFirstWp(airbase, spawn_mode) - end - group_data.route = route - - if mist.groupTableCheck(group_data) then - local spawn_pos = airbase:getName() - if spawn_mode == "in-zone" then - spawn_pos = zone - end - gcicap.log:info("Spawning fighter group $1 at $2", name, spawn_pos) - mist.dynAdd(group_data) - else - gcicap.log:error("Couldn't spawn group with following groupTable: $1", group_data) - end - - return Group.getByName(name) - end - - --- Spawns a CAP flight. - -- @tparam string side side for the new CAP. - -- @tparam string zone CAP zone (trigger zone) name. - -- @tparam string spawn_mode how the new CAP will be spawned. - -- Can be 'parking' or 'air'. - function gcicap.spawnCAP(side, zone, spawn_mode) - -- increase flight number - gcicap[side].cap.flight_num = gcicap[side].cap.flight_num + 1 - -- select random airbase (for now) TODO: choose closest airfield - local airbase = getRandomAirfield(side) - local group_name = "CAP "..side.." "..gcicap[side].cap.flight_num - -- define size of the flight - local size = gcicap[side].cap.group_size - if size == "randomized" then - size = math.random(1,2)*2 - else - size = tonumber(size) - end - -- actually spawn something - local group = gcicap.spawnFighterGroup(side, group_name, size, airbase, spawn_mode, "cap", zone.name) - --local ctl = group:getController() - --ctl:setOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_ATTACK_ONLY) - gcicap[side].supply = gcicap[side].supply - 1 - -- keep track of the flight - local flight = gcicap.Flight:new(group, airbase, "cap", zone) - -- task the group, for some odd reason we have to wait until we use setTask - -- on a freshly spawned group. - mist.scheduleFunction(gcicap.Flight.taskWithCAP, {flight}, timer.getTime() + 5) - return group - end - - --- Spawns a GCI flight. - -- @tparam string side side for the new GCI. - -- @tparam Unit intruder unit to intercept. - -- @tparam Airbase airbase airbase at which to spawn the GCI flight. - function gcicap.spawnGCI(side, intruder, airbase) - -- increase flight number - gcicap[side].gci.flight_num = gcicap[side].gci.flight_num + 1 - -- select closest airfield to unit - local intruder_unit = gcicap.getFirstActiveUnit(intruder.group) - local closest_af = gcicap.getClosestAirfieldToUnit(side, intruder_unit) - if closest_af then - airbase = closest_af - else - gcicap.log:warn("Couldn't find close airfield for GCI. Choosing one at random.") - airbase = getRandomAirfield(side) - end - local tgt_units = intruder.group:getUnits() - local group_name = "GCI "..side.." "..gcicap[side].gci.flight_num - -- define size of the flight - local size = gcicap[side].gci.group_size - if size == "randomized" then - size = math.random(1,2)*2 - elseif size == "dynamic" then - size = #tgt_units - else - size = tonumber(size) - end - -- actually spawn something - local group = gcicap.spawnFighterGroup(side, group_name, size, airbase, gcicap[side].gci.spawn_mode, "gci") - local ctl = group:getController() - -- make the GCI units only use their radar for attacking - ctl:setOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_ATTACK_ONLY) - gcicap[side].supply = gcicap[side].supply - 1 - -- keep track of the flight - local flight = gcicap.Flight:new(group, airbase, "gci", intruder) - -- vector the interceptor group on the target the first time. - mist.scheduleFunction(gcicap.Flight.vectorToTarget, {flight, intruder}, timer.getTime() + 5) - return group - end - - --- Initialization function - -- Checks if all template units are present. Creates - -- border polygons if borders enabled. - -- @todo complete documentation. - function gcicap.init() - for i, side in pairs(gcicap.sides) do - if not (checkForTemplateUnits(side) and checkForTriggerZones(side)) then - return false - end - if gcicap[side].borders_enabled then - gcicap[side].border = mist.getGroupPoints(gcicap[side].border_group) - end - gcicap[side].intruders = {} - gcicap[side].cap.zones = {} - gcicap[side].cap.flights = {} - gcicap[side].gci.flights = {} - gcicap[side].cap.flight_num = 0 - gcicap[side].gci.flight_num = 0 - gcicap[side].airfields = getAirfields(side) - - if gcicap[side].cap.enabled then - -- loop through all zones - for i = 1, gcicap[side].cap.zones_count do - local zone_name = gcicap[side].cap.zone_name..i - local point = trigger.misc.getZone(zone_name).point - local size = trigger.misc.getZone(zone_name).radius - - -- create zone table - gcicap[side].cap.zones[i] = { - name = zone_name, - pos = point, - radius = size, - patrol_count = 0, - } - end - - for i = 1, gcicap[side].cap.groups_count do - local spawn_mode = "parking" - if gcicap[side].cap.start_airborne then - spawn_mode = "in-zone" - end - -- try to fill all zones - local zone = gcicap[side].cap.zones[i] - -- if we have more flights than zones we select one random zone - if zone == nil then - zone = gcicap[side].cap.zones[math.random(1, gcicap[side].cap.zones_count)] - end - -- actually spawn the group - --local grp = gcicap.spawnCAP(side, zone, spawn_mode) - -- delay the spawn by gcicap interval seconds after one another - local spawn_delay = (i - 1) * gcicap.initial_spawn_delay - mist.scheduleFunction(gcicap.spawnCAP, {side, zone, spawn_mode}, timer.getTime() + spawn_delay) - end - end - end - -- add event handler managing despawns - return true - end - - --- Main function. - -- Run approx. every @{gcicap.interval} sconds. A random amount - -- of 0 to 2 seconds is added for declustering. - -- @todo do the "declustering" at a different level. Probably - -- more efficient. - function gcicap.main() - for i, side in pairs(gcicap.sides) do - -- update list of occupied airfields - gcicap[side].airfields = getAirfields(side) - -- update list of all aircraft - gcicap[side].active_aircraft = getAllActiveAircrafts(side) - -- update list of all EWR - gcicap[side].active_ewr = getAllActiveEWR(side) - end - - -- check for airspace intrusions after updating all the lists - for i, side in pairs(gcicap.sides) do - if gcicap[side].cap.enabled then - manageCAP(side) - end - checkForAirspaceIntrusion(side) - handleIntrusion(side) - garbageCollector(side) - end - end - -end - -if gcicap.init() then - local start_delay = gcicap.initial_spawn_delay * math.max(gcicap.red.cap.groups_count, gcicap.blue.cap.groups_count) - mist.scheduleFunction(gcicap.main, {}, timer.getTime() + start_delay, gcicap.interval) -end - --- vim: sw=2:ts=2 +--[[ +Copyright (c) 2016 Snafu, Stonehouse, Rivvern, Chameleon Silk, lukrop. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute copies of the Software, +and to permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software and the Software shall not be +included in whole or part in any sort of paid for software or paid for downloadable +content (DLC) without the express permission of the copyright holders. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +]] + +--[[-- +## Overview +Autonomous GCI and CAP script for DCS: World. +The script provides an autonomous model of combat air patrols and ground controlled +interceptors for use with DCS World by mission builders. + +After minimal setup the script will automatically spawn CAP and GCI flights for two +sides and give them patrol and intercept tasks as well as returning them to base when +threats cease to be detected. + +Originally created by Snafu, enhanced and further modified by Stonehouse, +Rivvern, Chameleon Silk. + +Rewritten by lukrop. + +## Links + +Github repository: + +@script GCICAP +@author Snafu +@author Stonehouse +@author Rivvern +@author Chameleon Silk +@author lukrop +@copyright 2016 Snafu, Stonehouse, Rivvern, Chameleon Silk, lukrop. +@license Modified MIT. See LICENSE file. +]] + +gcicap = {} +gcicap.red = {} +gcicap.red.gci = {} +gcicap.red.cap = {} +gcicap.blue = {} +gcicap.blue.gci = {} +gcicap.blue.cap = {} +gcicap.cap = {} +gcicap.gci = {} + +--- Sets how verbose the log output will be. +-- Possible values are "none", "info", "warning" and "error". +-- I recommend "error" for production. +gcicap.log_level = "error" + +--- Interval, in seconds, of main function. +-- Default 30 seconds. +gcicap.interval = 30 + +--- Interval, in seconds, GCI flights get vectors on targets. +-- AI GCI flights don't use their radar, to be as stealth as +-- possible, relying on those vectors. +-- Default 15 seconds. +gcicap.vector_interval = 15 + +--- How far does a target have to move before an intercept is revectored +gcicap.revector_threshold = 15000 + +--- Initial spawn delay between CAPs +-- Default 30 seconds. +gcicap.initial_spawn_delay = 30 + +--- Enable/disable borders for the red side. +-- CAP units only engage if enemy units intrude their airspace +gcicap.red.borders_enabled = true + +--- Enable/disable borders for the blue side. +-- CAP units only engage if enemy units intrude their airspace +gcicap.blue.borders_enabled = true + +--- CAP minimum altitudes in meters. +-- Default 4500 +gcicap.cap.min_alt = 6100 + +--- CAP maximum altitudes in meters. +-- Default 7500 +gcicap.cap.max_alt = 10500 + +--- Speed for CAP flights on their CAP route. +-- speed is in m/s. Default 220. +gcicap.cap.speed = 220 + +--- Speed for GCI flights on intercept +-- speed is in m/s. Default 300. +gcicap.gci.speed = 300 + +--- Maximum engage distance for CAP flights as long as they are on patrol. +-- this might be overruled by an intercept vector given from +-- ground control (EWR). Default 15000. +gcicap.cap.max_engage_distance = 15000 + +--- Minimum red CAP VUL time in minutes. +-- Minimum time the red CAP flight will orbit on station. +gcicap.red.cap.vul_time_min = 25 + +--- Maximum red CAP VUL time in minutes. +-- Maximum time the red CAP flight will orbit on station. +gcicap.red.cap.vul_time_max = 40 + +--- Minimum blue CAP VUL time in minutes. +gcicap.blue.cap.vul_time_min = 25 + +--- Maximum blue CAP VUL time in minutes. +gcicap.blue.cap.vul_time_max = 30 + +--- Use race-track orbit for CAP flights +-- If true CAPs will use a race-track pattern for orbit +-- between two points in the CAP zone. +gcicap.cap.race_track_orbit = false + +--[[ INOP at the time +--- Minimum leg length for red CAP orbits in meters. +gcicap.red.cap.leg_min = 10000 + +--- Maximum leg length for red CAP orbits in meters. +gcicap.red.cap.leg_min = 20000 + +--- Minimum leg length for blue CAP orbits in meters. +gcicap.blue.cap.leg_min = 10000 + +--- Maximum leg length for blue CAP orbits in meters. +gcicap.blue.cap.leg_min = 20000 +]]-- + +--- Enable/disable red CAP flights airborne start. +-- set to true for CAP flight to start airborne at script initialisation +-- (mission start), false for taking off from the airfield. +-- Default true. +gcicap.red.cap.start_airborne = false + +--- Enable/disable blue CAP flights airborne start. +gcicap.blue.cap.start_airborne = false + +--- Amount of red CAP zones. +-- placed with triggerzones in the ME. +gcicap.red.cap.zones_count = 4 + +--- Amount of blue CAP zones. +gcicap.blue.cap.zones_count = 4 + +--- Amount of red CAP groups concurrently in the air. +gcicap.red.cap.groups_count = 3 + +--- Amount of blue CAP groups concurrently in the air. +gcicap.blue.cap.groups_count = 2 + +--- Group size of red CAP flights. +-- Can be "2", "4" or "randomized" +-- +-- If "2" it consists of 2 planes, if "4" it consists of 4 planes +-- if "randomized", the CAP groups consist of either 2 or 4 planes +gcicap.red.cap.group_size = "randomized" + +--- Group size of blue CAP flights. +-- See @{gcicap.red.cap.group_size} +gcicap.blue.cap.group_size = "4" + +--- Maximum amount of concurrent red intercepts. +gcicap.red.gci.groups_count = 3 + +--- Maximum amount of concurrent blue intercepts. +gcicap.blue.gci.groups_count = 2 + +--- Group size of red GCI flights. +-- Can be "2", "4" or "dynamic" +-- +-- If "2" it consists of 2 planes, if "4" it consists of 4 planes +-- if "dynamic", the GCI groups consist of as much aircrafts +-- as the intruder group. +gcicap.red.gci.group_size = "dynamic" + +--- Group size of blue GCI flights. +-- See @{gcicap.red.gci.group_size} +gcicap.blue.gci.group_size = "dynamic" + +--- Enable/disable GCI messages for red +gcicap.red.gci.messages = false + +--- Enable/disable GCI messages for blue +gcicap.blue.gci.messages = false + +--- How long a GCI message will be shown in seconds. +gcicap.gci.message_time = 5 + +--- Display GCI messages with metric measurment for red. +-- If false the imperial system is used. +gcicap.red.gci.messages_metric = true + +--- Display GCI messages with metric measurment for blue. +-- If false the imperial system is used. +gcicap.blue.gci.messages_metric = false + +--- Names of red groups which will receive GCI messages. +-- Leave blank for all groups of coalition +-- @usage gcicap.red.gci.messages_to = { "my group 1", "GCI Flight" } +gcicap.red.gci.messages_to = {} + +--- Names of blue groups which will receive GCI messages. +-- See @{gcicap.red.gci.messages_to} for format. +gcicap.blue.gci.messages_to = {} + +--- How red CAP flights are spawned. +-- can be "parking", "takeoff" or "air" and defines the way the fighters spawn +-- takeoff is NOT RECOMMENDED currently since their occur timing issues with tasking +-- if a flight is queued for takeoff and not already in the game world while getting tasked +-- +-- Default 'parking' +gcicap.red.cap.spawn_mode = "parking" + +--- How red GCI flights are spawned. +-- @see gcicap.red.cap.spawn_mode +gcicap.red.gci.spawn_mode = "parking" + +--- How blue CAP flights are spawned. +-- @see gcicap.red.cap.spawn_mode +gcicap.blue.cap.spawn_mode = "parking" + +--- How blue GCI flights are spawned. +-- @see gcicap.red.cap.spawn_mode +gcicap.blue.gci.spawn_mode = "parking" + +--- Hide or reveal blue air units in the mission. +gcicap.blue.hide_groups = false + +--- Hide or reveal red air units in the mission. +gcicap.red.hide_groups = false + +--- Enable/disable red CAP flights. +gcicap.red.cap.enabled = true + +--- Enable/disable blue CAP flights. +gcicap.blue.cap.enabled = true + +--- Enable/disable red GCI flights. +gcicap.red.gci.enabled = true + +--- Enable/disable blue GCI flights. +gcicap.blue.gci.enabled = true + +--- Enabel/disable resource limitation for red. +-- If set to true limits the amount of groups a side can spawn. +gcicap.red.limit_resources = false + +--- Enabel/disable resource limitation for blue. +-- @see gcicap.red.limit_resources +gcicap.blue.limit_resources = false + +--- Amount of groups(!) red has at it's disposal. +-- In other words how many Groups of airplanes +-- this side can spawn. +gcicap.red.supply = 24 + +--- Amount of groups(!) red has at it's disposal. +-- @see gcicap.red.supply +gcicap.blue.supply = 24 + +--- Name of the trigger zone which defines red CAP zones. +-- This will be postfixed with the number of +-- the zone. e.g. "redCAPzone3" or "blueCAPzone1". +-- +-- Default: 'redCAPzone'. +gcicap.red.cap.zone_name = 'redCAPzone' + +--- Name of the trigger zone which defines blue CAP zones. +-- Default: 'blueCAPzone'. +-- @see gcicap.red.cap.zone_name +gcicap.blue.cap.zone_name = 'blueCAPzone' + +--- Name of group which waypoints define the red border. +-- Default: 'redborder'. +gcicap.red.border_group = 'redborder' + +--- Name of group which waypoints define the blue border. +-- Default: 'blueborder'. +gcicap.blue.border_group = 'blueborder' + +--- GCI template unit's names prefix. +gcicap.gci.template_prefix = '__GCI__' + +--- CAP template unit's names prefix. +gcicap.cap.template_prefix = '__CAP__' + +--- Count of template units. +-- Remember that this means you need that many +-- template units for each type. E.g. if the template_count is 2 you +-- would need two GCI and two CAP template units for each side. +gcicap.template_count = 4 + +--- Wether red will also acquire targets by AWACS aircraft. +-- This is is currently broken since isTargetDetected doesn't +-- seem to work with AWACS airplanes. Needs a workaround. +-- +-- Default false. +gcicap.red.awacs = false + +--- Wether blue will also acquire targets by AWACS aircraft. +-- @see gcicap.red.awacs +gcicap.blue.awacs = true + +--- Garbage collector move timeout +-- If a unit (aircraft) is on the ground and didn't move +-- since this timeout, in seconds, it will be removed. +-- This applies only to aircraft spawned by GCICAP. +gcicap.move_timeout = 300 + +-- shortcut to the bullseye +gcicap.red.bullseye = coalition.getMainRefPoint(coalition.side.RED) +gcicap.blue.bullseye = coalition.getMainRefPoint(coalition.side.BLUE) + +gcicap.sides = { "red", "blue" } +gcicap.tasks = { "cap", "gci" } + +gcicap.log = mist.Logger:new("GCICAP", gcicap.log_level) + +do + --- Flight class. + -- @type gcicap.Flight + gcicap.Flight = {} + + local function getFlightIndex(group) + if type(group) ~= "string" then + if group:getName() then + group = group:getName() + else + return false + end + end + for i, side in pairs(gcicap.sides) do + for j, task in pairs(gcicap.tasks) do + for n = 1, #gcicap[side][task].flights do + if gcicap[side][task].flights[n].group_name == group then + return {side = side, task = task, index = n} + end + end + end + end + return false + end + + --- Returns the flight for the given group. + -- @tparam string|Group group this can be a Group object + -- or the group name. + -- @treturn gcicap.Flight the flight for the given group. + function gcicap.Flight.getFlight(group) + f = getFlightIndex(group) + if f then + return gcicap[f.side][f.task].flights[f.index] + else + return false + end + end + + --- Creates a new flight. + -- @tparam Group group group of the flight. + -- @tparam Airbase airbase homplate of the new flight. + -- @tparam string task task of the new flight. Can be "cap" or "gci". + -- @param param task parameter. This can be a zone table if it's a + -- CAP flight or it could be a target unit if it's a GCI flight. + function gcicap.Flight:new(group, airbase, task, param) + if group:isExist() then + local side = gcicap.coalitionToSide(group:getCoalition()) + local f = {} + f.side = side + f.give_up = false + f.group = group + f.group_name = group:getName() + f.airbase = airbase + f.task = task + -- is the flight RTB? + f.rtb = false + f.in_zone = false + + if task == "cap" then + f.zone = param + f.zone_name = param.name + f.intercepting = false + f.vul_time = math.random(gcicap[side].cap.vul_time_min, + gcicap[side].cap.vul_time_max) + else -- task should be "gci" + f.target = param + f.target_group = param.group + f.intercepting = true + f.intercept_point = { x = 0, y = 0, z = 0 } + end + + -- get current timestamp + local timestamp = timer.getAbsTime() + f.units_moved = {} + -- set timestamp for each unit + -- this is later used for garbage collection checks + for u, unit in pairs(group:getUnits()) do + f.units_moved[u] = {} + f.units_moved[u].unit = unit + f.units_moved[u].last_moved = timestamp + f.units_moved[u].spawned_at = timestamp + end + + setmetatable(f, self) + self.__index = self + + table.insert(gcicap[side][task].flights, f) + gcicap.log:info("Registered flight: $1", f.group_name) + + return f + else + return nil + end + end + + --- Removes the flight + -- @tparam gcicap.Flight self flight object + function gcicap.Flight:remove() + if self.zone then + -- if we didn't already leave the zone do it now. + self:leaveCAPZone() + end + local f = getFlightIndex(self.group_name) + local r = table.remove(gcicap[f.side][f.task].flights, f.index) + if r then + gcicap.log:info("Removing flight $1 with index $2", r.group_name, f.index) + end + end + + --- Decreases active flights counter in this flights zone. + -- Actually just decreases the active flights + -- counter of a zone. Does NOT task the flight itself. + function gcicap.Flight:leaveCAPZone() + if self.in_zone then + local zone = self.zone + if zone.patrol_count <= 1 then + zone.patrol_count = 0 + else + zone.patrol_count = zone.patrol_count - 1 + end + self.in_zone = false + + -- get current time + local time_now = timer.getAbsTime() + -- get time on station by substracting vul start time from current time + -- and convert it to minutes + local time_on_station = 0 + if self.vul_start then + time_on_station = (time_now - self.vul_start) / 60 + end + local vul_diff = self.vul_time - time_on_station + -- set new vul time only if more than 5 minutes + if vul_diff > 5 then + self.vul_time = vul_diff + else + self.vul_time = 0 + end + end + end + + --- Increases active flights counter in this flights zone. + -- Actually just increases the active flights + -- counter of a zone. Does NOT task the flight itself. + function gcicap.Flight:enterCAPZone() + if not self.in_zone then + self.intercepting = false + self.in_zone = true + local zone = self.zone + zone.patrol_count = zone.patrol_count + 1 + end + end + + --- Tasks the flight to search and engage the target. + -- @tparam Unit intruder target unit. + -- @tparam[opt] boolean cold whether the flight should not destroy + -- the target and just follow it. Default false. + function gcicap.Flight:vectorToTarget(intruder, cold) + local target = nil + if intruder.group then + target = gcicap.getFirstActiveUnit(intruder.group) + end + if target == nil or intruder.group == nil then return end + + -- check if interceptor even still exists + if self.group:isExist() then + if target:isExist() and target:inAir() and self.give_up ~= true then + local target_pos = target:getPoint() + local ctl = self.group:getController() + + local gci_task = { + id = 'Mission', + params = { + route = { + points = { + [1] = { + alt = target_pos.y, + x = target_pos.x, + y = target_pos.z, + speed = gcicap.gci.speed, + action = "Turning Point", + type = "Turning Point", + task = { + id = "ComboTask", + params = { + tasks = { + [1] = { + number = 1, + key = "CAP", + id = "EngageTargets", + enabled = true, + auto = true, + params = { + targetTypes = { [1] = "Air" }, + priority = 0 + } + } + } + } + } + }, + [2] = { + alt = target_pos.y, + x = target_pos.x, + y = target_pos.z, + speed = gcicap.gci.speed, + action = "Turning Point", + type = "Turning Point", + task = { + -- i don't really like this WrappedAction but it's needed in + -- the case the CGI completes this waypoint because of lack/loss + -- of target + id = 'WrappedAction', + params = { + action = { + id = 'Script', + params = { + command = "local group = ...\ + local flight = gcicap.Flight.getFlight(group)\ + if flight then\ + flight.give_up = true\ + if flight.zone then\ + if flight.intercepting then\ + flight:taskWithCAP()\ + end\ + else\ + if not flight.target then\ + flight:taskWithRTB()\ + end\ + end\ + else\ + gcicap.log:error('Could not find flight')\ + end" + } + } + } + } + } + } + } + } + } + + -- checkout of the patrol zone + if self.zone and not self.intercepting then + self:leaveCAPZone() + end + + intruder.intercepted = true + -- only set/reset the task if the target has moved significantly since last GCI update + if mist.utils.get3DDist( target_pos, self.intercept_point ) > gcicap.revector_threshold then + -- if there's still an EWR detecting or we are responding to the initial call + -- then set the target position. do not allow revectoring if no EWR is detecting us now + if (Unit.isExist(intruder.detected_by) and intruder.detected_by:isActive()) then + self.give_up = false + self.intercept_point = mist.utils.deepCopy(target_pos) + ctl:setTask(gci_task) + gcicap.log:info("Vectoring $1 to $2 ($3)", self.group:getName(), + intruder.group:getName(), target:getName()) + + else + gcicap.log:info("Cannot revector $1 to $2 because no longer detecting",self.group:getName(),intruder.group:getName()) + end + end + self.intercepting = true + + -- taskEngageGroup provides omniscient knowledge of where the group to be attacked is, which sucks + if not cold then + --gcicap.taskEngageGroup(self.group, intruder.group) + gcicap.taskEngage(self.group, 15000) + end + + -- reschedule function until either the interceptor or the intruder is dead + mist.scheduleFunction(gcicap.Flight.vectorToTarget, {self, intruder, cold}, + timer.getTime() + gcicap.vector_interval) + + else -- the target is dead or we had to give up, resume CAP or RTB + if self.zone then + -- send CAP back to work only if still intercepting + if self.intercepting then + self:taskWithCAP() + end + else + self.intercepting = false + -- send GCI back to homeplate + self:taskWithRTB() + end + end + else + -- our interceptor group is dead let's see if the + -- intruder is still there and set him to not beeing intercepted anymore + if target:isExist() then + intruder.intercepted = false + end + end + end + + --- Tasks flight with combat air patrol. + -- Creates waypoints inside it's assigned zone and tasks + -- the flight with patroling along the route. + -- @tparam[opt] boolean cold If set to true the flight won't + -- engage any enemy unit's it detects by itself. Default false. + function gcicap.Flight:taskWithCAP(cold) + -- only task with CAP if ther is still vul time left + if self.vul_time == 0 then + -- send flight RTB if no vul time left. + gcicap.log:info("No vul time left for $1", self.group_name) + self:taskWithRTB() + else + local group = self.group + local ctl = group:getController() + local side = gcicap.coalitionToSide(group:getCoalition()) + local start_pos = gcicap.getFirstActiveUnit(group):getPoint() + local leg_dist = math.random(gcicap[side].cap.leg_min, gcicap[side].cap.leg_max) + local cap_route = gcicap.buildCAPRoute(start_pos, self.zone.name, self.vul_time, leg_dist) + local cap_task = { + id = 'Mission', + params = { + route = cap_route + } + } + + self.intercepting = false + self.intercept_point = { x = 0, y = 0, z = 0 } + ctl:setTask(cap_task) + self:enterCAPZone() + ctl:setOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_SEARCH_IF_REQUIRED) + + if not cold then + gcicap.taskEngage(group) + end + gcicap.log:info("Tasking $1 with CAP in zone $2", group:getName(), self.zone.name) + end + end + + --- Tasks the flight to return to it's homeplate. + -- @tparam[opt] Airbase airbase optionally use this as homeplate/airbase + -- to return to. + -- @tparam[opt] boolean cold If set to true the flight won't + -- engage any targets it detects on the way back to base. + -- Default false. + function gcicap.Flight:taskWithRTB(airbase, cold) + if not airbase then + airbase = self.airbase + end + + if self.zone then + self:leaveCAPZone() + local side = self.side + -- let's try to spawn a new CAP flight as soon as the current one is tasked with RTB. + -- never spawn more than 2 x the groups_count, to prevent spam in case something ever goes wrong. + if (not gcicap[side].limit_resources or + (gcicap[side].limit_resources and gcicap[side].supply > 0)) + and #gcicap[side].cap.flights < gcicap[side].cap.groups_count * 2 then + gcicap.spawnCAP(side, self.zone, gcicap[side].cap.spawn_mode) + end + end + self.rtb = true + local group = self.group + local ctl = group:getController() + local af_pos = mist.utils.makeVec2(airbase:getPoint()) + local af_id = airbase:getID() + local rtb_task = { + id = 'Mission', + params = { + route = { + points = { + [1] = { + alt = gcicap.cap.min_alt, + alt_type = "BARO", + speed = gcicap.cap.speed, + x = af_pos.x, + y = af_pos.y, + aerodromeId = af_id, + type = "Land", + action = "Landing", + } + } + } + } + } + + ctl:setTask(rtb_task) + + if not cold then + -- only engage if enemy is inside of 10km of the leg + gcicap.taskEngage(group, 10000) + end + + gcicap.log:info("Tasking $1 with RTB to $2", group:getName(), airbase:getName()) + end + + --- Functions + -- @section gcicap + + --- Clean up inactive/stuck flights. + local function garbageCollector(side) + local timestamp = timer.getAbsTime() + for t, task in pairs(gcicap.tasks) do + for f, flight in pairs(gcicap[side][task].flights) do + if flight.group then + if flight.group:isExist() then + for u = 1, #flight.units_moved do + local unit = flight.units_moved[u].unit + -- check if unit exists + if unit then + if unit:isExist() then + -- if unit is in air we won't do anything + if not unit:inAir() then + -- check if unit is moving + local mag = mist.vec.mag(unit:getVelocity()) + if mag == 0 then + -- get the last time the unit moved + local last_moved = flight.units_moved[u].last_moved + if timestamp - last_moved > gcicap.move_timeout then + gcicap.log:info("Cleaning up $1", flight.group:getName()) + flight.group:destroy() + flight:remove() + end + else + flight.units_moved[u].last_moved = timestamp + end + end + end + end + end + else + flight:remove() + end + else + flight:remove() + end + end + end + end + + local function checkForTemplateUnits(side) + if gcicap[side].gci.enabled then + for i = 1, gcicap.template_count do + local unit = gcicap.gci.template_prefix..side..i + if not Unit.getByName(unit) then + gcicap.log:alert("GCI template unit missing: $1", unit) + return false + end + end + end + if gcicap[side].cap.enabled then + for i = 1, gcicap.template_count do + local unit = gcicap.cap.template_prefix..side..i + if not Unit.getByName(unit) then + gcicap.log:alert("CAP template unit missing: $1", unit) + return false + end + end + end + if gcicap[side].borders_enabled then + if not Group.getByName(gcicap[side].border_group) then + gcicap.log:alert("Border group is missing: $1", gcicap[side].border_group) + return false + end + end + return true + end + + local function checkForTriggerZones(side) + for i = 1, gcicap[side].cap.zones_count do + local zone_name = gcicap[side].cap.zone_name..i + if not trigger.misc.getZone(zone_name) then + gcicap.log:alert("CAP trigger zone is missing: $1", zone_name) + return false + end + end + return true + end + + local function manageCAP(side) + local patroled_zones = 0 + + for i = 1, #gcicap[side].cap.zones do + local zone = gcicap[side].cap.zones[i] + gcicap.log:info("Zone $1 has $2 patrols", zone.name, zone.patrol_count) + + -- see if we can send a new CAP into the zone + if zone.patrol_count <= 0 then + -- first check if we already hit the maximum amounts of routine CAP groups + if #gcicap[side].cap.flights < gcicap[side].cap.groups_count then + -- check if we limit resources and if we have enough supplies + -- if we don't limit resource or have enough supplies we spawn + if not gcicap[side].limit_resources or + (gcicap[side].limit_resources and gcicap[side].supply > 0) then + -- finally spawn it + gcicap.spawnCAP(side, gcicap[side].cap.zones[i], gcicap[side].cap.spawn_mode) + end + end + else + patroled_zones = patroled_zones + 1 + end + end + -- if all zones are patroled and we still have cap groups left + -- send them to a random zone + if #gcicap[side].cap.flights < gcicap[side].cap.groups_count then + if not gcicap[side].limit_resources or + (gcicap[side].limit_resources and gcicap[side].supply > 0) then + local random_zone = math.random(1, #gcicap[side].cap.zones) + gcicap.spawnCAP(side, gcicap[side].cap.zones[random_zone], gcicap[side].cap.spawn_mode) + end + end + gcicap.log:info("$1 patrols in $2/$3 zones with $4 flights", + side, patroled_zones, gcicap[side].cap.zones_count, #gcicap[side].cap.flights) + end + + local function handleIntrusion(side) + for i = 1, #gcicap[side].intruders do + local intruder = gcicap[side].intruders[i] + if intruder.group then + if intruder.group:isExist() then + -- check if we need to do something about him + if not intruder.intercepted then + -- first check if we have something to work with + if #gcicap[side].cap.flights > 0 + or #gcicap[side].gci.flights > 0 + or #gcicap[side].gci.flights < gcicap[side].gci.groups_count then + -- get closest flight to intruder if there is any + local closest = nil + local intruder_unit = gcicap.getFirstActiveUnit(intruder.group) + local closest_flights = gcicap.getClosestFlightsToUnit(side, intruder_unit) + -- we found close flights + local flight_avail = false + if closest_flights then + for j = 1, #closest_flights do + closest = closest_flights[j] + --fligh_avail = (not closest.flight.rtb) and (not closest.flight.intercepting) + flight_avail = (not closest.flight.intercepting) + if flight_avail then + gcicap.log:info("Found flight $1 which is avaliable for tasking.", + closest.flight.group:getName()) + break + end + end + end + if flight_avail then + -- check if we have a airfield which is closer to the unit than the closest flight + -- but add some distance to the airfield since it takes time for a potential spawned + -- flight to take-off + local closest_af, af_distance = gcicap.getClosestAirfieldToUnit(side, intruder_unit) + af_distance = af_distance + 15000 -- add 15km + if closest.distance < af_distance or af_distance == -1 then + -- task flight with intercept + closest.flight.give_up = false + closest.flight:vectorToTarget(intruder) + return + end + if (not gcicap[side].limit_resources + or (gcicap[side].limit_resources and gcicap[side].supply > 0)) + and #gcicap[side].gci.flights < gcicap[side].gci.groups_count + and gcicap[side].gci.enabled then + -- spawn CGI + gcicap.log:info("Airfield closer to intruder than flight or no flight available. Spawning GCI") + local gci = gcicap.spawnGCI(side, intruder) + end + else + if (not gcicap[side].limit_resources + or (gcicap[side].limit_resources and gcicap[side].supply > 0)) + and #gcicap[side].gci.flights < gcicap[side].gci.groups_count + and gcicap[side].gci.enabled then + -- spawn CGI + gcicap.log:info("No CAP flights or already airborne GCI. Spawning GCI") + local gci = gcicap.spawnGCI(side, intruder) + end + end + end + end + end + else + -- the intruder group doesn't exist (anymore) remove it + table.remove(gcicap[side].intruders, i) + end + end + end + + -- returns airfields of given side which are marked with + -- triggerzones (triggerzone name is exactly the same as airfield name). + local function getAirfields(side) + local coal_airfields = coalition.getAirbases(gcicap.sideToCoalition(side)) + local gcicap_airfields = {} + + -- loop over all coalition airfields + for i = 1, #coal_airfields do + -- get name of airfield + local af_name = coal_airfields[i]:getName() + if not string.match(af_name, "FARP") then + -- check if a triggerzone exists with that exact name + if mist.DBs.zonesByName[af_name] then + -- add it to our airfield list for gcicap + gcicap_airfields[#gcicap_airfields + 1] = coal_airfields[i] + end + end + end + + if #gcicap_airfields == 0 then + gcicap.log:warn("No airbase for $1 found", side) + end + return gcicap_airfields + end + + -- returns all currently active aircraft of the given side + -- parameter side has to be "red" or "blue" + local function getAllActiveAircrafts(side) + local filter = { "[" .. side .. "][plane]", "[" .. side .. "][helicopter]"} + local all_aircraft = mist.makeUnitTable(filter) + local active_aircraft = {} + + for i = 1, #all_aircraft do + local ac = Unit.getByName(all_aircraft[i]) + if ac ~= nil then + if Unit.isActive(ac) then + table.insert(active_aircraft, ac) + end + end + end + if #active_aircraft == 0 then + gcicap.log:warn("No active aircraft for $1 found", side) + end + return active_aircraft + end + + -- returns all currently active EWR and AWACS units of the given side + -- parameter side has to be "red" or "blue" + local function getAllActiveEWR(side) + local filter = { "[" .. side .. "][plane]", "[" .. side .. "][vehicle]", "[" .. side .. "][ship]"} + local all_vecs = mist.makeUnitTable(filter) + local active_ewr = {} + + for i = 1, #all_vecs do + local vec = Unit.getByName(all_vecs[i]) + if vec ~= nil then + if Unit.isActive(vec) then + local vec_type = Unit.getTypeName(vec) + if vec_type == "55G6 EWR" + or vec_type == "1L13 EWR" + or vec_type == "Hawk sr" + or vec_type == "Patriot str" then + table.insert(active_ewr, { unit = vec, is_awacs = false} ) + end + -- ED has a bug; the E-2D vehicle has type E-2C + if (vec_type == "A-50" and gcicap[side].awacs) + or (vec_type == "E-2C" and gcicap[side].awacs) + or (vec_type == "E-3A" and gcicap[side].awacs) then + table.insert(active_ewr, { unit = vec, is_awacs = true} ) + end + end + end + end + if #active_ewr == 0 then + gcicap.log:warn("No active EWR for $1 found", side) + end + return active_ewr + end + + local function checkForAirspaceIntrusion(side) + -- init some local vars + local border = gcicap[side].border + local active_ewr = gcicap[side].active_ewr + local intruder_count = 0 + local intruder_side = "" + local toremove = {} + if side == "red" then + -- set the side of the intruder + intruder_side = "blue" + elseif side == "blue" then + intruder_side = "red" + end + local active_ac = gcicap[intruder_side].active_aircraft + + -- only do something if we have active ewr and active aircraft + if #active_ac > 0 and #active_ewr > 0 then + -- loop over all aircraft + for i = 1, #active_ac do + local ac = active_ac[i] + local ac_detected = false + local ac_intruded = false + local ac_pos = {} + local ac_group = nil + local intruder_num = 0 + local ewr = nil + if ac ~= nil then + ac_group = ac:getGroup() + if ac_group:isExist() then + ac_pos = ac:getPoint() + + -- now loop over all ewr units + for n = 1, #active_ewr do + local ewr_controller = nil + if active_ewr[n].is_awacs then + ewr_controller = active_ewr[n].unit:getController() + else + ewr_controller = active_ewr[n].unit:getGroup():getController() + end + -- and check if the EWR detected the aircraft + if ewr_controller:isTargetDetected(ac, RADAR) then + ewr = active_ewr[n].unit + ac_detected = true + -- stop once it was detected by one EWR + break + end + end + + if ac_detected then + -- do we check borders? + if gcicap[side].borders_enabled then + ac_intruded = mist.pointInPolygon(ac_pos, border) + else + -- if not the aircarft is always intruding + ac_intruded = true + end + + if ac_intruded then + local in_list = false + -- check if we already know about the intruder + for j = 1, #gcicap[side].intruders do + if gcicap[side].intruders[j].name == ac_group:getName() then + in_list = true + intruder_num = j + break + end + end + if not in_list then + intruder_count = intruder_count + 1 + + gcicap.log:info("$1 ($2) intruded airspace of $3 detected by $4 ($5)", + ac_group:getName(), ac:getName(), side, + ewr:getGroup():getName(), ewr:getName()) + + intruder = { + name = ac_group:getName(), + --unit = ac, + group = ac_group, + detected_by = ewr, + --groupID = ac_group:getID(), + --unitID = ac:getID(), + --unitType = ac:getTypeName(), + size = ac_group:getSize(), + intercepted = false, + } + table.insert(gcicap[side].intruders, intruder) + intruder_num = #gcicap[side].intruders + end + + -- send message to all units of coalition or some specified groups + -- that we have a intruder + if gcicap[side].gci.messages then + local par = { + units = { ac:getName() }, + ref = gcicap[side].bullseye, + alt = ac_pos.y, + } + -- do we want to display in metric units? + if gcicap[side].gci.messages_metric then + par.metric = true + end + + local msg_for = {} + -- if groups are specified find their units names and add them to the list + if #gcicap[side].gci.messages_to > 0 then + msg_for.units = {} + for g, group_name in pairs(gcicap[side].gci.messages_to) do + group = Group.getByName(group_name) + if group ~= nil then + for u, unit in pairs(group:getUnits()) do + table.insert(msg_for.units, unit:getName()) + end + end + end + else + msg_for.coa = { side } + end + -- get the bearing, range and altitude from bullseye to intruder + local bra = mist.getBRString(par) + local bra_string = "Airpsace intrusion! BRA from bullseye "..bra + local msg = { + text = bra_string, + displayTime = gcicap.gci.message_time, + msgFor = msg_for, + name = "gcicap.gci.msg"..intruder_num, + } + -- finally send the message + mist.message.add(msg) + end + end -- if ac_intruded + else + -- the ac is _not_ intruding so we should remove it from the intruders list + + local in_list = false + local intruder_num = 0 + -- check if we already know about the intruder + for j = 1, #gcicap[side].intruders do + if gcicap[side].intruders[j].name == ac_group:getName() then + in_list = true + intruder_num = j + break + end + end + if in_list then toremove[#toremove + 1] = intruder_num end + end -- if ac_detected + end -- if ac_group is existing + end -- if ac ~= nil + end -- for #active_ac + end -- if active_ac > 0 and active_ewr > 0 + + -- we need to remove intruders from outside the loop + if #toremove > 0 then + for i = 1,#toremove do + intruder_count = intruder_count - 1 + gcicap.log:info("Aircraft "..gcicap[side].intruders[i].name.." no longer intruding") + table.remove(gcicap[side].intruders,i) + end + end + if intruder_count > 0 then + return true + else + return false + end + --return gcicap[side].intruders + end + + -- returns a random airfield for the given side + local function getRandomAirfield(side) + local rand = math.random(1, #gcicap[side].airfields) + return gcicap[side].airfields[rand] + end + + local function buildFirstWp(airbase, spawn_mode) + local airbase_pos = airbase:getPoint() + local airbase_id = airbase:getID() + local wp = mist.fixedWing.buildWP(airbase_pos) + + if spawn_mode == "parking" then -- start from parking area + wp.airdromeId = airbase_id + wp.type = "TakeOffParking" + wp.action = "From Parking Area" + elseif spawn_mode == "takeoff" then -- or start from runway + wp.airdromeId = airbase_id + wp.type = "TakeOff" + wp.action = "From Runway" + elseif spawn_mode == "air" then + -- randomize spawn position a little bit in case of air start + wp.x = wp.x + (50 * math.sin(math.random(10))) + wp.y = wp.y + (50 * math.sin(math.random(10))) + end + + return wp + end + + --- Converts coaltion number to side string. + -- 0 = "neutral", 1 = "red", 2 = "blue" + -- @tparam number coal coaltion number. + -- @treturn string side + function gcicap.coalitionToSide(coal) + if coal == coalition.side.NEUTRAL then return "neutral" + elseif coal == coalition.side.RED then return "red" + elseif coal == coalition.side.BLUE then return "blue" + end + end + + --- Converts side string to coaltion number. + -- 0 = "neutral", 1 = "red", 2 = "blue" + -- @tparam string side side string. + -- @treturn number coalition number. + -- @see coalitionToSide + function gcicap.sideToCoalition(side) + if side == "neutral" then return coalition.side.NEUTRAL + elseif side == "red" then return coalition.side.RED + elseif side == "blue" then return coalition.side.BLUE + end + end + + --- Returns first active unit of a group. + -- @tparam Group group group whose first active + -- unit to return. + -- @treturn Unit first active unit of group. + function gcicap.getFirstActiveUnit(group) + if group ~= nil then + -- engrish mast0r isExistsingsed + if not group:isExist() then return nil end + local units = group:getUnits() + for i = 1, group:getSize() do + if units[i] then + return units[i] + end + end + return nil + else + return nil + end + end + + --- Returns the closest airfield to unit. + -- Returned airfield is controlled by given side. This function + -- also returns the distance to the unit. + -- @tparam string side side string, either "red" or "blue". + -- The airfield returned has to be controlled by this side. + -- @tparam Unit unit unit to use as reference. + -- @treturn table @{closestAirfieldReturn} + function gcicap.getClosestAirfieldToUnit(side, unit) + if not unit then + gcicap.log:error("Couldn't find unit.") + return + end + local airfields = gcicap[side].airfields + + if #airfields == 0 then + gcicap.log:warn("There are no airfields of side $1", side) + return nil + end + + local unit_pos = mist.utils.makeVec2(unit:getPoint()) + local min_distance = -1 + local closest_af = nil + + for i = 1, #airfields do + local af = airfields[i] + local af_pos = mist.utils.makeVec2(af:getPoint()) + local distance = mist.utils.get2DDist(unit_pos, af_pos) + + if distance < min_distance or min_distance == -1 then + min_distance = distance + closest_af = af + end + end + + --- Table returned by getClosestAirfieldToUnit. + -- @table closestAirfieldReturn + -- @tfield Airbase airfield the Airbase object + -- @tfield number distance the distance in meters + -- to the unit. + --return {airfield = closest_af, distance = min_distance} + return closest_af, min_distance + end + + --- Returns the closest flights to the given unit. + -- Flights returned are of given side. This function also returns + -- their distance to the unit. The returned flights are sorted + -- by distance. First is the closest. + -- @tparam string side side whose flights to search. + -- @tparam Unit unit unit object used as reference. + -- @treturn table Array sorted by distance + -- containing @{closestFlightsReturn} tables. + function gcicap.getClosestFlightsToUnit(side, unit) + if not unit then + gcicap.log:error("Couldn't find unit.") + return + end + local closest_flights = {} + if #gcicap[side].cap.flights == 0 and #gcicap[side].gci.flights == 0 then + gcicap.log:info("No CAP or GCI flights of side $1 active", side) + return nil + else + local unit_pos = mist.utils.makeVec2(unit:getPoint()) + local min_distance = -1 + for t, task in pairs(gcicap.tasks) do + local flights = gcicap[side][task].flights + for i = 1, #flights do + if flights[i].group then + local u = gcicap.getFirstActiveUnit(flights[i].group) + if u then + local u_pos = mist.utils.makeVec2(u:getPoint()) + local distance = mist.utils.get2DDist(unit_pos, u_pos) + table.insert(closest_flights, {flight = flights[i], distance = distance }) + else + break + end + end + end + end + + -- sort closest flights + table.sort(closest_flights, function(a,b) + if a.distance < b.distance then + return true + else + return false + end + end) + + --- Table returned by getClosestFlightsToUnit. + -- @table closestFlightsReturn + -- @tfield gcicap.Flight flight object + -- @tfield number distance distance in meters from + -- the unit. + return closest_flights + end + end + + --- Returns a table containting a CAP route. + -- Route originating from given airbase, waypoints + -- are placed randomly inside given zone. Optionally + -- you can specify the amount of waypoints inside the zone. + -- @tparam string zone trigger zone name + -- @tparam number vul_time time on station + -- @tparam number leg_distance leg distance for race-track pattern orbit. + function gcicap.buildCAPRoute(start_pos, zone, vul_time, leg_distance) + local points = {} + -- make altitude consistent for the whole route. + local alt = math.random(gcicap.cap.min_alt, gcicap.cap.max_alt) + + local start_vul_script = "local group = ...\ + local flight = gcicap.Flight.getFlight(group)\ + if flight then\ + gcicap.log:info('$1 starting vul time $2 at $3',\ + flight.group_name, flight.vul_time, flight.zone.name)\ + flight.vul_start = timer.getAbsTime()\ + else\ + gcicap.log:error('Could not find flight')\ + end" + + local end_vul_script = "local group = ...\ + local flight = gcicap.Flight.getFlight(group)\ + if flight then\ + gcicap.log:info('$1 vul time over at $2',\ + flight.group_name, flight.zone.name)\ + flight:taskWithRTB()\ + else\ + gcicap.log:error('Could not find flight')\ + end" + + -- build orbit start waypoint + local orbit_start_point = mist.getRandomPointInZone(zone) + -- add a bogus waypoint so the start vul time script block + -- isn't executed instantly after tasking + points[1] = mist.fixedWing.buildWP(start_pos) + points[2] = mist.fixedWing.buildWP(orbit_start_point) + points[2].task = {} + points[2].task.id = 'ComboTask' + points[2].task.params = {} + points[2].task.params.tasks = {} + points[2].task.params.tasks[1] = { + number = 1, + auto = false, + id = 'WrappedAction', + enabled = true, + params = { + action = { + id = 'Script', + params = { + command = start_vul_script + } + } + } + } + points[2].task.params.tasks[2] = { + number = 2, + auto = false, + id = 'ControlledTask', + enabled = true, + params = { + task = { + id = 'Orbit', + params = { + altitude = alt, + pattern = 'Race-Track', + speed = gcicap.cap.speed + } + }, + stopCondition = { + duration = vul_time * 60 + } + } + } + + -- if we don't use the race-track pattern we'll add the vul end time + -- waypoint right where the start waypoint is and use the 'Circle' pattern. + local orbit_end_point + if not gcicap.cap.race_track_orbit then + points[2].task.params.tasks[2].params.task.params.pattern = 'Circle' + orbit_end_point = start_pos + else + -- build second waypoint (leg end waypoint) + --local orbit_end_point = mist.getRandPointInCircle(orbit_start_point, leg_distance, leg_distance) + orbit_end_point = mist.getRandomPointInZone(zone) + end + + points[3] = mist.fixedWing.buildWP(orbit_end_point) + points[3].task = { + id = 'WrappedAction', + params = { + action = { + id = 'Script', + params = { + command = end_vul_script + } + } + } + } + + for i = 1, 3 do + points[i].speed = gcicap.cap.speed + points[i].alt = alt + end + + -- local ground_level = land.getHeight(point) + -- -- avoid crashing into hills + -- if (alt - 100) < ground_level then + -- alt = alt + ground_level + -- end + + gcicap.log:info("Built CAP route with $1 min vul time at $2 meters in $3", vul_time, alt, zone) + + local route = {} + route.points = points + return route + end + + --- Tasks group to automatically engage any spotted targets. + -- @tparam Group group group to task. + -- @tparam[opt] number max_dist maximum engagment distance. + -- Targets further out (from the route) won't be engaged. + function gcicap.taskEngage(group, max_dist) + if not max_dist then + max_dist = gcicap.cap.max_engage_distance + end + local ctl = group:getController() + local engage = { + id = 'EngageTargets', + params = { + maxDist = max_dist, + maxDistEnabled = true, + targetTypes = { [1] = "Air" }, + priority = 0 + } + } + ctl:pushTask(engage) + end + + --- Tasks group to engage a group. + -- @tparam Group group group to task. + -- @tparam Group target group that should be engaged by + -- given group. + function gcicap.taskEngageGroup(group, target) + local ctl = group:getController() + local engage_group = { + id = 'EngageGroup', + params = { + groupId = target:getID(), + directionEnabled = false, + priority = 0, + altittudeEnabled = false, + } + } + ctl:pushTask(engage_group) + end + + --- Spawns a fighter group. + -- @tparam string side side of the newly created group. + -- Can be "red" or "blue". + -- @tparam string name new group name. + -- @tparam number size count of aircraft in the new group. + -- @tparam Airbase airbase home plate of the new group. + -- @tparam string spawn_mode How the new group will be spawned. + -- Can be 'parking' or 'air'. 'parking' will spawn them at the ramp + -- wit engines turned off. 'air' will spawn them in the air already + -- flying. + -- @tparam string task Task of the new group. Can either be 'cap', + -- for combat air patrol, or 'gci', for ground controlled intercept. + -- @tparam[opt] string zone zone name in which to spawn the unit. This only is + -- taken into account if spawn_mode is "in-zone". + -- @tparam[opt] boolean cold if set to true the newly group won't engage + -- any enemys until tasked otherwise. Default false. + -- @treturn Group|nil newly spawned group or nil on failure. + function gcicap.spawnFighterGroup(side, name, size, airbase, spawn_mode, task, zone, cold) + local template_unit_name = gcicap[task].template_prefix..side..math.random(1, gcicap.template_count) + local template_unit = Unit.getByName(template_unit_name) + if not template_unit then + gcicap.log:error("Can't find template unit $1. This should never happen.\ + Somehow the template unit got deleted.", template_unit_name) + return nil + end + local template_group = mist.getGroupData(template_unit:getGroup():getName()) + local template_unit_data = template_group.units[1] + local airbase_pos = airbase:getPoint() + local group_data = {} + local unit_data = {} + local onboard_num = template_unit_data.onboard_num - 1 + local route = {} + + local rand_point = {} + if spawn_mode == "in-zone" then + rand_point = mist.getRandomPointInZone(zone) + end + + for i = 1, size do + unit_data[i] = {} + unit_data[i].type = template_unit_data.type + unit_data[i].name = name.." Pilot "..i + if spawn_mode == "in-zone" then + unit_data[i].x = rand_point.x + (50 * math.sin(math.random(10))) + unit_data[i].y = rand_point.y + (50 * math.sin(math.random(10))) + else + unit_data[i].x = airbase_pos.x + (50 * math.sin(math.random(10))) + unit_data[i].y = airbase_pos.z + (50 * math.sin(math.random(10))) + end + unit_data[i].alt = gcicap[side].cap.min_alt + unit_data[i].onboard_num = onboard_num + i + unit_data[i].groupName = name + unit_data[i].payload = template_unit_data.payload + unit_data[i].skill = template_unit_data.skill + unit_data[i].livery_id = template_unit_data.livery_id + if side == 'blue' then + unit_data[i].callsign = {} + unit_data[i].callsign[1] = 4 -- Colt + unit_data[i].callsign[2] = gcicap[side].cap.flight_num + unit_data[i].callsign[3] = i + else + unit_data[i].callsign = 600 + gcicap[side].cap.flight_num + i + end + end + + group_data.units = unit_data + group_data.groupName = name + group_data.hidden = gcicap[side].hide_groups + --group_data.country = template_group.country + group_data.country = template_unit:getCountry() + group_data.category = template_group.category + group_data.task = "CAP" + + route.points = {} + if spawn_mode == "in-zone" then + route.points[1] = mist.fixedWing.buildWP(rand_point) + route.points[1].alt = gcicap[side].cap.min_alt + route.points[1].speed = gcicap[side].cap.speed + else + route.points[1] = buildFirstWp(airbase, spawn_mode) + end + group_data.route = route + + if mist.groupTableCheck(group_data) then + local spawn_pos = airbase:getName() + if spawn_mode == "in-zone" then + spawn_pos = zone + end + gcicap.log:info("Spawning fighter group $1 at $2", name, spawn_pos) + mist.dynAdd(group_data) + else + gcicap.log:error("Couldn't spawn group with following groupTable: $1", group_data) + end + + return Group.getByName(name) + end + + --- Spawns a CAP flight. + -- @tparam string side side for the new CAP. + -- @tparam string zone CAP zone (trigger zone) name. + -- @tparam string spawn_mode how the new CAP will be spawned. + -- Can be 'parking' or 'air'. + function gcicap.spawnCAP(side, zone, spawn_mode) + -- increase flight number + gcicap[side].cap.flight_num = gcicap[side].cap.flight_num + 1 + -- select random airbase (for now) TODO: choose closest airfield + local airbase = getRandomAirfield(side) + local group_name = "CAP "..side.." "..gcicap[side].cap.flight_num + -- define size of the flight + local size = gcicap[side].cap.group_size + if size == "randomized" then + size = math.random(1,2)*2 + else + size = tonumber(size) + end + -- actually spawn something + local group = gcicap.spawnFighterGroup(side, group_name, size, airbase, spawn_mode, "cap", zone.name) + --local ctl = group:getController() + --ctl:setOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_ATTACK_ONLY) + gcicap[side].supply = gcicap[side].supply - 1 + -- keep track of the flight + local flight = gcicap.Flight:new(group, airbase, "cap", zone) + -- task the group, for some odd reason we have to wait until we use setTask + -- on a freshly spawned group. + mist.scheduleFunction(gcicap.Flight.taskWithCAP, {flight}, timer.getTime() + 5) + return group + end + + --- Spawns a GCI flight. + -- @tparam string side side for the new GCI. + -- @tparam Unit intruder unit to intercept. + -- @tparam Airbase airbase airbase at which to spawn the GCI flight. + function gcicap.spawnGCI(side, intruder, airbase) + -- increase flight number + gcicap[side].gci.flight_num = gcicap[side].gci.flight_num + 1 + -- select closest airfield to unit + local intruder_unit = gcicap.getFirstActiveUnit(intruder.group) + local closest_af = gcicap.getClosestAirfieldToUnit(side, intruder_unit) + if closest_af then + airbase = closest_af + else + gcicap.log:warn("Couldn't find close airfield for GCI. Choosing one at random.") + airbase = getRandomAirfield(side) + end + local tgt_units = intruder.group:getUnits() + local group_name = "GCI "..side.." "..gcicap[side].gci.flight_num + -- define size of the flight + local size = gcicap[side].gci.group_size + if size == "randomized" then + size = math.random(1,2)*2 + elseif size == "dynamic" then + size = #tgt_units + else + size = tonumber(size) + end + -- actually spawn something + local group = gcicap.spawnFighterGroup(side, group_name, size, airbase, gcicap[side].gci.spawn_mode, "gci") + local ctl = group:getController() + -- make the GCI units only use their radar for attacking + ctl:setOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_ATTACK_ONLY) + gcicap[side].supply = gcicap[side].supply - 1 + -- keep track of the flight + local flight = gcicap.Flight:new(group, airbase, "gci", intruder) + -- vector the interceptor group on the target the first time. + mist.scheduleFunction(gcicap.Flight.vectorToTarget, {flight, intruder}, timer.getTime() + 5) + return group + end + + --- Initialization function + -- Checks if all template units are present. Creates + -- border polygons if borders enabled. + -- @todo complete documentation. + function gcicap.init() + for i, side in pairs(gcicap.sides) do + if not (checkForTemplateUnits(side) and checkForTriggerZones(side)) then + return false + end + if gcicap[side].borders_enabled then + gcicap[side].border = mist.getGroupPoints(gcicap[side].border_group) + end + gcicap[side].intruders = {} + gcicap[side].cap.zones = {} + gcicap[side].cap.flights = {} + gcicap[side].gci.flights = {} + gcicap[side].cap.flight_num = 0 + gcicap[side].gci.flight_num = 0 + gcicap[side].airfields = getAirfields(side) + + if gcicap[side].cap.enabled then + -- loop through all zones + for i = 1, gcicap[side].cap.zones_count do + local zone_name = gcicap[side].cap.zone_name..i + local point = trigger.misc.getZone(zone_name).point + local size = trigger.misc.getZone(zone_name).radius + + -- create zone table + gcicap[side].cap.zones[i] = { + name = zone_name, + pos = point, + radius = size, + patrol_count = 0, + } + end + + for i = 1, gcicap[side].cap.groups_count do + local spawn_mode = "parking" + if gcicap[side].cap.start_airborne then + spawn_mode = "in-zone" + end + -- try to fill all zones + local zone = gcicap[side].cap.zones[i] + -- if we have more flights than zones we select one random zone + if zone == nil then + zone = gcicap[side].cap.zones[math.random(1, gcicap[side].cap.zones_count)] + end + -- actually spawn the group + --local grp = gcicap.spawnCAP(side, zone, spawn_mode) + -- delay the spawn by gcicap interval seconds after one another + local spawn_delay = (i - 1) * gcicap.initial_spawn_delay + mist.scheduleFunction(gcicap.spawnCAP, {side, zone, spawn_mode}, timer.getTime() + spawn_delay) + end + end + end + -- add event handler managing despawns + return true + end + + --- Main function. + -- Run approx. every @{gcicap.interval} sconds. A random amount + -- of 0 to 2 seconds is added for declustering. + -- @todo do the "declustering" at a different level. Probably + -- more efficient. + function gcicap.main() + for i, side in pairs(gcicap.sides) do + -- update list of occupied airfields + gcicap[side].airfields = getAirfields(side) + -- update list of all aircraft + gcicap[side].active_aircraft = getAllActiveAircrafts(side) + -- update list of all EWR + gcicap[side].active_ewr = getAllActiveEWR(side) + end + + -- check for airspace intrusions after updating all the lists + for i, side in pairs(gcicap.sides) do + if gcicap[side].cap.enabled then + manageCAP(side) + end + checkForAirspaceIntrusion(side) + handleIntrusion(side) + garbageCollector(side) + end + end + +end + +if gcicap.init() then + local start_delay = gcicap.initial_spawn_delay * math.max(gcicap.red.cap.groups_count, gcicap.blue.cap.groups_count) + mist.scheduleFunction(gcicap.main, {}, timer.getTime() + start_delay, gcicap.interval) +end + +-- vim: sw=2:ts=2 diff --git a/AI/AI_A2A_Dispatcher/AID-A2A-220 - GCICAP Demonstration/AID-220 - NORMANDY AI_A2A_GCICAP Demonstration.lua b/AI/AI_A2A_Dispatcher/AID-A2A-220 - GCICAP Demonstration/AID-220 - NORMANDY AI_A2A_GCICAP Demonstration.lua index b394c5a047..7b0f9433d3 100644 --- a/AI/AI_A2A_Dispatcher/AID-A2A-220 - GCICAP Demonstration/AID-220 - NORMANDY AI_A2A_GCICAP Demonstration.lua +++ b/AI/AI_A2A_Dispatcher/AID-A2A-220 - GCICAP Demonstration/AID-220 - NORMANDY AI_A2A_GCICAP Demonstration.lua @@ -1,27 +1,27 @@ - - --- RED - ---- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. --- EWR network groups start with RED EWR, which are ships and patrols. --- Squadron templates which are placed above the colored airbases, start with TR SQ. --- Perform CAP, the zone for CAP starts with TR CAP, send minimal 10 groups of planes in the air. -A2A_GCICAP_Red = AI_A2A_GCICAP:New( { "TR SQ"}, { "TR SQ" }, { "TR CAP" }, 10 ) - -A2A_GCICAP_Red:SetBorderZone( ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) ) - --- Enable the tactical display panel. This is to see what this dispatcher is doing. ---A2A_GCICAP_Red:SetTacticalDisplay( true ) - --- BLUE - ---- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. --- EWR network groups start with BLUE EWR. --- Squadron templates which are placed above the colored airbases, start with UK SQ. --- Perform no CAP. -A2A_GCICAP_Blue = AI_A2A_GCICAP:New( { "BLUE EWR" }, { "UK SQ" }, { }, 2 ) - -A2A_GCICAP_Blue:SetBorderZone( ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) ) - - - + + +-- RED + +--- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. +-- EWR network groups start with RED EWR, which are ships and patrols. +-- Squadron templates which are placed above the colored airbases, start with TR SQ. +-- Perform CAP, the zone for CAP starts with TR CAP, send minimal 10 groups of planes in the air. +A2A_GCICAP_Red = AI_A2A_GCICAP:New( { "TR SQ"}, { "TR SQ" }, { "TR CAP" }, 10 ) + +A2A_GCICAP_Red:SetBorderZone( ZONE_POLYGON:New( "Red Border", GROUP:FindByName( "Red Border" ) ) ) + +-- Enable the tactical display panel. This is to see what this dispatcher is doing. +--A2A_GCICAP_Red:SetTacticalDisplay( true ) + +-- BLUE + +--- Setup the Red Coalition A2A GCICAP dispatcher, and initialize it. +-- EWR network groups start with BLUE EWR. +-- Squadron templates which are placed above the colored airbases, start with UK SQ. +-- Perform no CAP. +A2A_GCICAP_Blue = AI_A2A_GCICAP:New( { "BLUE EWR" }, { "UK SQ" }, { }, 2 ) + +A2A_GCICAP_Blue:SetBorderZone( ZONE_POLYGON:New( "Blue Border", GROUP:FindByName( "Blue Border" ) ) ) + + + diff --git a/AI/AI_A2A_Dispatcher_API_v2/AID-A2A-700 - Sound Check English/AID-A2A-700 - Sound Check English.lua b/AI/AI_A2A_Dispatcher_API_v2/AID-A2A-700 - Sound Check English/AID-A2A-700 - Sound Check English.lua index c44125af91..9de0b437d3 100644 --- a/AI/AI_A2A_Dispatcher_API_v2/AID-A2A-700 - Sound Check English/AID-A2A-700 - Sound Check English.lua +++ b/AI/AI_A2A_Dispatcher_API_v2/AID-A2A-700 - Sound Check English/AID-A2A-700 - Sound Check English.lua @@ -1,142 +1,142 @@ ---- --- Name: AID-A2A-100 - Demonstration --- Author: FlightControl --- Date Created: 30 May 2017 - -local HQ_Group = GROUP:FindByName( "HQ" ) -local HQ_CC = COMMANDCENTER:New( HQ_Group, "HQ" ) - --- Define a SET_GROUP object that builds a collection of groups that define the EWR network. --- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. -local DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) -DetectionSetGroup:FilterStart() - -local Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) - --- Setup the A2A dispatcher, and initialize it. -A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) -A2ADispatcher:SetCommandCenter( HQ_CC ) - --- Enable the tactical display panel. -A2ADispatcher:SetTacticalDisplay( false ) -A2ADispatcher:SetTacticalMenu( "Dispatchers", "A2A" ) - --- Initialize the dispatcher, setting up a border zone. This is a polygon, --- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. --- Any enemy crossing this border will be engaged. -CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) -A2ADispatcher:SetBorderZone( CCCPBorderZone ) - --- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly --- without an assignment within 100km radius from a detected target, will engage that target. -A2ADispatcher:SetEngageRadius( 120000 ) - --- Setup the squadrons. -A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD" }, 16 ) -A2ADispatcher:SetSquadron( "Maykop", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP MIG-31" }, 20 ) -A2ADispatcher:SetSquadron( "Mozdok", AIRBASE.Caucasus.Mozdok, { "SQ CCCP MIG-31" }, 16 ) -A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD", "SQ CCCP SU-34", "SQ CCCP MIG-31", "SQ CCCP MIG-29S" }, 40 ) -A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 16 ) - --- Setup the overhead -A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) -A2ADispatcher:SetSquadronOverhead( "Maykop", 1 ) -A2ADispatcher:SetSquadronOverhead( "Mozdok", 1 ) -A2ADispatcher:SetSquadronOverhead( "Sochi", 2 ) -A2ADispatcher:SetSquadronOverhead( "Novo", 1.5 ) - --- Setup the Grouping -A2ADispatcher:SetSquadronGrouping( "Mineralnye", 4 ) -A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) -A2ADispatcher:SetSquadronGrouping( "Novo", 3 ) - --- Setup the Takeoff methods -A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Sochi" ) -A2ADispatcher:SetSquadronTakeoffFromRunway( "Mozdok" ) -A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Maykop" ) -A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) - --- Setup the Landing methods -A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) -A2ADispatcher:SetSquadronLandingNearAirbase( "Sochi" ) -A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mozdok" ) -A2ADispatcher:SetSquadronLandingNearAirbase( "Maykop" ) -A2ADispatcher:SetSquadronLanding( "Novo", AI_A2A_DISPATCHER.Landing.AtRunway ) - - --- CAP Squadron execution. ---CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) ---A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) ---A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 6, 30, 60, 1 ) - ---CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) ---A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) ---A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - ---CAPZoneMiddle = ZONE:New( "CAP Zone Middle") ---A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) ---A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) - --- GCI Squadron execution. -A2ADispatcher:SetSquadronGci2( "Mozdok", 900, 1200, 100, 100, "RADIO" ) -A2ADispatcher:SetSquadronGci2( "Novo", 900, 2100, 100, 100, "RADIO" ) -A2ADispatcher:SetSquadronGci2( "Maykop", 900, 1200, 200, 200, "RADIO" ) - --- Set the language of the squadrons to Russian. -A2ADispatcher:SetSquadronLanguage( "Mozdok", "RU" ) -A2ADispatcher:SetSquadronLanguage( "Novo", "RU" ) -A2ADispatcher:SetSquadronLanguage( "Maykop", "RU" ) - -A2ADispatcher:SetSquadronRadioFrequency( "Mozdok", 127.5 ) -A2ADispatcher:SetSquadronRadioFrequency( "Novo", 127.5 ) -A2ADispatcher:SetSquadronRadioFrequency( "Maykop", 127.5 ) - - --- Set the squadrons visible before startup. ---A2ADispatcher:SetSquadronVisible( "Mineralnye" ) ---A2ADispatcher:SetSquadronVisible( "Sochi" ) ---A2ADispatcher:SetSquadronVisible( "Mozdok" ) ---A2ADispatcher:SetSquadronVisible( "Maykop" ) ---A2ADispatcher:SetSquadronVisible( "Novo" ) - - ---CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) - - --- Blue attack simulation -local Frequency = 300 - -BlueSpawn1 = SPAWN - :New( "RT NATO 1" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn2 = SPAWN - :New( "RT NATO 2" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn3 = SPAWN - :New( "RT NATO 3" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - -BlueSpawn4 = SPAWN - :New( "RT NATO 4" ) - :InitLimit( 2, 10 ) - :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) - :InitRandomizeRoute( 0, 0, 30000 ) - --:InitDelayOn() - :SpawnScheduled( Frequency, 0.4 ) - +--- +-- Name: AID-A2A-100 - Demonstration +-- Author: FlightControl +-- Date Created: 30 May 2017 + +local HQ_Group = GROUP:FindByName( "HQ" ) +local HQ_CC = COMMANDCENTER:New( HQ_Group, "HQ" ) + +-- Define a SET_GROUP object that builds a collection of groups that define the EWR network. +-- Here we build the network with all the groups that have a name starting with DF CCCP AWACS and DF CCCP EWR. +local DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "DF CCCP AWACS", "DF CCCP EWR" } ) +DetectionSetGroup:FilterStart() + +local Detection = DETECTION_AREAS:New( DetectionSetGroup, 30000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) +A2ADispatcher:SetCommandCenter( HQ_CC ) + +-- Enable the tactical display panel. +A2ADispatcher:SetTacticalDisplay( false ) +A2ADispatcher:SetTacticalMenu( "Dispatchers", "A2A" ) + +-- Initialize the dispatcher, setting up a border zone. This is a polygon, +-- which takes the waypoints of a late activated group with the name CCCP Border as the boundaries of the border area. +-- Any enemy crossing this border will be engaged. +CCCPBorderZone = ZONE_POLYGON:New( "CCCP Border", GROUP:FindByName( "CCCP Border" ) ) +A2ADispatcher:SetBorderZone( CCCPBorderZone ) + +-- Initialize the dispatcher, setting up a radius of 100km where any airborne friendly +-- without an assignment within 100km radius from a detected target, will engage that target. +A2ADispatcher:SetEngageRadius( 120000 ) + +-- Setup the squadrons. +A2ADispatcher:SetSquadron( "Mineralnye", AIRBASE.Caucasus.Mineralnye_Vody, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD" }, 16 ) +A2ADispatcher:SetSquadron( "Maykop", AIRBASE.Caucasus.Maykop_Khanskaya, { "SQ CCCP MIG-31" }, 20 ) +A2ADispatcher:SetSquadron( "Mozdok", AIRBASE.Caucasus.Mozdok, { "SQ CCCP MIG-31" }, 16 ) +A2ADispatcher:SetSquadron( "Sochi", AIRBASE.Caucasus.Sochi_Adler, { "SQ CCCP SU-27", "SQ CCCP SU-33", "SQ CCCP MIG-23MLD", "SQ CCCP MIG-25PD", "SQ CCCP SU-34", "SQ CCCP MIG-31", "SQ CCCP MIG-29S" }, 40 ) +A2ADispatcher:SetSquadron( "Novo", AIRBASE.Caucasus.Novorossiysk, { "SQ CCCP SU-27" }, 16 ) + +-- Setup the overhead +A2ADispatcher:SetSquadronOverhead( "Mineralnye", 1.2 ) +A2ADispatcher:SetSquadronOverhead( "Maykop", 1 ) +A2ADispatcher:SetSquadronOverhead( "Mozdok", 1 ) +A2ADispatcher:SetSquadronOverhead( "Sochi", 2 ) +A2ADispatcher:SetSquadronOverhead( "Novo", 1.5 ) + +-- Setup the Grouping +A2ADispatcher:SetSquadronGrouping( "Mineralnye", 4 ) +A2ADispatcher:SetSquadronGrouping( "Sochi", 2 ) +A2ADispatcher:SetSquadronGrouping( "Novo", 3 ) + +-- Setup the Takeoff methods +A2ADispatcher:SetSquadronTakeoff( "Mineralnye", AI_A2A_DISPATCHER.Takeoff.Hot ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Sochi" ) +A2ADispatcher:SetSquadronTakeoffFromRunway( "Mozdok" ) +A2ADispatcher:SetSquadronTakeoffFromParkingCold( "Maykop" ) +A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" ) + +-- Setup the Landing methods +A2ADispatcher:SetSquadronLandingAtRunway( "Mineralnye" ) +A2ADispatcher:SetSquadronLandingNearAirbase( "Sochi" ) +A2ADispatcher:SetSquadronLandingAtEngineShutdown( "Mozdok" ) +A2ADispatcher:SetSquadronLandingNearAirbase( "Maykop" ) +A2ADispatcher:SetSquadronLanding( "Novo", AI_A2A_DISPATCHER.Landing.AtRunway ) + + +-- CAP Squadron execution. +--CAPZoneEast = ZONE_POLYGON:New( "CAP Zone East", GROUP:FindByName( "CAP Zone East" ) ) +--A2ADispatcher:SetSquadronCap( "Mineralnye", CAPZoneEast, 4000, 10000, 500, 600, 800, 900 ) +--A2ADispatcher:SetSquadronCapInterval( "Mineralnye", 6, 30, 60, 1 ) + +--CAPZoneWest = ZONE_POLYGON:New( "CAP Zone West", GROUP:FindByName( "CAP Zone West" ) ) +--A2ADispatcher:SetSquadronCap( "Sochi", CAPZoneWest, 4000, 8000, 600, 800, 800, 1200, "BARO" ) +--A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +--CAPZoneMiddle = ZONE:New( "CAP Zone Middle") +--A2ADispatcher:SetSquadronCap( "Maykop", CAPZoneMiddle, 4000, 8000, 600, 800, 800, 1200, "RADIO" ) +--A2ADispatcher:SetSquadronCapInterval( "Sochi", 2, 30, 120, 1 ) + +-- GCI Squadron execution. +A2ADispatcher:SetSquadronGci2( "Mozdok", 900, 1200, 100, 100, "RADIO" ) +A2ADispatcher:SetSquadronGci2( "Novo", 900, 2100, 100, 100, "RADIO" ) +A2ADispatcher:SetSquadronGci2( "Maykop", 900, 1200, 200, 200, "RADIO" ) + +-- Set the language of the squadrons to Russian. +A2ADispatcher:SetSquadronLanguage( "Mozdok", "RU" ) +A2ADispatcher:SetSquadronLanguage( "Novo", "RU" ) +A2ADispatcher:SetSquadronLanguage( "Maykop", "RU" ) + +A2ADispatcher:SetSquadronRadioFrequency( "Mozdok", 127.5 ) +A2ADispatcher:SetSquadronRadioFrequency( "Novo", 127.5 ) +A2ADispatcher:SetSquadronRadioFrequency( "Maykop", 127.5 ) + + +-- Set the squadrons visible before startup. +--A2ADispatcher:SetSquadronVisible( "Mineralnye" ) +--A2ADispatcher:SetSquadronVisible( "Sochi" ) +--A2ADispatcher:SetSquadronVisible( "Mozdok" ) +--A2ADispatcher:SetSquadronVisible( "Maykop" ) +--A2ADispatcher:SetSquadronVisible( "Novo" ) + + +--CleanUp = CLEANUP_AIRBASE:New( { AIRBASE.Caucasus.Novorossiysk } ) + + +-- Blue attack simulation +local Frequency = 300 + +BlueSpawn1 = SPAWN + :New( "RT NATO 1" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn2 = SPAWN + :New( "RT NATO 2" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn3 = SPAWN + :New( "RT NATO 3" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + +BlueSpawn4 = SPAWN + :New( "RT NATO 4" ) + :InitLimit( 2, 10 ) + :InitRandomizeTemplate( { "SQ NATO A-10C", "SQ NATO F-15C", "SQ NATO F-16A", "SQ NATO F/A-18", "SQ NATO F-16C" } ) + :InitRandomizeRoute( 0, 0, 30000 ) + --:InitDelayOn() + :SpawnScheduled( Frequency, 0.4 ) + diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-001 - Detection and Attack Helicopters/AID-A2G-001 - Detection and Attack Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-001 - Detection and Attack Helicopters/AID-A2G-001 - Detection and Attack Helicopters.lua index 5118b7fdf8..d42ce59951 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-001 - Detection and Attack Helicopters/AID-A2G-001 - Detection and Attack Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-001 - Detection and Attack Helicopters/AID-A2G-001 - Detection and Attack Helicopters.lua @@ -1,48 +1,48 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 5000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 5000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-002 - Patrol and Engage Helicopters/AID-A2G-002 - Patrol and Engage Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-002 - Patrol and Engage Helicopters/AID-A2G-002 - Patrol and Engage Helicopters.lua index 82403dd4df..d5cc27230c 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-002 - Patrol and Engage Helicopters/AID-A2G-002 - Patrol and Engage Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-002 - Patrol and Engage Helicopters/AID-A2G-002 - Patrol and Engage Helicopters.lua @@ -1,52 +1,52 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", "SEAD", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 300, 500, 50, 80, 250, 300 ) -A2GDispatcher:SetSquadronPatrolInterval( "Maykop SEAD", 2, 30, 60, 1, "SEAD" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCasPatrol( "Maykop CAS", PatrolZone, 600, 700, 50, 80, 250, 300 ) -A2GDispatcher:SetSquadronPatrolInterval( "Maykop CAS", 2, 30, 60, 1, "CAS" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBaiPatrol( "Maykop BAI", PatrolZone, 800, 900, 50, 80, 250, 300 ) -A2GDispatcher:SetSquadronPatrolInterval( "Maykop BAI", 2, 30, 60, 1, "BAI" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", "SEAD", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 300, 500, 50, 80, 250, 300 ) +A2GDispatcher:SetSquadronPatrolInterval( "Maykop SEAD", 2, 30, 60, 1, "SEAD" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCasPatrol( "Maykop CAS", PatrolZone, 600, 700, 50, 80, 250, 300 ) +A2GDispatcher:SetSquadronPatrolInterval( "Maykop CAS", 2, 30, 60, 1, "CAS" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBaiPatrol( "Maykop BAI", PatrolZone, 800, 900, 50, 80, 250, 300 ) +A2GDispatcher:SetSquadronPatrolInterval( "Maykop BAI", 2, 30, 60, 1, "BAI" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) \ No newline at end of file diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-003 - Detection and Attack one Group Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-003 - Detection and Attack one Group Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua index 3a93345059..c4b7fff895 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-003 - Detection and Attack one Group Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-003 - Detection and Attack one Group Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua @@ -1,52 +1,52 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - - -CC = COMMANDCENTER:New( GROUP:FindByName("HQ"),"HQ") - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) -A2GDispatcher:SetCommandCenter( CC ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + + +CC = COMMANDCENTER:New( GROUP:FindByName("HQ"),"HQ") + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) +A2GDispatcher:SetCommandCenter( CC ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-004 - Detection and attack close defense point Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-004 - Detection and attack close defense point Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua index 3a93345059..c4b7fff895 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-004 - Detection and attack close defense point Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-004 - Detection and attack close defense point Helicopters/AID-A2G-003 - Detection and Attack one Group Helicopters.lua @@ -1,52 +1,52 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - - -CC = COMMANDCENTER:New( GROUP:FindByName("HQ"),"HQ") - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) -A2GDispatcher:SetCommandCenter( CC ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + + +CC = COMMANDCENTER:New( GROUP:FindByName("HQ"),"HQ") + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) +A2GDispatcher:SetCommandCenter( CC ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-100 - DefenseRadius/AID-A2G-100 - DefenseRadius.lua b/AI/AI_A2G_Dispatcher/AID-A2G-100 - DefenseRadius/AID-A2G-100 - DefenseRadius.lua index 3354a20382..9af5a5eebc 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-100 - DefenseRadius/AID-A2G-100 - DefenseRadius.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-100 - DefenseRadius/AID-A2G-100 - DefenseRadius.lua @@ -1,50 +1,50 @@ ---- Test the defense radius. --- Defenses should pickup targets within the defense radius, but not outside of it! --- Defenses should engage targets closer to the HQ with higher probability than targets at longer distance from the HQ. --- The tests are with SEAD only. --- Name: AID-A2G-003 - DefenseRadius --- Author: FlightControl --- Date Created: 11 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the SEAD squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) -A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) -A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 1, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffInAir( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) - --- Setup the CAS squadrons. -A2GDispatcher:SetSquadron( "Maykop CAS", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T CAS" }, 10 ) -A2GDispatcher:SetSquadronCasPatrol( "Maykop CAS", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) -A2GDispatcher:SetSquadronCasPatrolInterval( "Maykop CAS", 1, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffInAir( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) +--- Test the defense radius. +-- Defenses should pickup targets within the defense radius, but not outside of it! +-- Defenses should engage targets closer to the HQ with higher probability than targets at longer distance from the HQ. +-- The tests are with SEAD only. +-- Name: AID-A2G-003 - DefenseRadius +-- Author: FlightControl +-- Date Created: 11 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the SEAD squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) +A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 1, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffInAir( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) + +-- Setup the CAS squadrons. +A2GDispatcher:SetSquadron( "Maykop CAS", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T CAS" }, 10 ) +A2GDispatcher:SetSquadronCasPatrol( "Maykop CAS", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +A2GDispatcher:SetSquadronCasPatrolInterval( "Maykop CAS", 1, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffInAir( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-110 - Default Engage Limit/AID-A2G-110 - Default Engage Limit.lua b/AI/AI_A2G_Dispatcher/AID-A2G-110 - Default Engage Limit/AID-A2G-110 - Default Engage Limit.lua index 4b77c7493b..e85099b8b9 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-110 - Default Engage Limit/AID-A2G-110 - Default Engage Limit.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-110 - Default Engage Limit/AID-A2G-110 - Default Engage Limit.lua @@ -1,45 +1,45 @@ ---- Test the default engage limit. --- Defenses should engage enemy units, but not more defenses than the defense limit! --- Name: AID-A2G-110 - Default DefenseLimit --- Author: FlightControl --- Date Created: 15 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - --- This is the test, not more than 4 defenses in total should engage! -A2GDispatcher:SetDefaultEngageLimit( 6 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) ---A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) ---A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffInAir( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) +--- Test the default engage limit. +-- Defenses should engage enemy units, but not more defenses than the defense limit! +-- Name: AID-A2G-110 - Default DefenseLimit +-- Author: FlightControl +-- Date Created: 15 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +-- This is the test, not more than 4 defenses in total should engage! +A2GDispatcher:SetDefaultEngageLimit( 6 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) +--A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +--A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffInAir( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-190 - Communication/AID-A2G-190 - Communication.lua b/AI/AI_A2G_Dispatcher/AID-A2G-190 - Communication/AID-A2G-190 - Communication.lua index bcf6fe2eed..46d081853b 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-190 - Communication/AID-A2G-190 - Communication.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-190 - Communication/AID-A2G-190 - Communication.lua @@ -1,80 +1,80 @@ ---- Test the communication system to other players. --- A command center will facilitate the A2G defenses communication to the players, who reporting to the same command center. --- The task system needs to be used to have this reporting facilitated. --- Name: AID-A2G-190 - Communication --- Author: FlightControl --- Date Created: 11 Jan 2019 - --- Define a command center that will communicate with the players. -CC_Red = COMMANDCENTER:New( GROUP:FindByName( "HQ" ), "Command" ) - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection_Red = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -AI_A2G_Dispatcher_Red = AI_A2G_DISPATCHER:New( Detection_Red ) - - - - --- Add defense coordinates. -AI_A2G_Dispatcher_Red:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -AI_A2G_Dispatcher_Red:SetDefenseReactivityHigh() - -AI_A2G_Dispatcher_Red:SetDefenseRadius( 100000 ) - --- This is the test, not more than 4 defenses in total should engage! -AI_A2G_Dispatcher_Red:SetDefaultEngageLimit( 6 ) - -AI_A2G_Dispatcher_Red:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. - --- SEAD -AI_A2G_Dispatcher_Red:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T SEAD #001", "CCCP AI SU-25T SEAD #002", "CCCP AI SU-25T SEAD #003" }, 10 ) -AI_A2G_Dispatcher_Red:SetSquadronSead( "Maykop SEAD", 600, 800 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop SEAD", 0.2 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) - --- CAS -AI_A2G_Dispatcher_Red:SetSquadron( "Maykop CAS", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T CAS" }, 10 ) -AI_A2G_Dispatcher_Red:SetSquadronCas( "Maykop CAS", 600, 800 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop CAS", 0.25 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) - --- BAI -AI_A2G_Dispatcher_Red:SetSquadron( "Maykop BAI", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T BAI" }, 10 ) -AI_A2G_Dispatcher_Red:SetSquadronBai( "Maykop BAI", 600, 800 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop BAI", 0.25 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) - - - - --- Now we setup the TASK A2G dispatcher, that will use the same detection system, as the AI A2G dispatcher! -Mission_Red = MISSION:New( CC_Red, "Comms Demo", "Example", "This mission demonstrates the communications between the AI A2G dispatcher and the TASK A2G dispatcher to the involved players.", coalition.side.RED ) -Players_Red = SET_GROUP:New():FilterPrefixes( "CCCP Player" ):FilterStart() -Task_A2G_Dispatcher_Red = TASK_A2G_DISPATCHER:New( Mission_Red, Players_Red, Detection_Red ) -Task_A2G_Dispatcher_Red:Start() - --- Here we set the command center, which will faciliate the communication to the Players_Red, using the same Detection_Red. -AI_A2G_Dispatcher_Red:SetCommandCenter( CC_Red ) - +--- Test the communication system to other players. +-- A command center will facilitate the A2G defenses communication to the players, who reporting to the same command center. +-- The task system needs to be used to have this reporting facilitated. +-- Name: AID-A2G-190 - Communication +-- Author: FlightControl +-- Date Created: 11 Jan 2019 + +-- Define a command center that will communicate with the players. +CC_Red = COMMANDCENTER:New( GROUP:FindByName( "HQ" ), "Command" ) + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection_Red = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +AI_A2G_Dispatcher_Red = AI_A2G_DISPATCHER:New( Detection_Red ) + + + + +-- Add defense coordinates. +AI_A2G_Dispatcher_Red:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +AI_A2G_Dispatcher_Red:SetDefenseReactivityHigh() + +AI_A2G_Dispatcher_Red:SetDefenseRadius( 100000 ) + +-- This is the test, not more than 4 defenses in total should engage! +AI_A2G_Dispatcher_Red:SetDefaultEngageLimit( 6 ) + +AI_A2G_Dispatcher_Red:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. + +-- SEAD +AI_A2G_Dispatcher_Red:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T SEAD #001", "CCCP AI SU-25T SEAD #002", "CCCP AI SU-25T SEAD #003" }, 10 ) +AI_A2G_Dispatcher_Red:SetSquadronSead( "Maykop SEAD", 600, 800 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop SEAD", 0.2 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) + +-- CAS +AI_A2G_Dispatcher_Red:SetSquadron( "Maykop CAS", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T CAS" }, 10 ) +AI_A2G_Dispatcher_Red:SetSquadronCas( "Maykop CAS", 600, 800 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop CAS", 0.25 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) + +-- BAI +AI_A2G_Dispatcher_Red:SetSquadron( "Maykop BAI", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T BAI" }, 10 ) +AI_A2G_Dispatcher_Red:SetSquadronBai( "Maykop BAI", 600, 800 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop BAI", 0.25 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) + + + + +-- Now we setup the TASK A2G dispatcher, that will use the same detection system, as the AI A2G dispatcher! +Mission_Red = MISSION:New( CC_Red, "Comms Demo", "Example", "This mission demonstrates the communications between the AI A2G dispatcher and the TASK A2G dispatcher to the involved players.", coalition.side.RED ) +Players_Red = SET_GROUP:New():FilterPrefixes( "CCCP Player" ):FilterStart() +Task_A2G_Dispatcher_Red = TASK_A2G_DISPATCHER:New( Mission_Red, Players_Red, Detection_Red ) +Task_A2G_Dispatcher_Red:Start() + +-- Here we set the command center, which will faciliate the communication to the Players_Red, using the same Detection_Red. +AI_A2G_Dispatcher_Red:SetCommandCenter( CC_Red ) + diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-191 - Communication Engage One Unit/AID-A2G-191 - Communication Engage One Unit.lua b/AI/AI_A2G_Dispatcher/AID-A2G-191 - Communication Engage One Unit/AID-A2G-191 - Communication Engage One Unit.lua index 7162634a08..397048b8b7 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-191 - Communication Engage One Unit/AID-A2G-191 - Communication Engage One Unit.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-191 - Communication Engage One Unit/AID-A2G-191 - Communication Engage One Unit.lua @@ -1,63 +1,63 @@ ---- Test the communication system to other players. --- A command center will facilitate the A2G defenses communication to the players, who reporting to the same command center. --- The task system needs to be used to have this reporting facilitated. --- --- Author: FlightControl --- Date Created: 20 Jan 2019 - --- Define a command center that will communicate with the players. -CC_Red = COMMANDCENTER:New( GROUP:FindByName( "HQ" ), "Command" ) - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection_Red = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -AI_A2G_Dispatcher_Red = AI_A2G_DISPATCHER:New( Detection_Red ) - - - - --- Add defense coordinates. -AI_A2G_Dispatcher_Red:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -AI_A2G_Dispatcher_Red:SetDefenseReactivityHigh() - -AI_A2G_Dispatcher_Red:SetDefenseRadius( 100000 ) - --- This is the test, not more than 4 defenses in total should engage! -AI_A2G_Dispatcher_Red:SetDefaultEngageLimit( 6 ) - -AI_A2G_Dispatcher_Red:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. - --- SEAD -AI_A2G_Dispatcher_Red:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T SEAD #001", "CCCP AI SU-25T SEAD #002", "CCCP AI SU-25T SEAD #003" }, 10 ) -AI_A2G_Dispatcher_Red:SetSquadronSead( "Maykop SEAD", 600, 800 ) -AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop SEAD", 0.2 ) -AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) - - --- Now we setup the TASK A2G dispatcher, that will use the same detection system, as the AI A2G dispatcher! -Mission_Red = MISSION:New( CC_Red, "Comms Demo", "Example", "This mission demonstrates the communications between the AI A2G dispatcher and the TASK A2G dispatcher to the involved players.", coalition.side.RED ) -Players_Red = SET_GROUP:New():FilterPrefixes( "CCCP Player" ):FilterStart() -Task_A2G_Dispatcher_Red = TASK_A2G_DISPATCHER:New( Mission_Red, Players_Red, Detection_Red ) -Task_A2G_Dispatcher_Red:Start() - --- Here we set the command center, which will faciliate the communication to the Players_Red, using the same Detection_Red. -AI_A2G_Dispatcher_Red:SetCommandCenter( CC_Red ) - +--- Test the communication system to other players. +-- A command center will facilitate the A2G defenses communication to the players, who reporting to the same command center. +-- The task system needs to be used to have this reporting facilitated. +-- +-- Author: FlightControl +-- Date Created: 20 Jan 2019 + +-- Define a command center that will communicate with the players. +CC_Red = COMMANDCENTER:New( GROUP:FindByName( "HQ" ), "Command" ) + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection_Red = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +AI_A2G_Dispatcher_Red = AI_A2G_DISPATCHER:New( Detection_Red ) + + + + +-- Add defense coordinates. +AI_A2G_Dispatcher_Red:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +AI_A2G_Dispatcher_Red:SetDefenseReactivityHigh() + +AI_A2G_Dispatcher_Red:SetDefenseRadius( 100000 ) + +-- This is the test, not more than 4 defenses in total should engage! +AI_A2G_Dispatcher_Red:SetDefaultEngageLimit( 6 ) + +AI_A2G_Dispatcher_Red:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. + +-- SEAD +AI_A2G_Dispatcher_Red:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP AI SU-25T SEAD #001", "CCCP AI SU-25T SEAD #002", "CCCP AI SU-25T SEAD #003" }, 10 ) +AI_A2G_Dispatcher_Red:SetSquadronSead( "Maykop SEAD", 600, 800 ) +AI_A2G_Dispatcher_Red:SetSquadronOverhead( "Maykop SEAD", 0.2 ) +AI_A2G_Dispatcher_Red:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) + + +-- Now we setup the TASK A2G dispatcher, that will use the same detection system, as the AI A2G dispatcher! +Mission_Red = MISSION:New( CC_Red, "Comms Demo", "Example", "This mission demonstrates the communications between the AI A2G dispatcher and the TASK A2G dispatcher to the involved players.", coalition.side.RED ) +Players_Red = SET_GROUP:New():FilterPrefixes( "CCCP Player" ):FilterStart() +Task_A2G_Dispatcher_Red = TASK_A2G_DISPATCHER:New( Mission_Red, Players_Red, Detection_Red ) +Task_A2G_Dispatcher_Red:Start() + +-- Here we set the command center, which will faciliate the communication to the Players_Red, using the same Detection_Red. +AI_A2G_Dispatcher_Red:SetCommandCenter( CC_Red ) + diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-210 - Depart from Ramp/AID-A2G-210 - Depart from Ramp.lua b/AI/AI_A2G_Dispatcher/AID-A2G-210 - Depart from Ramp/AID-A2G-210 - Depart from Ramp.lua index dec2870538..1f0387d864 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-210 - Depart from Ramp/AID-A2G-210 - Depart from Ramp.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-210 - Depart from Ramp/AID-A2G-210 - Depart from Ramp.lua @@ -1,42 +1,42 @@ ---- Test the default engage limit. --- Defenses should engage enemy units, but not more defenses than the defense limit! --- Name: AID-A2G-110 - Default DefenseLimit --- Author: FlightControl --- Date Created: 15 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) ---A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) ---A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffFromParkingCold( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) +--- Test the default engage limit. +-- Defenses should engage enemy units, but not more defenses than the defense limit! +-- Name: AID-A2G-110 - Default DefenseLimit +-- Author: FlightControl +-- Date Created: 15 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) +--A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +--A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffFromParkingCold( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-211 - Depart from Hot/AID-A2G-211 - Depart from Hot.lua b/AI/AI_A2G_Dispatcher/AID-A2G-211 - Depart from Hot/AID-A2G-211 - Depart from Hot.lua index d7f26d92f0..472215f018 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-211 - Depart from Hot/AID-A2G-211 - Depart from Hot.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-211 - Depart from Hot/AID-A2G-211 - Depart from Hot.lua @@ -1,42 +1,42 @@ ---- Test the default engage limit. --- Defenses should engage enemy units, but not more defenses than the defense limit! --- Name: AID-A2G-110 - Default DefenseLimit --- Author: FlightControl --- Date Created: 15 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) ---A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) ---A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) +--- Test the default engage limit. +-- Defenses should engage enemy units, but not more defenses than the defense limit! +-- Name: AID-A2G-110 - Default DefenseLimit +-- Author: FlightControl +-- Date Created: 15 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) +--A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +--A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-212 - Depart from Runway/AID-A2G-212 - Depart from Runway.lua b/AI/AI_A2G_Dispatcher/AID-A2G-212 - Depart from Runway/AID-A2G-212 - Depart from Runway.lua index d22dd6a5b6..91adbfd5e5 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-212 - Depart from Runway/AID-A2G-212 - Depart from Runway.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-212 - Depart from Runway/AID-A2G-212 - Depart from Runway.lua @@ -1,45 +1,45 @@ ---- Test the default engage limit. --- Defenses should engage enemy units, but not more defenses than the defense limit! --- Name: AID-A2G-110 - Default DefenseLimit --- Author: FlightControl --- Date Created: 15 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - --- This is the test, not more than 4 defenses in total should engage! -A2GDispatcher:SetDefaultEngageLimit( 6 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) ---A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) ---A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffFromRunway( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) +--- Test the default engage limit. +-- Defenses should engage enemy units, but not more defenses than the defense limit! +-- Name: AID-A2G-110 - Default DefenseLimit +-- Author: FlightControl +-- Date Created: 15 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +-- This is the test, not more than 4 defenses in total should engage! +A2GDispatcher:SetDefaultEngageLimit( 6 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) +--A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +--A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffFromRunway( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-213 - Depart from Air/AID-A2G-213 - Depart from Air.lua b/AI/AI_A2G_Dispatcher/AID-A2G-213 - Depart from Air/AID-A2G-213 - Depart from Air.lua index 4b77c7493b..e85099b8b9 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-213 - Depart from Air/AID-A2G-213 - Depart from Air.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-213 - Depart from Air/AID-A2G-213 - Depart from Air.lua @@ -1,45 +1,45 @@ ---- Test the default engage limit. --- Defenses should engage enemy units, but not more defenses than the defense limit! --- Name: AID-A2G-110 - Default DefenseLimit --- Author: FlightControl --- Date Created: 15 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - --- This is the test, not more than 4 defenses in total should engage! -A2GDispatcher:SetDefaultEngageLimit( 6 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) ---A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) ---A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffInAir( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) +--- Test the default engage limit. +-- Defenses should engage enemy units, but not more defenses than the defense limit! +-- Name: AID-A2G-110 - Default DefenseLimit +-- Author: FlightControl +-- Date Created: 15 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +-- This is the test, not more than 4 defenses in total should engage! +A2GDispatcher:SetDefaultEngageLimit( 6 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T SEAD" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 250, 350 ) +--A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +--A2GDispatcher:SetSquadronSeadPatrolInterval( "Maykop SEAD", 4, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffInAir( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-250 - Visible before start/AID-A2G-250 - Visible before start.lua b/AI/AI_A2G_Dispatcher/AID-A2G-250 - Visible before start/AID-A2G-250 - Visible before start.lua index 0adcd7b24b..b8d5ab6204 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-250 - Visible before start/AID-A2G-250 - Visible before start.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-250 - Visible before start/AID-A2G-250 - Visible before start.lua @@ -1,48 +1,48 @@ ---- Test the default engage limit. --- Defenses should engage enemy units, but not more defenses than the defense limit! --- Name: AID-A2G-110 - Default DefenseLimit --- Author: FlightControl --- Date Created: 15 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. - -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". - --- This command will start the dynamic filtering, so when groups spawn in or are destroyed, --- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. -DetectionSetGroup:FilterStart() - --- This command defines the reconnaissance network. --- It will group any detected ground enemy targets within a radius of 1km. --- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - --- This is the test, not more than 4 defenses in total should engage! -A2GDispatcher:SetDefaultEngageLimit( 6 ) - -A2GDispatcher:SetTacticalDisplay( true ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Krymsk SEAD", AIRBASE.Caucasus.Krymsk, { "CCCP SEAD Su-30", "CCCP SEAD Su-25T", "CCCP SEAD Su-25TM", "CCCP SEAD Su-34" }, 20 ) -A2GDispatcher:SetSquadronSead( "Krymsk SEAD", 600, 800 ) ---A2GDispatcher:SetSquadronSeadPatrol( "Krymsk SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) ---A2GDispatcher:SetSquadronSeadPatrolInterval( "Krymsk SEAD", 4, 30, 60, 1 ) -A2GDispatcher:SetSquadronOverhead( "Krymsk SEAD", 0.2 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Krymsk SEAD" ) -A2GDispatcher:SetSquadronLandingAtEngineShutdown( "Krymsk SEAD" ) - +--- Test the default engage limit. +-- Defenses should engage enemy units, but not more defenses than the defense limit! +-- Name: AID-A2G-110 - Default DefenseLimit +-- Author: FlightControl +-- Date Created: 15 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() -- Defene a set of group objects, caled DetectionSetGroup. + +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -- The DetectionSetGroup will search for groups that start with the name "CCCP Recce". + +-- This command will start the dynamic filtering, so when groups spawn in or are destroyed, +-- which have a group name starting with "CCCP Recce", then these will be automatically added or removed from the set. +DetectionSetGroup:FilterStart() + +-- This command defines the reconnaissance network. +-- It will group any detected ground enemy targets within a radius of 1km. +-- It uses the DetectionSetGroup, which defines the set of reconnaissance groups to detect for enemy ground targets. +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + +-- This is the test, not more than 4 defenses in total should engage! +A2GDispatcher:SetDefaultEngageLimit( 6 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Krymsk SEAD", AIRBASE.Caucasus.Krymsk, { "CCCP SEAD Su-30", "CCCP SEAD Su-25T", "CCCP SEAD Su-25TM", "CCCP SEAD Su-34" }, 20 ) +A2GDispatcher:SetSquadronSead( "Krymsk SEAD", 600, 800 ) +--A2GDispatcher:SetSquadronSeadPatrol( "Krymsk SEAD", PatrolZone, 1000, 2500, 400, 600, 1100, 1500 ) +--A2GDispatcher:SetSquadronSeadPatrolInterval( "Krymsk SEAD", 4, 30, 60, 1 ) +A2GDispatcher:SetSquadronOverhead( "Krymsk SEAD", 0.2 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Krymsk SEAD" ) +A2GDispatcher:SetSquadronLandingAtEngineShutdown( "Krymsk SEAD" ) + --A2GDispatcher:SetSquadronVisible( "Krymsk SEAD" ) \ No newline at end of file diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-300 - CAS Helicopters/AID-A2G-300 - CAS Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-300 - CAS Helicopters/AID-A2G-300 - CAS Helicopters.lua index 4522bf478b..11240a6dd9 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-300 - CAS Helicopters/AID-A2G-300 - CAS Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-300 - CAS Helicopters/AID-A2G-300 - CAS Helicopters.lua @@ -1,31 +1,31 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Sq34", "FARP CAS", { "Defender" }, 10 ) -A2GDispatcher:SetSquadronCas( "Sq34", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Sq34", "FARP CAS", { "Defender" }, 10 ) +A2GDispatcher:SetSquadronCas( "Sq34", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-310 - CAS Helicopters Patrol/AID-A2G-310 - CAS Helicopters Patrol.lua b/AI/AI_A2G_Dispatcher/AID-A2G-310 - CAS Helicopters Patrol/AID-A2G-310 - CAS Helicopters Patrol.lua index 9a4a75fd46..91dbe42976 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-310 - CAS Helicopters Patrol/AID-A2G-310 - CAS Helicopters Patrol.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-310 - CAS Helicopters Patrol/AID-A2G-310 - CAS Helicopters Patrol.lua @@ -1,33 +1,33 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) -A2GDispatcher:SetSquadron( "Sq34", "FARP CAS", { "Defender" }, 10 ) -A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 200, 500, 70, 100, 250, 300 ) -A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) +A2GDispatcher:SetSquadron( "Sq34", "FARP CAS", { "Defender" }, 10 ) +A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 200, 500, 70, 100, 250, 300 ) +A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-350 - CAS Airplanes/AID-A2G-350 - CAS Airplanes.lua b/AI/AI_A2G_Dispatcher/AID-A2G-350 - CAS Airplanes/AID-A2G-350 - CAS Airplanes.lua index 3e5beef7ff..52c5f832ce 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-350 - CAS Airplanes/AID-A2G-350 - CAS Airplanes.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-350 - CAS Airplanes/AID-A2G-350 - CAS Airplanes.lua @@ -1,61 +1,61 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - -Detection:SetFriendliesRange( 20000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - --- Setup the squadron Sq34. -A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender Sq34" }, 10 ) - --- This will setup the squadron Sq34 for CAS from Vaziani. --- Attack speed between 1000 and 1500 km/h. --- Attack altitude between 4000 and 6000 meters. -A2GDispatcher:SetSquadronCas( "Sq34", 1000, 1500, 4000, 6000 ) - - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) - --- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.5 ) - - --- Setup the squadron Sq25. -A2GDispatcher:SetSquadron( "Sq25", AIRBASE.Caucasus.Soganlug, { "Defender Sq25" }, 10 ) - --- This will setup the squadron Sq34 for CAS from Vaziani. --- No additional altitude and speed parameters are given, so the defaults are assigned. --- Default speed between 50% and 75% of the maximum speed of the units in the group. --- Default altitude is between 1000 and 1500 meters. -A2GDispatcher:SetSquadronCas( "Sq25" ) - - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq25" ) - --- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. -A2GDispatcher:SetSquadronOverhead( "Sq25", 0.25 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +Detection:SetFriendliesRange( 20000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +-- Setup the squadron Sq34. +A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender Sq34" }, 10 ) + +-- This will setup the squadron Sq34 for CAS from Vaziani. +-- Attack speed between 1000 and 1500 km/h. +-- Attack altitude between 4000 and 6000 meters. +A2GDispatcher:SetSquadronCas( "Sq34", 1000, 1500, 4000, 6000 ) + + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) + +-- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.5 ) + + +-- Setup the squadron Sq25. +A2GDispatcher:SetSquadron( "Sq25", AIRBASE.Caucasus.Soganlug, { "Defender Sq25" }, 10 ) + +-- This will setup the squadron Sq34 for CAS from Vaziani. +-- No additional altitude and speed parameters are given, so the defaults are assigned. +-- Default speed between 50% and 75% of the maximum speed of the units in the group. +-- Default altitude is between 1000 and 1500 meters. +A2GDispatcher:SetSquadronCas( "Sq25" ) + + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq25" ) + +-- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. +A2GDispatcher:SetSquadronOverhead( "Sq25", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-351 - CAS Airplanes/AID-A2G-351 - CAS Airplanes.lua b/AI/AI_A2G_Dispatcher/AID-A2G-351 - CAS Airplanes/AID-A2G-351 - CAS Airplanes.lua index 5fc04b75ba..2396a8ade9 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-351 - CAS Airplanes/AID-A2G-351 - CAS Airplanes.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-351 - CAS Airplanes/AID-A2G-351 - CAS Airplanes.lua @@ -1,45 +1,45 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - -Detection:SetFriendliesRange( 20000 ) --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 250000 ) - - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) - --- Setup the squadron Sq25. -A2GDispatcher:SetSquadron( "Sq25", AIRBASE.Caucasus.Beslan, { "Defender" }, 10 ) - --- This will setup the squadron Sq34 for CAS from Beslan. --- No additional altitude and speed parameters are given, so the defaults are assigned. --- Default speed between 50% and 75% of the maximum speed of the units in the group. --- Default altitude is between 1000 and 1500 meters. -A2GDispatcher:SetSquadronCas( "Sq25" ) - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq25" ) - --- For every 2 targets, there will be one plane spawned. -A2GDispatcher:SetSquadronOverhead( "Sq25", 0.5 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +Detection:SetFriendliesRange( 20000 ) +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 250000 ) + + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) + +-- Setup the squadron Sq25. +A2GDispatcher:SetSquadron( "Sq25", AIRBASE.Caucasus.Beslan, { "Defender" }, 10 ) + +-- This will setup the squadron Sq34 for CAS from Beslan. +-- No additional altitude and speed parameters are given, so the defaults are assigned. +-- Default speed between 50% and 75% of the maximum speed of the units in the group. +-- Default altitude is between 1000 and 1500 meters. +A2GDispatcher:SetSquadronCas( "Sq25" ) + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq25" ) + +-- For every 2 targets, there will be one plane spawned. +A2GDispatcher:SetSquadronOverhead( "Sq25", 0.5 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-352 - CAS Airplanes/AID-A2G-352 - CAS Airplanes.lua b/AI/AI_A2G_Dispatcher/AID-A2G-352 - CAS Airplanes/AID-A2G-352 - CAS Airplanes.lua index bbaa5be2f6..5077742a82 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-352 - CAS Airplanes/AID-A2G-352 - CAS Airplanes.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-352 - CAS Airplanes/AID-A2G-352 - CAS Airplanes.lua @@ -1,45 +1,45 @@ ---- Detect and attack a set of enemy units using helicopters. --- --- Author: FlightControl --- Date Created: 23 Jan 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - -Detection:SetFriendliesRange( 20000 ) --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 250000 ) - - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) - --- Setup the squadron Sq25. -A2GDispatcher:SetSquadron( "Sq26", AIRBASE.Caucasus.Nalchik, { "Defender" }, 10 ) - --- This will setup the squadron Sq34 for CAS from Beslan. --- No additional altitude and speed parameters are given, so the defaults are assigned. --- Default speed between 50% and 75% of the maximum speed of the units in the group. --- Default altitude is between 1000 and 1500 meters. -A2GDispatcher:SetSquadronCas( "Sq26" ) - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq26" ) - --- For every 2 targets, there will be one plane spawned. -A2GDispatcher:SetSquadronOverhead( "Sq26", 0.20 ) +--- Detect and attack a set of enemy units using helicopters. +-- +-- Author: FlightControl +-- Date Created: 23 Jan 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +Detection:SetFriendliesRange( 20000 ) +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 250000 ) + + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) + +-- Setup the squadron Sq25. +A2GDispatcher:SetSquadron( "Sq26", AIRBASE.Caucasus.Nalchik, { "Defender" }, 10 ) + +-- This will setup the squadron Sq34 for CAS from Beslan. +-- No additional altitude and speed parameters are given, so the defaults are assigned. +-- Default speed between 50% and 75% of the maximum speed of the units in the group. +-- Default altitude is between 1000 and 1500 meters. +A2GDispatcher:SetSquadronCas( "Sq26" ) + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq26" ) + +-- For every 2 targets, there will be one plane spawned. +A2GDispatcher:SetSquadronOverhead( "Sq26", 0.20 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-360 - CAS Airplanes Patrol/AID-A2G-360 - CAS Airplanes Patrol.lua b/AI/AI_A2G_Dispatcher/AID-A2G-360 - CAS Airplanes Patrol/AID-A2G-360 - CAS Airplanes Patrol.lua index 5ebff04e69..a348a0f806 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-360 - CAS Airplanes Patrol/AID-A2G-360 - CAS Airplanes Patrol.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-360 - CAS Airplanes Patrol/AID-A2G-360 - CAS Airplanes Patrol.lua @@ -1,43 +1,43 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) - --- Setup the squadron Sq34. -A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender" }, 10 ) - --- This will setup the squadron Sq34 for patrol and CAS from Vaziani. -A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) - --- Maximum 6 units for patrol, with a spawn interval between 30 and 60 seconds. -A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) - --- For every 4 targets, there will be one plane spawned. -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) + +-- Setup the squadron Sq34. +A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender" }, 10 ) + +-- This will setup the squadron Sq34 for patrol and CAS from Vaziani. +A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) + +-- Maximum 6 units for patrol, with a spawn interval between 30 and 60 seconds. +A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) + +-- For every 4 targets, there will be one plane spawned. +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-361 - CAS Airplanes Patrol/AID-A2G-361 - CAS Airplanes Patrol.lua b/AI/AI_A2G_Dispatcher/AID-A2G-361 - CAS Airplanes Patrol/AID-A2G-361 - CAS Airplanes Patrol.lua index 97a124f687..685e8ffac2 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-361 - CAS Airplanes Patrol/AID-A2G-361 - CAS Airplanes Patrol.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-361 - CAS Airplanes Patrol/AID-A2G-361 - CAS Airplanes Patrol.lua @@ -1,40 +1,40 @@ --- Date Created: 09 Mar 2019 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) - --- Setup the squadron Sq34. -A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender" }, 10 ) - --- This will setup the squadron Sq34 for patrol and CAS from Vaziani. -A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) - --- Maximum 6 units for patrol, with a spawn interval between 30 and 60 seconds. ---A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) - --- For every 4 targets, there will be one plane spawned. -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) +-- Date Created: 09 Mar 2019 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) + +-- Setup the squadron Sq34. +A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender" }, 10 ) + +-- This will setup the squadron Sq34 for patrol and CAS from Vaziani. +A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) + +-- Maximum 6 units for patrol, with a spawn interval between 30 and 60 seconds. +--A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) + +-- For every 4 targets, there will be one plane spawned. +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-362 - CAS Airplanes Patrol Visible/AID-A2G-362 - CAS Airplanes Patrol Visible.lua b/AI/AI_A2G_Dispatcher/AID-A2G-362 - CAS Airplanes Patrol Visible/AID-A2G-362 - CAS Airplanes Patrol Visible.lua index 08614f8435..8d2eeb22e6 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-362 - CAS Airplanes Patrol Visible/AID-A2G-362 - CAS Airplanes Patrol Visible.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-362 - CAS Airplanes Patrol Visible/AID-A2G-362 - CAS Airplanes Patrol Visible.lua @@ -1,47 +1,47 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) - --- Setup the squadron Sq34 at Kutaisi, using template Defender for 10 units. -A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Kutaisi, { "Defender" }, 10 ) - --- This will setup the squadron Sq34 for patrol and CAS. -A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) - --- Maximum 2 units for patrol, with a spawn interval between 30 and 60 seconds. -A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) - --- For every 4 targets, there will be one plane spawned. -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) - --- Make planes visible before start ... -A2GDispatcher:SetSquadronVisible( "Sq34" ) - +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) + +-- Setup the squadron Sq34 at Kutaisi, using template Defender for 10 units. +A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Kutaisi, { "Defender" }, 10 ) + +-- This will setup the squadron Sq34 for patrol and CAS. +A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) + +-- Maximum 2 units for patrol, with a spawn interval between 30 and 60 seconds. +A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) + +-- For every 4 targets, there will be one plane spawned. +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) + +-- Make planes visible before start ... +A2GDispatcher:SetSquadronVisible( "Sq34" ) + diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-363 - CAS Airplanes Patrol Refuel/AID-A2G-363 - CAS Airplanes Patrol Refuel.lua b/AI/AI_A2G_Dispatcher/AID-A2G-363 - CAS Airplanes Patrol Refuel/AID-A2G-363 - CAS Airplanes Patrol Refuel.lua index 7ec4ae9149..19a13b20a9 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-363 - CAS Airplanes Patrol Refuel/AID-A2G-363 - CAS Airplanes Patrol Refuel.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-363 - CAS Airplanes Patrol Refuel/AID-A2G-363 - CAS Airplanes Patrol Refuel.lua @@ -1,44 +1,44 @@ --- Date Created: 09 Mar 2019 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -local CASPatrolZone = ZONE:New( "CASPatrolZone" ) - --- Setup the squadron Sq34. -A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender" }, 10 ) - --- This will setup the squadron Sq34 for patrol and CAS from Vaziani. -A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) - --- Maximum 6 units for patrol, with a spawn interval between 30 and 60 seconds. ---A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) - --- For every 4 targets, there will be one plane spawned. -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) - -A2GDispatcher:SetDefaultTanker( "Tanker" ) -A2GDispatcher:SetDefaultFuelThreshold( 0.9 ) - +-- Date Created: 09 Mar 2019 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +local CASPatrolZone = ZONE:New( "CASPatrolZone" ) + +-- Setup the squadron Sq34. +A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender" }, 10 ) + +-- This will setup the squadron Sq34 for patrol and CAS from Vaziani. +A2GDispatcher:SetSquadronCasPatrol( "Sq34", CASPatrolZone, 1500, 2500, 600, 800, 800, 1200 ) + +-- Maximum 6 units for patrol, with a spawn interval between 30 and 60 seconds. +--A2GDispatcher:SetSquadronCasPatrolInterval( "Sq34", 2, 30, 60 ) + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) + +-- For every 4 targets, there will be one plane spawned. +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.25 ) + +A2GDispatcher:SetDefaultTanker( "Tanker" ) +A2GDispatcher:SetDefaultFuelThreshold( 0.9 ) + diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-400 - BAI Helicopters/AID-A2G-400 - BAI Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-400 - BAI Helicopters/AID-A2G-400 - BAI Helicopters.lua index e90889b195..cf3e066503 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-400 - BAI Helicopters/AID-A2G-400 - BAI Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-400 - BAI Helicopters/AID-A2G-400 - BAI Helicopters.lua @@ -1,36 +1,36 @@ ---- Detect and attack a set of enemy units using helicopters. --- Author: FlightControl --- Date Created: 27 Jan 2019 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityMedium() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50 BAI" }, 10 ) -A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250, 1000, 1500 ) -A2GDispatcher:SetSquadronTakeoffFromParkingCold( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- Wait for each helicopter to spawn about 4 minutes from cold start. --- So the FARP has 4 spots, that means every 60 seconds one helo. --- Otherwise the FARP will clutter. --- This will result in helicopters not guided properly by the dispatcher. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Author: FlightControl +-- Date Created: 27 Jan 2019 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityMedium() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50 BAI" }, 10 ) +A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250, 1000, 1500 ) +A2GDispatcher:SetSquadronTakeoffFromParkingCold( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- Wait for each helicopter to spawn about 4 minutes from cold start. +-- So the FARP has 4 spots, that means every 60 seconds one helo. +-- Otherwise the FARP will clutter. +-- This will result in helicopters not guided properly by the dispatcher. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-550 - SEAD Airplanes/AID-A2G-550 - SEAD Airplanes.lua b/AI/AI_A2G_Dispatcher/AID-A2G-550 - SEAD Airplanes/AID-A2G-550 - SEAD Airplanes.lua index 02826948ca..9a75c991c6 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-550 - SEAD Airplanes/AID-A2G-550 - SEAD Airplanes.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-550 - SEAD Airplanes/AID-A2G-550 - SEAD Airplanes.lua @@ -1,61 +1,61 @@ ---- Detect and attack a set of enemy units using helicopters. --- --- Author: FlightControl --- Date Created: 23 Jan 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "Recce" } ) -DetectionSetGroup:FilterStart() - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 20000 ) - -Detection:SetFriendliesRange( 20000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - --- Setup the squadron Sq34. -A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender Sq34" }, 10 ) - --- This will setup the squadron Sq34 for SEAD from Vaziani. --- Attack speed between 1000 and 1500 km/h. --- Attack altitude between 4000 and 6000 meters. -A2GDispatcher:SetSquadronSead( "Sq34", 600, 800, 4500, 6000 ) - - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) - --- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. -A2GDispatcher:SetSquadronOverhead( "Sq34", 0.5 ) - - --- Setup the squadron Sq25. -A2GDispatcher:SetSquadron( "Sq25", AIRBASE.Caucasus.Soganlug, { "Defender Sq25" }, 10 ) - --- This will setup the squadron Sq34 for CAS from Vaziani. --- No additional altitude and speed parameters are given, so the defaults are assigned. --- Default speed between 50% and 75% of the maximum speed of the units in the group. --- Default altitude is between 1000 and 1500 meters. -A2GDispatcher:SetSquadronCas( "Sq25" ) - - --- Start from airbase hot. -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq25" ) - --- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. -A2GDispatcher:SetSquadronOverhead( "Sq25", 0.25 ) +--- Detect and attack a set of enemy units using helicopters. +-- +-- Author: FlightControl +-- Date Created: 23 Jan 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "Recce" } ) +DetectionSetGroup:FilterStart() + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 20000 ) + +Detection:SetFriendliesRange( 20000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +-- Setup the squadron Sq34. +A2GDispatcher:SetSquadron( "Sq34", AIRBASE.Caucasus.Vaziani, { "Defender Sq34" }, 10 ) + +-- This will setup the squadron Sq34 for SEAD from Vaziani. +-- Attack speed between 1000 and 1500 km/h. +-- Attack altitude between 4000 and 6000 meters. +A2GDispatcher:SetSquadronSead( "Sq34", 600, 800, 4500, 6000 ) + + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq34" ) + +-- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. +A2GDispatcher:SetSquadronOverhead( "Sq34", 0.5 ) + + +-- Setup the squadron Sq25. +A2GDispatcher:SetSquadron( "Sq25", AIRBASE.Caucasus.Soganlug, { "Defender Sq25" }, 10 ) + +-- This will setup the squadron Sq34 for CAS from Vaziani. +-- No additional altitude and speed parameters are given, so the defaults are assigned. +-- Default speed between 50% and 75% of the maximum speed of the units in the group. +-- Default altitude is between 1000 and 1500 meters. +A2GDispatcher:SetSquadronCas( "Sq25" ) + + +-- Start from airbase hot. +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Sq25" ) + +-- For every 2 targets, there will be one plane spawned, so we give a 0.5 value. +A2GDispatcher:SetSquadronOverhead( "Sq25", 0.25 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-600 - Detection Zones and Attack Helicopters/AID-A2G-600 - Detection Zones and Attack Helicopters.lua b/AI/AI_A2G_Dispatcher/AID-A2G-600 - Detection Zones and Attack Helicopters/AID-A2G-600 - Detection Zones and Attack Helicopters.lua index 2394330530..f900c02223 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-600 - Detection Zones and Attack Helicopters/AID-A2G-600 - Detection Zones and Attack Helicopters.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-600 - Detection Zones and Attack Helicopters/AID-A2G-600 - Detection Zones and Attack Helicopters.lua @@ -1,46 +1,46 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - - - -local DetectionZones = SET_ZONE:New():FilterPrefixes( { "Detection Zone " } ):FilterOnce() - -Detection = DETECTION_ZONES:New( DetectionZones, coalition.side.BLUE ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + + + +local DetectionZones = SET_ZONE:New():FilterPrefixes( { "Detection Zone " } ):FilterOnce() + +Detection = DETECTION_ZONES:New( DetectionZones, coalition.side.BLUE ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-601 - Detection Zones and Defense Limit/AID-A2G-601 - Detection Zones and Defense Limit.lua b/AI/AI_A2G_Dispatcher/AID-A2G-601 - Detection Zones and Defense Limit/AID-A2G-601 - Detection Zones and Defense Limit.lua index 0350aa57cb..65919ba250 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-601 - Detection Zones and Defense Limit/AID-A2G-601 - Detection Zones and Defense Limit.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-601 - Detection Zones and Defense Limit/AID-A2G-601 - Detection Zones and Defense Limit.lua @@ -1,48 +1,48 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - - - -local DetectionZones = SET_ZONE:New():FilterPrefixes( { "Detection Zone " } ):FilterOnce() - -Detection = DETECTION_ZONES:New( DetectionZones, coalition.side.BLUE ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 200000 ) - -A2GDispatcher:SetDefenseLimit( 1 ) - -A2GDispatcher:SetTacticalDisplay( true ) - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) -A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + + + +local DetectionZones = SET_ZONE:New():FilterPrefixes( { "Detection Zone " } ):FilterOnce() + +Detection = DETECTION_ZONES:New( DetectionZones, coalition.side.BLUE ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 200000 ) + +A2GDispatcher:SetDefenseLimit( 1 ) + +A2GDispatcher:SetTacticalDisplay( true ) + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop SEAD", AIRBASE.Caucasus.Maykop_Khanskaya, { "CCCP SU-25T" }, 10 ) +A2GDispatcher:SetSquadronSead( "Maykop SEAD", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.2 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCas( "Maykop CAS", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBai( "Maykop BAI", 120, 250 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-702 - Patrol and Engage Sound Check/AID-A2G-702 - Patrol and Engage Sound Check.lua b/AI/AI_A2G_Dispatcher/AID-A2G-702 - Patrol and Engage Sound Check/AID-A2G-702 - Patrol and Engage Sound Check.lua index f710b92f23..98e74e1393 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-702 - Patrol and Engage Sound Check/AID-A2G-702 - Patrol and Engage Sound Check.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-702 - Patrol and Engage Sound Check/AID-A2G-702 - Patrol and Engage Sound Check.lua @@ -1,60 +1,60 @@ ---- Sound check using patrol and engage for helicopters. --- Author: FlightControl --- Date Created: 14 Sep 2019 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "US Recce" } ) -DetectionSetGroup:FilterStart() - -CCGroup = GROUP:FindByName( "HQ" ) -CC = COMMANDCENTER:New( CCGroup, "HQ" ) - -Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - -A2GDispatcher:SetCommandCenter( CC ) -A2GDispatcher:SetTacticalMenu( "Dispatchers", "A2G Tactical Situation" ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) - -A2GDispatcher:SetDefenseReactivityHigh() - -A2GDispatcher:SetDefenseRadius( 100000 ) - -A2GDispatcher:SetTacticalDisplay( false ) - -local PatrolZone = ZONE:New( "PatrolZone" ) - --- Setup the squadrons. -A2GDispatcher:SetSquadron( "Maykop SEAD", "SEAD", { "US KA-50" }, 10 ) -A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 300, 500, 50, 80, 250, 300 ) -A2GDispatcher:SetSquadronPatrolInterval( "Maykop SEAD", 2, 30, 60, 1, "SEAD" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) -A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) -A2GDispatcher:SetSquadronRadioFrequency( "Maykop SEAD", 124 ) - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "US KA-50" }, 10 ) -A2GDispatcher:SetSquadronCasPatrol( "Maykop CAS", PatrolZone, 600, 700, 50, 80, 250, 300 ) -A2GDispatcher:SetSquadronPatrolInterval( "Maykop CAS", 2, 30, 60, 1, "CAS" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) -A2GDispatcher:SetSquadronRadioFrequency( "Maykop CAS", 126 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "US KA-50" }, 10 ) -A2GDispatcher:SetSquadronBaiPatrol( "Maykop BAI", PatrolZone, 800, 900, 50, 80, 250, 300 ) -A2GDispatcher:SetSquadronPatrolInterval( "Maykop BAI", 2, 30, 60, 1, "BAI" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) -A2GDispatcher:SetSquadronRadioFrequency( "Maykop BAI", 128 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +--- Sound check using patrol and engage for helicopters. +-- Author: FlightControl +-- Date Created: 14 Sep 2019 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "US Recce" } ) +DetectionSetGroup:FilterStart() + +CCGroup = GROUP:FindByName( "HQ" ) +CC = COMMANDCENTER:New( CCGroup, "HQ" ) + +Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +A2GDispatcher:SetCommandCenter( CC ) +A2GDispatcher:SetTacticalMenu( "Dispatchers", "A2G Tactical Situation" ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", GROUP:FindByName( "HQ" ):GetCoordinate() ) + +A2GDispatcher:SetDefenseReactivityHigh() + +A2GDispatcher:SetDefenseRadius( 100000 ) + +A2GDispatcher:SetTacticalDisplay( false ) + +local PatrolZone = ZONE:New( "PatrolZone" ) + +-- Setup the squadrons. +A2GDispatcher:SetSquadron( "Maykop SEAD", "SEAD", { "US KA-50" }, 10 ) +A2GDispatcher:SetSquadronSeadPatrol( "Maykop SEAD", PatrolZone, 300, 500, 50, 80, 250, 300 ) +A2GDispatcher:SetSquadronPatrolInterval( "Maykop SEAD", 2, 30, 60, 1, "SEAD" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop SEAD" ) +A2GDispatcher:SetSquadronOverhead( "Maykop SEAD", 0.25 ) +A2GDispatcher:SetSquadronRadioFrequency( "Maykop SEAD", 124 ) + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "US KA-50" }, 10 ) +A2GDispatcher:SetSquadronCasPatrol( "Maykop CAS", PatrolZone, 600, 700, 50, 80, 250, 300 ) +A2GDispatcher:SetSquadronPatrolInterval( "Maykop CAS", 2, 30, 60, 1, "CAS" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) +A2GDispatcher:SetSquadronRadioFrequency( "Maykop CAS", 126 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "US KA-50" }, 10 ) +A2GDispatcher:SetSquadronBaiPatrol( "Maykop BAI", PatrolZone, 800, 900, 50, 80, 250, 300 ) +A2GDispatcher:SetSquadronPatrolInterval( "Maykop BAI", 2, 30, 60, 1, "BAI" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) +A2GDispatcher:SetSquadronRadioFrequency( "Maykop BAI", 128 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop SEAD", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) \ No newline at end of file diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-900 - A fun A2G Mission/AID-A2G-900 - A fun A2G Mission.lua b/AI/AI_A2G_Dispatcher/AID-A2G-900 - A fun A2G Mission/AID-A2G-900 - A fun A2G Mission.lua index b3f5f71659..616858b05c 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-900 - A fun A2G Mission/AID-A2G-900 - A fun A2G Mission.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-900 - A fun A2G Mission/AID-A2G-900 - A fun A2G Mission.lua @@ -1,28 +1,28 @@ - -Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() - -Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) - -A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) - -A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter - -DefenseCoordinate = GROUP:FindByName( "COMMAND" ):GetCoordinate() - -A2G_Blue:AddDefenseCoordinate( "Defense Point", DefenseCoordinate ) -A2G_Blue:SetDefenseRadius( 200000 ) -- in meters -A2G_Blue:SetDefenseReactivityHigh() -- we engage almost immediately - -A2G_Blue:SetSquadron( "SQ-1", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-AH-64D-ROCKETS", "A2G-DEFENSE-AH-64D-HELLFIRES" }, 20 ) -A2G_Blue:SetSquadronBai( "SQ-1", 200, 280, 160, 500 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-1", 1000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-1" ) -A2G_Blue:SetSquadronOverhead( "SQ-1", 0.25 ) - -A2G_Blue:SetSquadron( "SQ-2", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-AH-SU-25T-SEAD" }, 6 ) -A2G_Blue:SetSquadronSead( "SQ-2", 600, 900, 1000, 2000 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-2", 2000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-2" ) -A2G_Blue:SetSquadronOverhead( "SQ-2", 0.5 ) - - + +Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() + +Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) + +A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) + +A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter + +DefenseCoordinate = GROUP:FindByName( "COMMAND" ):GetCoordinate() + +A2G_Blue:AddDefenseCoordinate( "Defense Point", DefenseCoordinate ) +A2G_Blue:SetDefenseRadius( 200000 ) -- in meters +A2G_Blue:SetDefenseReactivityHigh() -- we engage almost immediately + +A2G_Blue:SetSquadron( "SQ-1", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-AH-64D-ROCKETS", "A2G-DEFENSE-AH-64D-HELLFIRES" }, 20 ) +A2G_Blue:SetSquadronBai( "SQ-1", 200, 280, 160, 500 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-1", 1000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-1" ) +A2G_Blue:SetSquadronOverhead( "SQ-1", 0.25 ) + +A2G_Blue:SetSquadron( "SQ-2", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-AH-SU-25T-SEAD" }, 6 ) +A2G_Blue:SetSquadronSead( "SQ-2", 600, 900, 1000, 2000 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-2", 2000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-2" ) +A2G_Blue:SetSquadronOverhead( "SQ-2", 0.5 ) + + diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-901 - A fun A2G Mission/AID-A2G-901 - A fun A2G Mission.lua b/AI/AI_A2G_Dispatcher/AID-A2G-901 - A fun A2G Mission/AID-A2G-901 - A fun A2G Mission.lua index 090e4a6b2c..564c7f2d5a 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-901 - A fun A2G Mission/AID-A2G-901 - A fun A2G Mission.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-901 - A fun A2G Mission/AID-A2G-901 - A fun A2G Mission.lua @@ -1,35 +1,35 @@ - -Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() - -Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) - -A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) - -A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter - -A2G_Blue:AddDefenseCoordinate( "Command", GROUP:FindByName( "COMMAND" ):GetCoordinate() ) -A2G_Blue:AddDefenseCoordinate( "Home", GROUP:FindByName( "HOME" ):GetCoordinate() ) - - -A2G_Blue:SetDefenseRadius( 200000 ) -- in meters -A2G_Blue:SetDefenseReactivityHigh() -- we engage almost immediately - -A2G_Blue:SetSquadron( "SQ-1", AIRBASE.Caucasus.Senaki_Kolkhi, { "A2G-DEFENSE-HELO-001", "A2G-DEFENSE-HELO-002", "A2G-DEFENSE-HELO-003" }, 20 ) -A2G_Blue:SetSquadronBai( "SQ-1", 200, 280, 160, 500 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-1", 1000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-1" ) -A2G_Blue:SetSquadronOverhead( "SQ-1", 0.25 ) - -A2G_Blue:SetSquadron( "SQ-2", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-SU-25T-SEAD" }, 10 ) -A2G_Blue:SetSquadronSead( "SQ-2", 600, 900, 1000, 2000 ) -A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-2" ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingAtRunway( "SQ-2" ) -A2G_Blue:SetSquadronOverhead( "SQ-2", 0.5 ) - -A2G_Blue:SetSquadron( "SQ-3", AIRBASE.Caucasus.Kobuleti, { "A2G-DEFENSE-AJS37-CAS" }, 6 ) -A2G_Blue:SetSquadronBai( "SQ-3", 600, 900, 1000, 2000 ) -A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-3" ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingAtRunway( "SQ-3" ) -A2G_Blue:SetSquadronOverhead( "SQ-3", 0.5 ) -A2G_Blue:SetSquadronBaiPatrol( "SQ-3", ZONE:New( "PatrolZone" ), 2000, 3000, 600, 800, 1000, 1400 ) -A2G_Blue:SetSquadronPatrolInterval( "SQ-3", 4, 30, 60, 1, "BAI" ) + +Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() + +Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) + +A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) + +A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter + +A2G_Blue:AddDefenseCoordinate( "Command", GROUP:FindByName( "COMMAND" ):GetCoordinate() ) +A2G_Blue:AddDefenseCoordinate( "Home", GROUP:FindByName( "HOME" ):GetCoordinate() ) + + +A2G_Blue:SetDefenseRadius( 200000 ) -- in meters +A2G_Blue:SetDefenseReactivityHigh() -- we engage almost immediately + +A2G_Blue:SetSquadron( "SQ-1", AIRBASE.Caucasus.Senaki_Kolkhi, { "A2G-DEFENSE-HELO-001", "A2G-DEFENSE-HELO-002", "A2G-DEFENSE-HELO-003" }, 20 ) +A2G_Blue:SetSquadronBai( "SQ-1", 200, 280, 160, 500 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-1", 1000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-1" ) +A2G_Blue:SetSquadronOverhead( "SQ-1", 0.25 ) + +A2G_Blue:SetSquadron( "SQ-2", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-SU-25T-SEAD" }, 10 ) +A2G_Blue:SetSquadronSead( "SQ-2", 600, 900, 1000, 2000 ) +A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-2" ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingAtRunway( "SQ-2" ) +A2G_Blue:SetSquadronOverhead( "SQ-2", 0.5 ) + +A2G_Blue:SetSquadron( "SQ-3", AIRBASE.Caucasus.Kobuleti, { "A2G-DEFENSE-AJS37-CAS" }, 6 ) +A2G_Blue:SetSquadronBai( "SQ-3", 600, 900, 1000, 2000 ) +A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-3" ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingAtRunway( "SQ-3" ) +A2G_Blue:SetSquadronOverhead( "SQ-3", 0.5 ) +A2G_Blue:SetSquadronBaiPatrol( "SQ-3", ZONE:New( "PatrolZone" ), 2000, 3000, 600, 800, 1000, 1400 ) +A2G_Blue:SetSquadronPatrolInterval( "SQ-3", 4, 30, 60, 1, "BAI" ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-902 - A fun A2G Mission/AID-A2G-902 - A fun A2G Mission.lua b/AI/AI_A2G_Dispatcher/AID-A2G-902 - A fun A2G Mission/AID-A2G-902 - A fun A2G Mission.lua index cda06f4b72..d498f27523 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-902 - A fun A2G Mission/AID-A2G-902 - A fun A2G Mission.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-902 - A fun A2G Mission/AID-A2G-902 - A fun A2G Mission.lua @@ -1,44 +1,44 @@ - -Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() - -Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) - -A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) - -A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter - -A2G_Blue:AddDefenseCoordinate( "Command", GROUP:FindByName( "COMMAND" ):GetCoordinate() ) -A2G_Blue:AddDefenseCoordinate( "Home", GROUP:FindByName( "HOME" ):GetCoordinate() ) - - -A2G_Blue:SetDefenseRadius( 350000 ) -- in meters -A2G_Blue:SetDefenseReactivityMedium() -- we engage almost immediately - -A2G_Blue:SetSquadron( "SQ-1", AIRBASE.Caucasus.Senaki_Kolkhi, { "A2G-DEFENSE-HELO-001", "A2G-DEFENSE-HELO-002", "A2G-DEFENSE-HELO-003" }, 20 ) -A2G_Blue:SetSquadronBai( "SQ-1", 200, 280, 160, 500 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-1", 1000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-1" ) -A2G_Blue:SetSquadronOverhead( "SQ-1", 0.5 ) -A2G_Blue:SetSquadronGrouping( "SQ-1", 4 ) - -A2G_Blue:SetSquadron( "SQ-HELO", AIRBASE.Caucasus.Sukhumi_Babushara, { "A2G-DEFENSE-HELO-004", "A2G-DEFENSE-HELO-005", "A2G-DEFENSE-HELO-006" }, 20 ) -A2G_Blue:SetSquadronBai( "SQ-HELO", 200, 280, 1500, 2000 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-HELO", 1000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-HELO" ) -A2G_Blue:SetSquadronOverhead( "SQ-HELO", 0.75 ) -A2G_Blue:SetSquadronGrouping( "SQ-HELO", 4 ) - -A2G_Blue:SetSquadron( "SQ-2", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-SU-25T-SEAD" }, 10 ) -A2G_Blue:SetSquadronSead( "SQ-2", 700, 1100, 2500, 4000 ) -A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-2" ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingAtRunway( "SQ-2" ) -A2G_Blue:SetSquadronOverhead( "SQ-2", 0.5 ) - -A2G_Blue:SetSquadron( "SQ-AIR", AIRBASE.Caucasus.Kobuleti, { "A2G-DEFENSE-A-10C-CAS" }, 6 ) -A2G_Blue:SetSquadronBai( "SQ-AIR", 600, 900, 1000, 2000 ) -A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-AIR" ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingAtRunway( "SQ-AIR" ) -A2G_Blue:SetSquadronOverhead( "SQ-AIR", 0.75 ) -A2G_Blue:SetSquadronBaiPatrol( "SQ-AIR", ZONE:New( "PatrolZone" ), 2000, 3000, 600, 800, 1000, 1400 ) -A2G_Blue:SetSquadronPatrolInterval( "SQ-AIR", 4, 30, 60, 1, "BAI" ) -A2G_Blue:SetSquadronGrouping( "SQ-AIR", 4 ) + +Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() + +Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) + +A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) + +A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter + +A2G_Blue:AddDefenseCoordinate( "Command", GROUP:FindByName( "COMMAND" ):GetCoordinate() ) +A2G_Blue:AddDefenseCoordinate( "Home", GROUP:FindByName( "HOME" ):GetCoordinate() ) + + +A2G_Blue:SetDefenseRadius( 350000 ) -- in meters +A2G_Blue:SetDefenseReactivityMedium() -- we engage almost immediately + +A2G_Blue:SetSquadron( "SQ-1", AIRBASE.Caucasus.Senaki_Kolkhi, { "A2G-DEFENSE-HELO-001", "A2G-DEFENSE-HELO-002", "A2G-DEFENSE-HELO-003" }, 20 ) +A2G_Blue:SetSquadronBai( "SQ-1", 200, 280, 160, 500 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-1", 1000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-1" ) +A2G_Blue:SetSquadronOverhead( "SQ-1", 0.5 ) +A2G_Blue:SetSquadronGrouping( "SQ-1", 4 ) + +A2G_Blue:SetSquadron( "SQ-HELO", AIRBASE.Caucasus.Sukhumi_Babushara, { "A2G-DEFENSE-HELO-004", "A2G-DEFENSE-HELO-005", "A2G-DEFENSE-HELO-006" }, 20 ) +A2G_Blue:SetSquadronBai( "SQ-HELO", 200, 280, 1500, 2000 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-HELO", 1000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-HELO" ) +A2G_Blue:SetSquadronOverhead( "SQ-HELO", 0.75 ) +A2G_Blue:SetSquadronGrouping( "SQ-HELO", 4 ) + +A2G_Blue:SetSquadron( "SQ-2", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-SU-25T-SEAD" }, 10 ) +A2G_Blue:SetSquadronSead( "SQ-2", 700, 1100, 2500, 4000 ) +A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-2" ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingAtRunway( "SQ-2" ) +A2G_Blue:SetSquadronOverhead( "SQ-2", 0.5 ) + +A2G_Blue:SetSquadron( "SQ-AIR", AIRBASE.Caucasus.Kobuleti, { "A2G-DEFENSE-A-10C-CAS" }, 6 ) +A2G_Blue:SetSquadronBai( "SQ-AIR", 600, 900, 1000, 2000 ) +A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-AIR" ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingAtRunway( "SQ-AIR" ) +A2G_Blue:SetSquadronOverhead( "SQ-AIR", 0.75 ) +A2G_Blue:SetSquadronBaiPatrol( "SQ-AIR", ZONE:New( "PatrolZone" ), 2000, 3000, 600, 800, 1000, 1400 ) +A2G_Blue:SetSquadronPatrolInterval( "SQ-AIR", 4, 30, 60, 1, "BAI" ) +A2G_Blue:SetSquadronGrouping( "SQ-AIR", 4 ) diff --git a/AI/AI_A2G_Dispatcher/AID-A2G-903 - A fun A2G Mission/AID-A2G-903 - A fun A2G Mission.lua b/AI/AI_A2G_Dispatcher/AID-A2G-903 - A fun A2G Mission/AID-A2G-903 - A fun A2G Mission.lua index 31108d19d3..28ea81517d 100644 --- a/AI/AI_A2G_Dispatcher/AID-A2G-903 - A fun A2G Mission/AID-A2G-903 - A fun A2G Mission.lua +++ b/AI/AI_A2G_Dispatcher/AID-A2G-903 - A fun A2G Mission/AID-A2G-903 - A fun A2G Mission.lua @@ -1,56 +1,56 @@ - -Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() - -Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) - -A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) - -A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter - -A2G_Blue:AddDefenseCoordinate( "Command", GROUP:FindByName( "COMMAND" ):GetCoordinate() ) -A2G_Blue:AddDefenseCoordinate( "Home", GROUP:FindByName( "HOME" ):GetCoordinate() ) - - -A2G_Blue:SetDefenseRadius( 350000 ) -- in meters -A2G_Blue:SetDefenseReactivityMedium() -- we engage almost immediately - -A2G_Blue:SetSquadron( "SQ-HELO-BAI-1", AIRBASE.Caucasus.Senaki_Kolkhi, { "A2G-DEFENSE-HELO-001", "A2G-DEFENSE-HELO-002", "A2G-DEFENSE-HELO-003" }, 20 ) -A2G_Blue:SetSquadronBai( "SQ-HELO-BAI-1", 200, 280, 160, 500 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-HELO-BAI-1", 1000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-HELO-BAI-1" ) -A2G_Blue:SetSquadronOverhead( "SQ-HELO-BAI-1", 0.5 ) -A2G_Blue:SetSquadronGrouping( "SQ-HELO-BAI-1", 4 ) - -A2G_Blue:SetSquadron( "SQ-HELO-BAI-2", AIRBASE.Caucasus.Sukhumi_Babushara, { "A2G-DEFENSE-HELO-004", "A2G-DEFENSE-HELO-005", "A2G-DEFENSE-HELO-006" }, 20 ) -A2G_Blue:SetSquadronBai( "SQ-HELO-BAI-2", 200, 280, 1500, 2000 ) -A2G_Blue:SetSquadronTakeoffInAir( "SQ-HELO-BAI-2", 1000 ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingNearAirbase( "SQ-HELO-BAI-2" ) -A2G_Blue:SetSquadronOverhead( "SQ-HELO-BAI-2", 0.75 ) -A2G_Blue:SetSquadronGrouping( "SQ-HELO-BAI-2", 4 ) - -A2G_Blue:SetSquadron( "SQ-SEAD", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-SU-25T-SEAD" }, 10 ) -A2G_Blue:SetSquadronSead( "SQ-SEAD", 700, 1100, 2500, 4000 ) -A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-SEAD" ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingAtRunway( "SQ-SEAD" ) -A2G_Blue:SetSquadronOverhead( "SQ-SEAD", 1 ) -A2G_Blue:SetSquadronGrouping( "SQ-SEAD", 2 ) - -A2G_Blue:SetSquadron( "SQ-AIR-BAI", AIRBASE.Caucasus.Kobuleti, { "A2G-DEFENSE-A-10C" }, 6 ) -A2G_Blue:SetSquadronBai( "SQ-AIR-BAI", 600, 900, 1000, 2000 ) -A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-AIR-BAI" ) -- altitude in meters when spawning in the air. -A2G_Blue:SetSquadronLandingAtRunway( "SQ-AIR-BAI" ) -A2G_Blue:SetSquadronOverhead( "SQ-AIR-BAI", 0.75 ) -A2G_Blue:SetSquadronBaiPatrol( "SQ-AIR-BAI", ZONE:New( "PatrolZone" ), 2000, 3000, 600, 800, 1000, 1400 ) -A2G_Blue:SetSquadronPatrolInterval( "SQ-AIR-BAI", 4, 30, 60, 1, "BAI" ) -A2G_Blue:SetSquadronGrouping( "SQ-AIR-BAI", 4 ) - - --- A2G task dispatcher - -Command_Blue = COMMANDCENTER:New( GROUP:FindByName( "NATO HQ" ), "NATO HQ" ) - -Mission_Blue = MISSION:New( Command_Blue, "Invasion", "High", "Eliminate 5 targets", coalition.side.BLUE ) - -Players_Blue = SET_GROUP:New():FilterPrefixes( { "NATO Player" } ):FilterStart() - + +Recce_Blue = SET_GROUP:New():FilterPrefixes( "RECCE" ):FilterStart() + +Detection_Blue = DETECTION_AREAS:New( Recce_Blue, 3000 ) + +A2G_Blue = AI_A2G_DISPATCHER:New(Detection_Blue) + +A2G_Blue:SetTacticalDisplay( true ) -- set on using true as a parameter + +A2G_Blue:AddDefenseCoordinate( "Command", GROUP:FindByName( "COMMAND" ):GetCoordinate() ) +A2G_Blue:AddDefenseCoordinate( "Home", GROUP:FindByName( "HOME" ):GetCoordinate() ) + + +A2G_Blue:SetDefenseRadius( 350000 ) -- in meters +A2G_Blue:SetDefenseReactivityMedium() -- we engage almost immediately + +A2G_Blue:SetSquadron( "SQ-HELO-BAI-1", AIRBASE.Caucasus.Senaki_Kolkhi, { "A2G-DEFENSE-HELO-001", "A2G-DEFENSE-HELO-002", "A2G-DEFENSE-HELO-003" }, 20 ) +A2G_Blue:SetSquadronBai( "SQ-HELO-BAI-1", 200, 280, 160, 500 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-HELO-BAI-1", 1000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-HELO-BAI-1" ) +A2G_Blue:SetSquadronOverhead( "SQ-HELO-BAI-1", 0.5 ) +A2G_Blue:SetSquadronGrouping( "SQ-HELO-BAI-1", 4 ) + +A2G_Blue:SetSquadron( "SQ-HELO-BAI-2", AIRBASE.Caucasus.Sukhumi_Babushara, { "A2G-DEFENSE-HELO-004", "A2G-DEFENSE-HELO-005", "A2G-DEFENSE-HELO-006" }, 20 ) +A2G_Blue:SetSquadronBai( "SQ-HELO-BAI-2", 200, 280, 1500, 2000 ) +A2G_Blue:SetSquadronTakeoffInAir( "SQ-HELO-BAI-2", 1000 ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingNearAirbase( "SQ-HELO-BAI-2" ) +A2G_Blue:SetSquadronOverhead( "SQ-HELO-BAI-2", 0.75 ) +A2G_Blue:SetSquadronGrouping( "SQ-HELO-BAI-2", 4 ) + +A2G_Blue:SetSquadron( "SQ-SEAD", AIRBASE.Caucasus.Gudauta, { "A2G-DEFENSE-SU-25T-SEAD" }, 10 ) +A2G_Blue:SetSquadronSead( "SQ-SEAD", 700, 1100, 2500, 4000 ) +A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-SEAD" ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingAtRunway( "SQ-SEAD" ) +A2G_Blue:SetSquadronOverhead( "SQ-SEAD", 1 ) +A2G_Blue:SetSquadronGrouping( "SQ-SEAD", 2 ) + +A2G_Blue:SetSquadron( "SQ-AIR-BAI", AIRBASE.Caucasus.Kobuleti, { "A2G-DEFENSE-A-10C" }, 6 ) +A2G_Blue:SetSquadronBai( "SQ-AIR-BAI", 600, 900, 1000, 2000 ) +A2G_Blue:SetSquadronTakeoffFromParkingHot( "SQ-AIR-BAI" ) -- altitude in meters when spawning in the air. +A2G_Blue:SetSquadronLandingAtRunway( "SQ-AIR-BAI" ) +A2G_Blue:SetSquadronOverhead( "SQ-AIR-BAI", 0.75 ) +A2G_Blue:SetSquadronBaiPatrol( "SQ-AIR-BAI", ZONE:New( "PatrolZone" ), 2000, 3000, 600, 800, 1000, 1400 ) +A2G_Blue:SetSquadronPatrolInterval( "SQ-AIR-BAI", 4, 30, 60, 1, "BAI" ) +A2G_Blue:SetSquadronGrouping( "SQ-AIR-BAI", 4 ) + + +-- A2G task dispatcher + +Command_Blue = COMMANDCENTER:New( GROUP:FindByName( "NATO HQ" ), "NATO HQ" ) + +Mission_Blue = MISSION:New( Command_Blue, "Invasion", "High", "Eliminate 5 targets", coalition.side.BLUE ) + +Players_Blue = SET_GROUP:New():FilterPrefixes( { "NATO Player" } ):FilterStart() + A2G_Task_Blue = TASK_A2G_DISPATCHER:New( Mission_Blue, Players_Blue, Detection_Blue ) \ No newline at end of file diff --git a/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-001 - Detection and Engage/AID-A2G-001 - Detection and Engage.lua b/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-001 - Detection and Engage/AID-A2G-001 - Detection and Engage.lua index ebd429c54c..4f1264ed40 100644 --- a/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-001 - Detection and Engage/AID-A2G-001 - Detection and Engage.lua +++ b/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-001 - Detection and Engage/AID-A2G-001 - Detection and Engage.lua @@ -1,56 +1,56 @@ ---- Detect and attack a set of enemy units. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -local DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -local Detection = DETECTION_AREAS:New( DetectionSetGroup, 5000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- The Command Center (HQ) is the defense point and will also handle the communication to the coalition. -local HQ_Group = GROUP:FindByName( "HQ" ) -local HQ_CC = COMMANDCENTER:New( HQ_Group, "HQ" ) - --- The HQ is the defense point, so this point will be defended. -A2GDispatcher:AddDefenseCoordinate( "HQ", HQ_Group:GetCoordinate() ) -A2GDispatcher:SetDefenseReactivityHigh() -- High defense reactivity. So far proximity of a threat will trigger a defense action. -A2GDispatcher:SetDefenseRadius( 200000 ) -- Defense radius wide enough to also trigger defenses far away. - --- Communication to the players within the coalition. The HQ services the communication of the defense actions. -A2GDispatcher:SetCommandCenter( HQ_CC ) - --- Show a tactical display. -A2GDispatcher:SetTacticalDisplay( true ) - - --- Setup the squadrons. - -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCas2( "Maykop CAS", 200, 250, 300, 500, "RADIO" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronBai2( "Maykop BAI", 200, 250, 300, 500, "RADIO" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) - -A2GDispatcher:SetSquadron( "Krasnodar", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "CCCP SU-25TM" }, 10 ) -A2GDispatcher:SetSquadronSead2( "Krasnodar", 600, 800, 2000, 2000, "RADIO" ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Krasnodar" ) -A2GDispatcher:SetSquadronOverhead( "Krasnodar", 0.2 ) - - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Krasnodar", 10 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +local DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +local Detection = DETECTION_AREAS:New( DetectionSetGroup, 5000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- The Command Center (HQ) is the defense point and will also handle the communication to the coalition. +local HQ_Group = GROUP:FindByName( "HQ" ) +local HQ_CC = COMMANDCENTER:New( HQ_Group, "HQ" ) + +-- The HQ is the defense point, so this point will be defended. +A2GDispatcher:AddDefenseCoordinate( "HQ", HQ_Group:GetCoordinate() ) +A2GDispatcher:SetDefenseReactivityHigh() -- High defense reactivity. So far proximity of a threat will trigger a defense action. +A2GDispatcher:SetDefenseRadius( 200000 ) -- Defense radius wide enough to also trigger defenses far away. + +-- Communication to the players within the coalition. The HQ services the communication of the defense actions. +A2GDispatcher:SetCommandCenter( HQ_CC ) + +-- Show a tactical display. +A2GDispatcher:SetTacticalDisplay( true ) + + +-- Setup the squadrons. + +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCas2( "Maykop CAS", 200, 250, 300, 500, "RADIO" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronBai2( "Maykop BAI", 200, 250, 300, 500, "RADIO" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.25 ) + +A2GDispatcher:SetSquadron( "Krasnodar", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "CCCP SU-25TM" }, 10 ) +A2GDispatcher:SetSquadronSead2( "Krasnodar", 600, 800, 2000, 2000, "RADIO" ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Krasnodar" ) +A2GDispatcher:SetSquadronOverhead( "Krasnodar", 0.2 ) + + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Krasnodar", 10 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-002 - Patrol during Detection and Engage/AID-A2G-002 - Patrol during Detection and Engage.lua b/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-002 - Patrol during Detection and Engage/AID-A2G-002 - Patrol during Detection and Engage.lua index 19dbf086bd..029cf33756 100644 --- a/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-002 - Patrol during Detection and Engage/AID-A2G-002 - Patrol during Detection and Engage.lua +++ b/AI/AI_A2G_Dispatcher_API_v2/AID-A2G-002 - Patrol during Detection and Engage/AID-A2G-002 - Patrol during Detection and Engage.lua @@ -1,66 +1,66 @@ ---- Detect and attack a set of enemy units using helicopters. --- Name: AID-A2G-001 - Detection and Attack Helicopters --- Author: FlightControl --- Date Created: 02 Nov 2018 - --- Define a SET_GROUP object that builds a collection of groups that define the recce network. --- Here we build the network with all the groups that have a name starting with CCCP Recce. -local DetectionSetGroup = SET_GROUP:New() -DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) -DetectionSetGroup:FilterStart() - -local Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) - --- Setup the A2A dispatcher, and initialize it. -A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) - --- The Command Center (HQ) is the defense point and will also handle the communication to the coalition. -local HQ_Group = GROUP:FindByName( "HQ" ) -local HQ_CC = COMMANDCENTER:New( HQ_Group, "HQ" ) - --- Add defense coordinates. -A2GDispatcher:AddDefenseCoordinate( "HQ", HQ_Group:GetCoordinate() ) -A2GDispatcher:SetDefenseReactivityHigh() -- High defense reactivity. So far proximity of a threat will trigger a defense action. -A2GDispatcher:SetDefenseRadius( 200000 ) -- Defense radius wide enough to also trigger defenses far away. - --- Communication to the players within the coalition. The HQ services the communication of the defense actions. -A2GDispatcher:SetCommandCenter( HQ_CC ) - --- Show a tactical display. -A2GDispatcher:SetTacticalDisplay( true ) - - --- Setup the patrols. - --- The patrol zone. -local PatrolZone = ZONE:New( "PatrolZone" ) - - --- SEADing from Krasnodar. -A2GDispatcher:SetSquadron( "Krasnodar", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "CCCP SU-25TM" }, 10 ) -A2GDispatcher:SetSquadronSeadPatrol2( "Krasnodar", PatrolZone, 500, 550, 2000, 2000, "BARO", 750, 800, 30, 30, "RADIO" ) -- New API -A2GDispatcher:SetSquadronSeadPatrolInterval( "Krasnodar", 2, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Krasnodar" ) -A2GDispatcher:SetSquadronOverhead( "Krasnodar", 0.2 ) - - --- Close Air Support from the CAS farp. -A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) -A2GDispatcher:SetSquadronCasPatrol2( "Maykop CAS", PatrolZone, 50, 80, 600, 700, "BARO", 200, 230, 30, 30, "RADIO" ) -- New API -A2GDispatcher:SetSquadronCasPatrolInterval( "Maykop CAS", 2, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) -A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) - --- Battlefield Air Interdiction from the BAI farp. -A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP MIL-8MTV" }, 10 ) -A2GDispatcher:SetSquadronBaiPatrol2( "Maykop BAI", PatrolZone, 50, 80, 600, 700, "BARO", 200, 230, 800, 900, "RADIO" ) -- New API -A2GDispatcher:SetSquadronBaiPatrolInterval( "Maykop BAI", 5, 30, 60, 1 ) -A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) -A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.75 ) - --- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. --- This to prevent helicopters to clutter. --- Each helicopter group is taking off the FARP in hot start. -A2GDispatcher:SetSquadronTakeoffInterval( "Krasnodar", 10 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) -A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) +--- Detect and attack a set of enemy units using helicopters. +-- Name: AID-A2G-001 - Detection and Attack Helicopters +-- Author: FlightControl +-- Date Created: 02 Nov 2018 + +-- Define a SET_GROUP object that builds a collection of groups that define the recce network. +-- Here we build the network with all the groups that have a name starting with CCCP Recce. +local DetectionSetGroup = SET_GROUP:New() +DetectionSetGroup:FilterPrefixes( { "CCCP Recce" } ) +DetectionSetGroup:FilterStart() + +local Detection = DETECTION_AREAS:New( DetectionSetGroup, 1000 ) + +-- Setup the A2A dispatcher, and initialize it. +A2GDispatcher = AI_A2G_DISPATCHER:New( Detection ) + +-- The Command Center (HQ) is the defense point and will also handle the communication to the coalition. +local HQ_Group = GROUP:FindByName( "HQ" ) +local HQ_CC = COMMANDCENTER:New( HQ_Group, "HQ" ) + +-- Add defense coordinates. +A2GDispatcher:AddDefenseCoordinate( "HQ", HQ_Group:GetCoordinate() ) +A2GDispatcher:SetDefenseReactivityHigh() -- High defense reactivity. So far proximity of a threat will trigger a defense action. +A2GDispatcher:SetDefenseRadius( 200000 ) -- Defense radius wide enough to also trigger defenses far away. + +-- Communication to the players within the coalition. The HQ services the communication of the defense actions. +A2GDispatcher:SetCommandCenter( HQ_CC ) + +-- Show a tactical display. +A2GDispatcher:SetTacticalDisplay( true ) + + +-- Setup the patrols. + +-- The patrol zone. +local PatrolZone = ZONE:New( "PatrolZone" ) + + +-- SEADing from Krasnodar. +A2GDispatcher:SetSquadron( "Krasnodar", AIRBASE.Caucasus.Krasnodar_Pashkovsky, { "CCCP SU-25TM" }, 10 ) +A2GDispatcher:SetSquadronSeadPatrol2( "Krasnodar", PatrolZone, 500, 550, 2000, 2000, "BARO", 750, 800, 30, 30, "RADIO" ) -- New API +A2GDispatcher:SetSquadronSeadPatrolInterval( "Krasnodar", 2, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Krasnodar" ) +A2GDispatcher:SetSquadronOverhead( "Krasnodar", 0.2 ) + + +-- Close Air Support from the CAS farp. +A2GDispatcher:SetSquadron( "Maykop CAS", "CAS", { "CCCP KA-50" }, 10 ) +A2GDispatcher:SetSquadronCasPatrol2( "Maykop CAS", PatrolZone, 50, 80, 600, 700, "BARO", 200, 230, 30, 30, "RADIO" ) -- New API +A2GDispatcher:SetSquadronCasPatrolInterval( "Maykop CAS", 2, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop CAS" ) +A2GDispatcher:SetSquadronOverhead( "Maykop CAS", 0.25 ) + +-- Battlefield Air Interdiction from the BAI farp. +A2GDispatcher:SetSquadron( "Maykop BAI", "BAI", { "CCCP MIL-8MTV" }, 10 ) +A2GDispatcher:SetSquadronBaiPatrol2( "Maykop BAI", PatrolZone, 50, 80, 600, 700, "BARO", 200, 230, 800, 900, "RADIO" ) -- New API +A2GDispatcher:SetSquadronBaiPatrolInterval( "Maykop BAI", 5, 30, 60, 1 ) +A2GDispatcher:SetSquadronTakeoffFromParkingHot( "Maykop BAI" ) +A2GDispatcher:SetSquadronOverhead( "Maykop BAI", 0.75 ) + +-- We set for each squadron a takeoff interval, as each helicopter will launch from a FARP. +-- This to prevent helicopters to clutter. +-- Each helicopter group is taking off the FARP in hot start. +A2GDispatcher:SetSquadronTakeoffInterval( "Krasnodar", 10 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop CAS", 60 ) +A2GDispatcher:SetSquadronTakeoffInterval( "Maykop BAI", 60 ) diff --git a/AI/AI_Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua b/AI/AI_Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua index c0b085a927..d9dcde3c28 100644 --- a/AI/AI_Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua +++ b/AI/AI_Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua @@ -1,43 +1,43 @@ --- Name: AIB-002 - Patrol AI.lua --- Author: FlightControl --- Date Created: 7 December 2016 --- --- # Situation: --- --- For the red coalition, 2 client slots are foreseen. --- For those players that have not joined the mission, red AI is spawned. --- The red AI should start patrolling an area until fuel is empty and return to the home base. --- --- # Test cases: --- --- 1. If no player is logging into the red slots, 2 red AI planes should be alive. --- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. --- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. --- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa. --- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa. - --- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. -RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) - --- Define the SPAWN object for the red AI plane template. --- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. --- If a blocked plane exists, this red plane will be ReSpawned. -RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) - --- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. -RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) - -local PatrolZones = {} - -function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - - local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) - local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) - - - PatrolZones[AIGroup] = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 ) - PatrolZones[AIGroup]:ManageFuel( 0.2, 60 ) - PatrolZones[AIGroup]:SetControllable( AIGroup ) - PatrolZones[AIGroup]:__Start( 5 ) - -end +-- Name: AIB-002 - Patrol AI.lua +-- Author: FlightControl +-- Date Created: 7 December 2016 +-- +-- # Situation: +-- +-- For the red coalition, 2 client slots are foreseen. +-- For those players that have not joined the mission, red AI is spawned. +-- The red AI should start patrolling an area until fuel is empty and return to the home base. +-- +-- # Test cases: +-- +-- 1. If no player is logging into the red slots, 2 red AI planes should be alive. +-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. +-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. +-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa. +-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa. + +-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. +RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) + +-- Define the SPAWN object for the red AI plane template. +-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. +-- If a blocked plane exists, this red plane will be ReSpawned. +RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) + +-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. +RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) + +local PatrolZones = {} + +function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + + local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) + local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) + + + PatrolZones[AIGroup] = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 ) + PatrolZones[AIGroup]:ManageFuel( 0.2, 60 ) + PatrolZones[AIGroup]:SetControllable( AIGroup ) + PatrolZones[AIGroup]:__Start( 5 ) + +end diff --git a/AI/AI_Balancer/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua b/AI/AI_Balancer/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua index 2f4a137abf..8e50e3e5ca 100644 --- a/AI/AI_Balancer/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua +++ b/AI/AI_Balancer/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.lua @@ -1,24 +1,24 @@ -RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) -RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) - -RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart() -RU_AirbasesSet:Flush() -RU_AI_Balancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet ) - - -US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" ) -US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 ) -US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn ) - ---RU_AI_Balancer:ReturnToHomeAirbase( 10000 ) - ---local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" ) ---local PatrolZoneBlue = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) ---local PatrolZoneB = AI_PATROL_ZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) ---US_AI_Balancer:SetPatrolZone( PatrolZoneB ) --- ---local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Red" ) ---local PatrolZoneRed = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) ---local PatrolZoneR = AI_PATROL_ZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) ---RU_AI_Balancer:SetPatrolZone( PatrolZoneR ) +RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) +RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) +RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) + +RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart() +RU_AirbasesSet:Flush() +RU_AI_Balancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet ) + + +US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" ) +US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 ) +US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn ) + +--RU_AI_Balancer:ReturnToHomeAirbase( 10000 ) + +--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" ) +--local PatrolZoneBlue = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) +--local PatrolZoneB = AI_PATROL_ZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) +--US_AI_Balancer:SetPatrolZone( PatrolZoneB ) +-- +--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Red" ) +--local PatrolZoneRed = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) +--local PatrolZoneR = AI_PATROL_ZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 ) +--RU_AI_Balancer:SetPatrolZone( PatrolZoneR ) diff --git a/AI/AI_Balancer/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua b/AI/AI_Balancer/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua index 07efab0d00..79299c11e3 100644 --- a/AI/AI_Balancer/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua +++ b/AI/AI_Balancer/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.lua @@ -1,47 +1,47 @@ --- Name: AIB-004 - Respawn Test when Destroyed.lua --- Author: FlightControl --- Date Created: 7 January 2017 --- --- # Situation: --- --- For the red coalition, 2 client slots are foreseen. --- For those players that have not joined the mission, red AI is spawned. --- The red AI should start patrolling an area. --- --- The blue side has SAMs nearby. --- Once the red AI takes off, the red AI is attacked by the blue SAMs. --- Red AI should be killed and once that happens, a Respawn of the group should happen! --- The Respawn happens through the InitCleanUp() API of SPAWN. --- --- # Test cases: --- --- 1. If no player is logging into the red slots, 2 red AI planes should be alive. --- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. --- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. --- 4. Monitor that once a red AI is destroyed, that it ReSpawns... - - --- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. -RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) - --- Define the SPAWN object for the red AI plane template. --- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. --- If a blocked plane exists, this red plane will be ReSpawned. -RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) - --- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. -RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) - -function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - - local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) - local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) - - - local Patrol = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 ) - Patrol:ManageFuel( 0.2, 60 ) - Patrol:SetControllable( AIGroup ) - Patrol:__Start( 5 ) - -end - +-- Name: AIB-004 - Respawn Test when Destroyed.lua +-- Author: FlightControl +-- Date Created: 7 January 2017 +-- +-- # Situation: +-- +-- For the red coalition, 2 client slots are foreseen. +-- For those players that have not joined the mission, red AI is spawned. +-- The red AI should start patrolling an area. +-- +-- The blue side has SAMs nearby. +-- Once the red AI takes off, the red AI is attacked by the blue SAMs. +-- Red AI should be killed and once that happens, a Respawn of the group should happen! +-- The Respawn happens through the InitCleanUp() API of SPAWN. +-- +-- # Test cases: +-- +-- 1. If no player is logging into the red slots, 2 red AI planes should be alive. +-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. +-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. +-- 4. Monitor that once a red AI is destroyed, that it ReSpawns... + + +-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. +RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) + +-- Define the SPAWN object for the red AI plane template. +-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. +-- If a blocked plane exists, this red plane will be ReSpawned. +RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) + +-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. +RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) + +function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + + local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) + local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) + + + local Patrol = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:__Start( 5 ) + +end + diff --git a/AI/AI_Balancer/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua b/AI/AI_Balancer/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua index f0253d5e94..c4e7e5ad2f 100644 --- a/AI/AI_Balancer/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua +++ b/AI/AI_Balancer/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.lua @@ -1,51 +1,51 @@ --- Name: AIB-005 - Patrol AI and Randomize Zones --- Author: FlightControl --- Date Created: 10 Jan 2016 --- --- # Situation: --- --- For the red coalition, 2 client slots are foreseen. --- For those players that have not joined the mission, red AI is spawned. --- The red AI should start patrolling an area until fuel is empty and return to the home base. --- For each AI being spawned, ensure that they fly to a random zone defined within the mission editor. --- Right now there are two patrol zones defined, so the AI should start patrolliing in one of these zones. --- --- # Test cases: --- --- 1. If no player is logging into the red slots, 2 red AI planes should be alive. --- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. --- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. --- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa. --- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa. --- 6. Ensure that you see the AI patrol in one of the two zones ... - --- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. -RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) - --- Define the SPAWN object for the red AI plane template. --- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. --- If a blocked plane exists, this red plane will be ReSpawned. -RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) - --- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. -RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) - --- Create the first polygon zone ... -PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" ) -PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 ) - --- Create the second polygon zone ... -PatrolZoneGroup2 = GROUP:FindByName( "PatrolZone2" ) -PatrolZone2 = ZONE_POLYGON:New( "PatrolZone2", PatrolZoneGroup2 ) - --- Now, create an array of these zones ... -PatrolZoneArray = { PatrolZone1, PatrolZone2 } - -function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - - local Patrol = AI_PATROL_ZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 ) - Patrol:ManageFuel( 0.2, 60 ) - Patrol:SetControllable( AIGroup ) - Patrol:Start() - -end +-- Name: AIB-005 - Patrol AI and Randomize Zones +-- Author: FlightControl +-- Date Created: 10 Jan 2016 +-- +-- # Situation: +-- +-- For the red coalition, 2 client slots are foreseen. +-- For those players that have not joined the mission, red AI is spawned. +-- The red AI should start patrolling an area until fuel is empty and return to the home base. +-- For each AI being spawned, ensure that they fly to a random zone defined within the mission editor. +-- Right now there are two patrol zones defined, so the AI should start patrolliing in one of these zones. +-- +-- # Test cases: +-- +-- 1. If no player is logging into the red slots, 2 red AI planes should be alive. +-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base. +-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base. +-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa. +-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa. +-- 6. Ensure that you see the AI patrol in one of the two zones ... + +-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. +RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) + +-- Define the SPAWN object for the red AI plane template. +-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. +-- If a blocked plane exists, this red plane will be ReSpawned. +RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) + +-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. +RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) + +-- Create the first polygon zone ... +PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" ) +PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 ) + +-- Create the second polygon zone ... +PatrolZoneGroup2 = GROUP:FindByName( "PatrolZone2" ) +PatrolZone2 = ZONE_POLYGON:New( "PatrolZone2", PatrolZoneGroup2 ) + +-- Now, create an array of these zones ... +PatrolZoneArray = { PatrolZone1, PatrolZone2 } + +function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + + local Patrol = AI_PATROL_ZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:Start() + +end diff --git a/AI/AI_Balancer/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua b/AI/AI_Balancer/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua index 31574814df..530f718fc4 100644 --- a/AI/AI_Balancer/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua +++ b/AI/AI_Balancer/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.lua @@ -1,43 +1,43 @@ --- Name: AIB-005 - Patrol AI and Randomize Zones --- Author: FlightControl --- Date Created: 10 Jan 2016 --- --- # Situation: --- --- For the red coalition, 2 client slots are foreseen. --- For those players that have not joined the mission, red AI is spawned. --- You'll notice a lot of AI is being spawned, as there are a lot of slots... --- If the SPAWN API :InitCleanUp( secs ) is NOT used, you'll notice that the planes block each other on the runway. --- After a short period of time, nothing will move anymore... --- The :InitCleanUp( seconds ) API of the SPAWN class ensure that any AI that is parked longer than the --- specified amount of seconds, is respawned back at the parking position. --- This frees up the other planes departing, and the airbase is in this way decluttered... --- --- # Test cases: --- --- 1. Observe the de-cluttering of planes at Krymsk. --- 2. Play with the InitCleanUp API of the SPAWN class, extende the amount of seconds to find the optimal setting. - --- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. -RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) - --- Define the SPAWN object for the red AI plane template. --- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. --- If a blocked plane exists, this red plane will be ReSpawned. -RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) - --- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. -RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) - --- Create the first polygon zone ... -PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" ) -PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 ) - -function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - - local Patrol = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) - Patrol:ManageFuel( 0.2, 60 ) - Patrol:SetControllable( AIGroup ) - Patrol:__Start( 5 ) - -end +-- Name: AIB-005 - Patrol AI and Randomize Zones +-- Author: FlightControl +-- Date Created: 10 Jan 2016 +-- +-- # Situation: +-- +-- For the red coalition, 2 client slots are foreseen. +-- For those players that have not joined the mission, red AI is spawned. +-- You'll notice a lot of AI is being spawned, as there are a lot of slots... +-- If the SPAWN API :InitCleanUp( secs ) is NOT used, you'll notice that the planes block each other on the runway. +-- After a short period of time, nothing will move anymore... +-- The :InitCleanUp( seconds ) API of the SPAWN class ensure that any AI that is parked longer than the +-- specified amount of seconds, is respawned back at the parking position. +-- This frees up the other planes departing, and the airbase is in this way decluttered... +-- +-- # Test cases: +-- +-- 1. Observe the de-cluttering of planes at Krymsk. +-- 2. Play with the InitCleanUp API of the SPAWN class, extende the amount of seconds to find the optimal setting. + +-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup. +RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" ) + +-- Define the SPAWN object for the red AI plane template. +-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off. +-- If a blocked plane exists, this red plane will be ReSpawned. +RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) + +-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. +RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) + +-- Create the first polygon zone ... +PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" ) +PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 ) + +function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + + local Patrol = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:__Start( 5 ) + +end diff --git a/AI/AI_Balancer/AIB-007 - All Airports/AIB-007 - AI Balancers For all airports and both coalitions.lua b/AI/AI_Balancer/AIB-007 - All Airports/AIB-007 - AI Balancers For all airports and both coalitions.lua index d6cc8a8f3b..9e3091a6a8 100644 --- a/AI/AI_Balancer/AIB-007 - All Airports/AIB-007 - AI Balancers For all airports and both coalitions.lua +++ b/AI/AI_Balancer/AIB-007 - All Airports/AIB-007 - AI Balancers For all airports and both coalitions.lua @@ -1,163 +1,163 @@ --- Name: AIB-007 - AI Balancers For all airports and both coalitions --- Author: Delta99 --- Date Created: 11 Feb 2017 --- --- Originally created to solve issues jg7xman (from Moose Slack group) was having in creating --- AI_BALANCER across multiple airbases. - --- # Situation: --- --- AI_BALANCERS created per airbase for both coalitions. Mutiple patrol zones are created --- for each side. Each flight that is created by AI_BALANCER will pick a random patrol zone --- to patrol. - --- # Test Cases --- --- 1. Observe at least 1 flight spawning and taking off from each airbase. --- 2. Each flight patrols randomly in one of its sides zones. --- 3. AI will respawn after killed. --- 4. Additional client slots are available at Sochi. If players don't take a slot there --- will be more than one AI taking off from Sochi. --- 5. Batumi contains a flight of 3 units rather than just 1 like most of the rest of the airbases. --- 6. Watch the coalition AI clash and kill each other. - --- Create the Red Patrol Zone Array - --- This zone array will be used in the AI_BALANCER to randomize the patrol --- zone that each spawned group will patrol - -RedPatrolZone = {} -RedPatrolZone[1] = ZONE:New( "RedPatrolZone1" ) -RedPatrolZone[2] = ZONE:New( "RedPatrolZone2" ) -RedPatrolZone[3] = ZONE:New( "RedPatrolZone3" ) -RedPatrolZone[4] = ZONE:New( "RedPatrolZone4" ) -RedPatrolZone[5] = ZONE:New( "RedPatrolZone5" ) -RedPatrolZone[6] = ZONE:New( "RedPatrolZone6" ) - --- Russian CAP Aircraft - --- These are the aircraft created in the mission editor that the AI will spawn --- with replacing any CLIENT created aircraft in the mission that a human --- player does not take. - -RU_PlanesSpawn = {} -RU_PlanesSpawn[1] = SPAWN:New( "RU CAP Anapa AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[2] = SPAWN:New( "RU CAP Beslan AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[3] = SPAWN:New( "RU CAP Gelendzhik AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[4] = SPAWN:New( "RU CAP Krasnodar Center AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[5] = SPAWN:New( "RU CAP Krasnodar Pashkovsky AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[6] = SPAWN:New( "RU CAP Krymsk AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[7] = SPAWN:New( "RU CAP Maykop AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[8] = SPAWN:New( "RU CAP Mineralnye Vody AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[9] = SPAWN:New( "RU CAP Mozdok AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[10] = SPAWN:New( "RU CAP Nalchik AB" ):InitCleanUp( 45 ) -RU_PlanesSpawn[11] = SPAWN:New( "RU CAP Novorossiysk AB" ):InitCleanUp( 45 ) - --- Russian Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot) - --- If you want more client slots per airbase that you want AI to be able to take control of then --- name them with the prefixes below and they will be picked up automatically by FilterPrevixes. --- --- For example, if you want another Client slot available at Anapa name it "RU CLIENT Anapa AB 2". --- The code here does not need to be changed. Only an addition in the mission editor. An example --- of this can be found on the USA side at Sochi AB. - -RU_PlanesClientSet = {} -RU_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Anapa AB") -RU_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Beslan AB") -RU_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Gelendzhik AB") -RU_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Center AB") -RU_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Pashkovsky AB") -RU_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krymsk AB") -RU_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Maykop AB") -RU_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mineralnye Vody AB") -RU_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mozdok AB") -RU_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Nalchik AB") -RU_PlanesClientSet[11] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Novorossiysk AB") - --- We setup an array to store all the AI_BALANCERS that are going to be created. Basically one --- per airbase. We loop through and create an AI_BALANCER as well as a separate OnAfterSpawned --- function for each. The Patrol Zone is randomized in the first parameter to AI_PATROL_ZONE:New() --- call. This is done for each of the AI_BALANCERS. To add more patrol zones, just define them in --- the mission editor and add into the array above. Code here does not need to be changed. The --- table.getn(RedPatrolZone) gets the number of elements in the RedPatrolZone array so that all --- of them are included to pick randomly. - - -RU_AI_Balancer = {} -for i=1, 11 do - RU_AI_Balancer[i] = AI_BALANCER:New(RU_PlanesClientSet[i], RU_PlanesSpawn[i]) - - -- We set a local variable within the for loop to the AI_BALANCER that was just created. - -- I couldn't get RU_AI_BALANCER[i]:OnAfterSpawn to be recognized so this is just pointing - -- curAIBalancer to the relevant RU_AI_BALANCER array item for each loop. - - -- So in this case there are essentially 11 OnAfterSpawned functions defined and handled. - - local curAIBalancer = RU_AI_Balancer[i] - function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - local Patrol = AI_PATROL_ZONE:New( RedPatrolZone[math.random( 1, table.getn(RedPatrolZone))], 1500, 5500, 700, 1400 ) - Patrol:ManageFuel( 0.2, 60 ) - Patrol:SetControllable( AIGroup ) - Patrol:Start() - end -end - --- US / Blue side is setup pretty much identically to the RU side above. Same detailed comments --- above apply here. The main difference here is 10 airbases instead of 11. - --- Another difference is additional client slots at Sochi and a group defined at Batumi with --- more than 1 unit per group (flight of 3 units). This is just to show that you can have more --- client slots per airbase and more units in a single group that the AI will control. I think --- this will also allow you to fly lead with AI on your wing or you can fly wing with an AI --- leader. - --- Create the Blue Patrol Zone Array -BluePatrolZone = {} -BluePatrolZone[1] = ZONE:New( "BluePatrolZone1") -BluePatrolZone[2] = ZONE:New( "BluePatrolZone2") -BluePatrolZone[3] = ZONE:New( "BluePatrolZone3") -BluePatrolZone[4] = ZONE:New( "BluePatrolZone4") -BluePatrolZone[5] = ZONE:New( "BluePatrolZone5") -BluePatrolZone[6] = ZONE:New( "BluePatrolZone6") - ---United States CAP Aircraft (these are used as templates for AI) - -US_PlanesSpawn = {} -US_PlanesSpawn[1] = SPAWN:New( "US CAP Batumi AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[2] = SPAWN:New( "US CAP Gudauta AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[3] = SPAWN:New( "US CAP Kobuleti AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[4] = SPAWN:New( "US CAP Kutaisi AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[5] = SPAWN:New( "US CAP Senaki AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[6] = SPAWN:New( "US CAP Sochi AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[7] = SPAWN:New( "US CAP Soganlug AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[8] = SPAWN:New( "US CAP Sukhumi AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[9] = SPAWN:New( "US CAP Vaziani AB" ):InitCleanUp( 45 ) -US_PlanesSpawn[10] = SPAWN:New( "US CAP Tbilisi AB" ):InitCleanUp( 45 ) - ---United States Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot) - -US_PlanesClientSet = {} -US_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("US CLIENT Batumi AB") -US_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("US CLIENT Gudauta AB") -US_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kobuleti AB") -US_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kutaisi AB") -US_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("US CLIENT Senaki AB") -US_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sochi AB") -US_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("US CLIENT Soganlug AB") -US_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sukhumi AB") -US_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("US CLIENT Vaziani AB") -US_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("US CLIENT Tbilisi AB") - -US_AI_Balancer = {} -for i=1, 10 do - US_AI_Balancer[i] = AI_BALANCER:New( US_PlanesClientSet[i], US_PlanesSpawn[i] ) - - local curAIBalancer = US_AI_Balancer[i] - function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) - local Patrol = AI_PATROL_ZONE:New( BluePatrolZone[math.random( 1, table.getn(BluePatrolZone))], 1500, 5500, 700, 1400 ) - Patrol:ManageFuel( 0.2, 60 ) - Patrol:SetControllable( AIGroup ) - Patrol:Start() - end -end +-- Name: AIB-007 - AI Balancers For all airports and both coalitions +-- Author: Delta99 +-- Date Created: 11 Feb 2017 +-- +-- Originally created to solve issues jg7xman (from Moose Slack group) was having in creating +-- AI_BALANCER across multiple airbases. + +-- # Situation: +-- +-- AI_BALANCERS created per airbase for both coalitions. Mutiple patrol zones are created +-- for each side. Each flight that is created by AI_BALANCER will pick a random patrol zone +-- to patrol. + +-- # Test Cases +-- +-- 1. Observe at least 1 flight spawning and taking off from each airbase. +-- 2. Each flight patrols randomly in one of its sides zones. +-- 3. AI will respawn after killed. +-- 4. Additional client slots are available at Sochi. If players don't take a slot there +-- will be more than one AI taking off from Sochi. +-- 5. Batumi contains a flight of 3 units rather than just 1 like most of the rest of the airbases. +-- 6. Watch the coalition AI clash and kill each other. + +-- Create the Red Patrol Zone Array + +-- This zone array will be used in the AI_BALANCER to randomize the patrol +-- zone that each spawned group will patrol + +RedPatrolZone = {} +RedPatrolZone[1] = ZONE:New( "RedPatrolZone1" ) +RedPatrolZone[2] = ZONE:New( "RedPatrolZone2" ) +RedPatrolZone[3] = ZONE:New( "RedPatrolZone3" ) +RedPatrolZone[4] = ZONE:New( "RedPatrolZone4" ) +RedPatrolZone[5] = ZONE:New( "RedPatrolZone5" ) +RedPatrolZone[6] = ZONE:New( "RedPatrolZone6" ) + +-- Russian CAP Aircraft + +-- These are the aircraft created in the mission editor that the AI will spawn +-- with replacing any CLIENT created aircraft in the mission that a human +-- player does not take. + +RU_PlanesSpawn = {} +RU_PlanesSpawn[1] = SPAWN:New( "RU CAP Anapa AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[2] = SPAWN:New( "RU CAP Beslan AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[3] = SPAWN:New( "RU CAP Gelendzhik AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[4] = SPAWN:New( "RU CAP Krasnodar Center AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[5] = SPAWN:New( "RU CAP Krasnodar Pashkovsky AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[6] = SPAWN:New( "RU CAP Krymsk AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[7] = SPAWN:New( "RU CAP Maykop AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[8] = SPAWN:New( "RU CAP Mineralnye Vody AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[9] = SPAWN:New( "RU CAP Mozdok AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[10] = SPAWN:New( "RU CAP Nalchik AB" ):InitCleanUp( 45 ) +RU_PlanesSpawn[11] = SPAWN:New( "RU CAP Novorossiysk AB" ):InitCleanUp( 45 ) + +-- Russian Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot) + +-- If you want more client slots per airbase that you want AI to be able to take control of then +-- name them with the prefixes below and they will be picked up automatically by FilterPrevixes. +-- +-- For example, if you want another Client slot available at Anapa name it "RU CLIENT Anapa AB 2". +-- The code here does not need to be changed. Only an addition in the mission editor. An example +-- of this can be found on the USA side at Sochi AB. + +RU_PlanesClientSet = {} +RU_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Anapa AB") +RU_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Beslan AB") +RU_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Gelendzhik AB") +RU_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Center AB") +RU_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Pashkovsky AB") +RU_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krymsk AB") +RU_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Maykop AB") +RU_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mineralnye Vody AB") +RU_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mozdok AB") +RU_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Nalchik AB") +RU_PlanesClientSet[11] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Novorossiysk AB") + +-- We setup an array to store all the AI_BALANCERS that are going to be created. Basically one +-- per airbase. We loop through and create an AI_BALANCER as well as a separate OnAfterSpawned +-- function for each. The Patrol Zone is randomized in the first parameter to AI_PATROL_ZONE:New() +-- call. This is done for each of the AI_BALANCERS. To add more patrol zones, just define them in +-- the mission editor and add into the array above. Code here does not need to be changed. The +-- table.getn(RedPatrolZone) gets the number of elements in the RedPatrolZone array so that all +-- of them are included to pick randomly. + + +RU_AI_Balancer = {} +for i=1, 11 do + RU_AI_Balancer[i] = AI_BALANCER:New(RU_PlanesClientSet[i], RU_PlanesSpawn[i]) + + -- We set a local variable within the for loop to the AI_BALANCER that was just created. + -- I couldn't get RU_AI_BALANCER[i]:OnAfterSpawn to be recognized so this is just pointing + -- curAIBalancer to the relevant RU_AI_BALANCER array item for each loop. + + -- So in this case there are essentially 11 OnAfterSpawned functions defined and handled. + + local curAIBalancer = RU_AI_Balancer[i] + function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + local Patrol = AI_PATROL_ZONE:New( RedPatrolZone[math.random( 1, table.getn(RedPatrolZone))], 1500, 5500, 700, 1400 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:Start() + end +end + +-- US / Blue side is setup pretty much identically to the RU side above. Same detailed comments +-- above apply here. The main difference here is 10 airbases instead of 11. + +-- Another difference is additional client slots at Sochi and a group defined at Batumi with +-- more than 1 unit per group (flight of 3 units). This is just to show that you can have more +-- client slots per airbase and more units in a single group that the AI will control. I think +-- this will also allow you to fly lead with AI on your wing or you can fly wing with an AI +-- leader. + +-- Create the Blue Patrol Zone Array +BluePatrolZone = {} +BluePatrolZone[1] = ZONE:New( "BluePatrolZone1") +BluePatrolZone[2] = ZONE:New( "BluePatrolZone2") +BluePatrolZone[3] = ZONE:New( "BluePatrolZone3") +BluePatrolZone[4] = ZONE:New( "BluePatrolZone4") +BluePatrolZone[5] = ZONE:New( "BluePatrolZone5") +BluePatrolZone[6] = ZONE:New( "BluePatrolZone6") + +--United States CAP Aircraft (these are used as templates for AI) + +US_PlanesSpawn = {} +US_PlanesSpawn[1] = SPAWN:New( "US CAP Batumi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[2] = SPAWN:New( "US CAP Gudauta AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[3] = SPAWN:New( "US CAP Kobuleti AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[4] = SPAWN:New( "US CAP Kutaisi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[5] = SPAWN:New( "US CAP Senaki AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[6] = SPAWN:New( "US CAP Sochi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[7] = SPAWN:New( "US CAP Soganlug AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[8] = SPAWN:New( "US CAP Sukhumi AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[9] = SPAWN:New( "US CAP Vaziani AB" ):InitCleanUp( 45 ) +US_PlanesSpawn[10] = SPAWN:New( "US CAP Tbilisi AB" ):InitCleanUp( 45 ) + +--United States Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot) + +US_PlanesClientSet = {} +US_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("US CLIENT Batumi AB") +US_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("US CLIENT Gudauta AB") +US_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kobuleti AB") +US_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kutaisi AB") +US_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("US CLIENT Senaki AB") +US_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sochi AB") +US_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("US CLIENT Soganlug AB") +US_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sukhumi AB") +US_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("US CLIENT Vaziani AB") +US_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("US CLIENT Tbilisi AB") + +US_AI_Balancer = {} +for i=1, 10 do + US_AI_Balancer[i] = AI_BALANCER:New( US_PlanesClientSet[i], US_PlanesSpawn[i] ) + + local curAIBalancer = US_AI_Balancer[i] + function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup ) + local Patrol = AI_PATROL_ZONE:New( BluePatrolZone[math.random( 1, table.getn(BluePatrolZone))], 1500, 5500, 700, 1400 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:Start() + end +end diff --git a/AI/AI_Cargo_APC/AIC-APC-000 - APC/AIC-APC-000 - APC.lua b/AI/AI_Cargo_APC/AIC-APC-000 - APC/AIC-APC-000 - APC.lua index 9c54a2b07c..bda8155a20 100644 --- a/AI/AI_Cargo_APC/AIC-APC-000 - APC/AIC-APC-000 - APC.lua +++ b/AI/AI_Cargo_APC/AIC-APC-000 - APC/AIC-APC-000 - APC.lua @@ -1,20 +1,20 @@ ---- --- Name: AIC-APC-000 - APC --- Author: FlightControl --- Date Created: 26 Mar 2018 --- Date Checked: 01 Jan 2021 --- Working example --- --- A demonstration of the AI_CARGO_APC class. --- This simple example transports Infantry. --- The CARGO_GROUP objects are declared within the mission script. - -local Infantry1 = CARGO_GROUP:New( GROUP:FindByName( "Infantry1" ), "Infantry", "Infantry1", 500, 25 ) -local Infantry2 = CARGO_GROUP:New( GROUP:FindByName( "Infantry2" ), "Infantry", "Infantry2", 500, 25 ) -local Infantry3 = CARGO_GROUP:New( GROUP:FindByName( "Infantry3" ), "Infantry", "Infantry3", 500, 25 ) - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local APC = GROUP:FindByName( "APC" ) -AICargoAPC = AI_CARGO_APC:New( APC, InfantryCargoSet, 500 ) -AICargoAPC:__Pickup( 5 ) - +--- +-- Name: AIC-APC-000 - APC +-- Author: FlightControl +-- Date Created: 26 Mar 2018 +-- Date Checked: 01 Jan 2021 +-- Working example +-- +-- A demonstration of the AI_CARGO_APC class. +-- This simple example transports Infantry. +-- The CARGO_GROUP objects are declared within the mission script. + +local Infantry1 = CARGO_GROUP:New( GROUP:FindByName( "Infantry1" ), "Infantry", "Infantry1", 500, 25 ) +local Infantry2 = CARGO_GROUP:New( GROUP:FindByName( "Infantry2" ), "Infantry", "Infantry2", 500, 25 ) +local Infantry3 = CARGO_GROUP:New( GROUP:FindByName( "Infantry3" ), "Infantry", "Infantry3", 500, 25 ) + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local APC = GROUP:FindByName( "APC" ) +AICargoAPC = AI_CARGO_APC:New( APC, InfantryCargoSet, 500 ) +AICargoAPC:__Pickup( 5 ) + diff --git a/AI/AI_Cargo_APC/AIC-APC-001 - APC with Cargo declared in ME/AIC-APC-001 - APC with Cargo declared in ME.lua b/AI/AI_Cargo_APC/AIC-APC-001 - APC with Cargo declared in ME/AIC-APC-001 - APC with Cargo declared in ME.lua index d142a3b7c3..d278c665ad 100644 --- a/AI/AI_Cargo_APC/AIC-APC-001 - APC with Cargo declared in ME/AIC-APC-001 - APC with Cargo declared in ME.lua +++ b/AI/AI_Cargo_APC/AIC-APC-001 - APC with Cargo declared in ME/AIC-APC-001 - APC with Cargo declared in ME.lua @@ -1,18 +1,18 @@ ---- --- Name: AIC-APC-001 - APC with Cargo declared in ME --- Author: FlightControl --- Date Created: 26 Mar 2018 --- Date Checked: 01 Dec 2021 --- Changed Cargo auto tag from ~ to #, working example --- --- A demonstration of the AI_CARGO_APC class. --- This simple example transports Infantry. --- The cargo is declared with the #CARGO tag in the mission editor. --- So, within the mission, the infantry groups have the name: --- e.g. Infantry1#CARGO(T=Infantry,RR=2000,NR=25) - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local APC = GROUP:FindByName( "APC" ) -AICargoAPC = AI_CARGO_APC:New( APC, InfantryCargoSet, 500 ) -AICargoAPC:__Pickup( 5 ) - +--- +-- Name: AIC-APC-001 - APC with Cargo declared in ME +-- Author: FlightControl +-- Date Created: 26 Mar 2018 +-- Date Checked: 01 Dec 2021 +-- Changed Cargo auto tag from ~ to #, working example +-- +-- A demonstration of the AI_CARGO_APC class. +-- This simple example transports Infantry. +-- The cargo is declared with the #CARGO tag in the mission editor. +-- So, within the mission, the infantry groups have the name: +-- e.g. Infantry1#CARGO(T=Infantry,RR=2000,NR=25) + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local APC = GROUP:FindByName( "APC" ) +AICargoAPC = AI_CARGO_APC:New( APC, InfantryCargoSet, 500 ) +AICargoAPC:__Pickup( 5 ) + diff --git a/AI/AI_Cargo_APC/AIC-APC-002 - APC Move by Game Master/AIC-APC-002 - APC Move by Game Master.lua b/AI/AI_Cargo_APC/AIC-APC-002 - APC Move by Game Master/AIC-APC-002 - APC Move by Game Master.lua index b52a229504..70deb9f3cf 100644 --- a/AI/AI_Cargo_APC/AIC-APC-002 - APC Move by Game Master/AIC-APC-002 - APC Move by Game Master.lua +++ b/AI/AI_Cargo_APC/AIC-APC-002 - APC Move by Game Master/AIC-APC-002 - APC Move by Game Master.lua @@ -1,12 +1,12 @@ ---- --- Name: AIC-APC-002 - APC Move by Game Master --- Author: FlightControl --- Date Created: 26 Mar 2018 --- Date Checked: 01 Jan 2021. Changed ~ to # in ME Group Names. Not sure how this is supposed to work for the Game Master - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() - -local CargoCarrier = GROUP:FindByName( "Carrier" ) - -CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 500 ) - +--- +-- Name: AIC-APC-002 - APC Move by Game Master +-- Author: FlightControl +-- Date Created: 26 Mar 2018 +-- Date Checked: 01 Jan 2021. Changed ~ to # in ME Group Names. Not sure how this is supposed to work for the Game Master + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() + +local CargoCarrier = GROUP:FindByName( "Carrier" ) + +CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 500 ) + diff --git a/AI/AI_Cargo_APC/AIC-APC-003 - APC Troops and Equipment/AIC-APC-003 - APC Troops and Equipment.lua b/AI/AI_Cargo_APC/AIC-APC-003 - APC Troops and Equipment/AIC-APC-003 - APC Troops and Equipment.lua index d2a4e7c08f..be0fa95840 100644 --- a/AI/AI_Cargo_APC/AIC-APC-003 - APC Troops and Equipment/AIC-APC-003 - APC Troops and Equipment.lua +++ b/AI/AI_Cargo_APC/AIC-APC-003 - APC Troops and Equipment/AIC-APC-003 - APC Troops and Equipment.lua @@ -1,14 +1,14 @@ ---- --- Name: AIC-APC-003 - APC Troops and Equipment --- Author: FlightControl --- Date Created: 07 Apr 2018 --- Date Checked: 01 Jan 2021 - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() - -local CargoCarrier = GROUP:FindByName( "Carrier" ) - -CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 350 ) - - - +--- +-- Name: AIC-APC-003 - APC Troops and Equipment +-- Author: FlightControl +-- Date Created: 07 Apr 2018 +-- Date Checked: 01 Jan 2021 + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() + +local CargoCarrier = GROUP:FindByName( "Carrier" ) + +CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 350 ) + + + diff --git a/AI/AI_Cargo_APC/AIC-APC-004 - APC Pickup/AIC-APC-004 - APC Pickup.lua b/AI/AI_Cargo_APC/AIC-APC-004 - APC Pickup/AIC-APC-004 - APC Pickup.lua index 9e6b30f8d8..26b4668d61 100644 --- a/AI/AI_Cargo_APC/AIC-APC-004 - APC Pickup/AIC-APC-004 - APC Pickup.lua +++ b/AI/AI_Cargo_APC/AIC-APC-004 - APC Pickup/AIC-APC-004 - APC Pickup.lua @@ -1,29 +1,29 @@ ---- --- Name: AIC-APC-004 - APC Pickup --- Author: FlightControl --- Date Created: 23 Apr 2018 --- Date Checked: 01 Jan 2021, working example, changed Deploy to async call - -BASE:TraceClass("AI_CARGO_APC") -BASE:TraceOn() - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local APC = GROUP:FindByName( "APC" ) -Cargo_APC = AI_CARGO_APC:New( APC, InfantryCargoSet, 350 ) -Cargo_APC:__Pickup( 1, ZONE:New( "Pickup" ):GetCoordinate() ) - - - ---- Loaded Handler OnAfter for Cargo_APC --- @function [parent=#Cargo_APC] OnAfterLoaded --- @param #Cargo_APC self --- @param Wrapper.Group#GROUP APC --- @param #string From --- @param #string Event --- @param #string To -function Cargo_APC:OnAfterLoaded( APC, From, Event, To ) - Cargo_APC:__Deploy( 1, ZONE:New( "Deploy" ):GetCoordinate() ) -end - - - +--- +-- Name: AIC-APC-004 - APC Pickup +-- Author: FlightControl +-- Date Created: 23 Apr 2018 +-- Date Checked: 01 Jan 2021, working example, changed Deploy to async call + +BASE:TraceClass("AI_CARGO_APC") +BASE:TraceOn() + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local APC = GROUP:FindByName( "APC" ) +Cargo_APC = AI_CARGO_APC:New( APC, InfantryCargoSet, 350 ) +Cargo_APC:__Pickup( 1, ZONE:New( "Pickup" ):GetCoordinate() ) + + + +--- Loaded Handler OnAfter for Cargo_APC +-- @function [parent=#Cargo_APC] OnAfterLoaded +-- @param #Cargo_APC self +-- @param Wrapper.Group#GROUP APC +-- @param #string From +-- @param #string Event +-- @param #string To +function Cargo_APC:OnAfterLoaded( APC, From, Event, To ) + Cargo_APC:__Deploy( 1, ZONE:New( "Deploy" ):GetCoordinate() ) +end + + + diff --git a/AI/AI_Cargo_APC/AIC-APC-006 - Troops Relocate APC/AIC-APC-001 - Troops Relocate APC.lua b/AI/AI_Cargo_APC/AIC-APC-006 - Troops Relocate APC/AIC-APC-001 - Troops Relocate APC.lua index 39248020f7..22c5993c3e 100644 --- a/AI/AI_Cargo_APC/AIC-APC-006 - Troops Relocate APC/AIC-APC-001 - Troops Relocate APC.lua +++ b/AI/AI_Cargo_APC/AIC-APC-006 - Troops Relocate APC/AIC-APC-001 - Troops Relocate APC.lua @@ -1,29 +1,29 @@ ---- --- Name: AIC-APC-001 - Troops Relocate APC --- Author: FlightControl --- Date Created: 07 Apr 2018 --- Date Checked: 01 Jan 2021 --- --- Demonstration of troops relocation when carrier is destroyed... --- Carrier will relocate to the rescue carrier. --- - -BASE:TraceClass("AI_CARGO_APC") - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() - -local CargoCarrier = GROUP:FindByName( "Carrier" ) - -CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 500 ) - - -function CargoTroops:OnAfterDestroyed( CargoCarrier ) - CargoTroops:F( { Destroyed = CargoCarrier } ) - -- The coordinate is passed where the carrier is destroyed. - local NewCarrierGroup = self:FindCarrier( CargoCarrier:GetCoordinate(), 1000 ) -- which returns one Carrier GROUP object or nil. - if NewCarrierGroup then - self:SetCarrier( NewCarrierGroup ) - self:__Pickup(1,ZONE:New("Pickup Zone"):GetCoordinate(),30) - end -end - +--- +-- Name: AIC-APC-001 - Troops Relocate APC +-- Author: FlightControl +-- Date Created: 07 Apr 2018 +-- Date Checked: 01 Jan 2021 +-- +-- Demonstration of troops relocation when carrier is destroyed... +-- Carrier will relocate to the rescue carrier. +-- + +BASE:TraceClass("AI_CARGO_APC") + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() + +local CargoCarrier = GROUP:FindByName( "Carrier" ) + +CargoTroops = AI_CARGO_APC:New( CargoCarrier, InfantryCargoSet, 500 ) + + +function CargoTroops:OnAfterDestroyed( CargoCarrier ) + CargoTroops:F( { Destroyed = CargoCarrier } ) + -- The coordinate is passed where the carrier is destroyed. + local NewCarrierGroup = self:FindCarrier( CargoCarrier:GetCoordinate(), 1000 ) -- which returns one Carrier GROUP object or nil. + if NewCarrierGroup then + self:SetCarrier( NewCarrierGroup ) + self:__Pickup(1,ZONE:New("Pickup Zone"):GetCoordinate(),30) + end +end + diff --git a/AI/AI_Cargo_APC/AIC-APC-010 - Multiple APC/AIC-APC-010 - Multiple APC.lua b/AI/AI_Cargo_APC/AIC-APC-010 - Multiple APC/AIC-APC-010 - Multiple APC.lua index 3f1581d168..6adf62c7b8 100644 --- a/AI/AI_Cargo_APC/AIC-APC-010 - Multiple APC/AIC-APC-010 - Multiple APC.lua +++ b/AI/AI_Cargo_APC/AIC-APC-010 - Multiple APC/AIC-APC-010 - Multiple APC.lua @@ -1,13 +1,13 @@ ---- --- Name: AIC-APC-010 - Multiple APC --- Author: FlightControl --- Date Created: 24 Apr 2018 --- - -local InfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local APC = GROUP:FindByName( "APC" ) -Cargo_APC = AI_CARGO_APC:New( APC, InfantrySet, 250 ) -Cargo_APC:__Pickup( 2 ) - - - +--- +-- Name: AIC-APC-010 - Multiple APC +-- Author: FlightControl +-- Date Created: 24 Apr 2018 +-- + +local InfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local APC = GROUP:FindByName( "APC" ) +Cargo_APC = AI_CARGO_APC:New( APC, InfantrySet, 250 ) +Cargo_APC:__Pickup( 2 ) + + + diff --git a/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AIC-APC-011 - APC Pickup and Deploy.lua b/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AIC-APC-011 - APC Pickup and Deploy.lua index f7e92ed673..d76639a944 100644 --- a/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AIC-APC-011 - APC Pickup and Deploy.lua +++ b/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AIC-APC-011 - APC Pickup and Deploy.lua @@ -1,42 +1,42 @@ ---- --- Name: AIC-APC-004 - APC Pickup --- Author: FlightControl --- Date Created: 23 Apr 2018 --- Date Checked: 01 Jan 2021 - -local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() - -Cargo_APC = {} - -for i = 1, 4 do - Cargo_APC[i] = AI_CARGO_APC:New( GROUP:FindByName( "APC"..i ), InfantryCargoSet, 350 ) - - --- Loaded Handler OnAfter for Cargo_APC - -- @function [parent=#Cargo_APC] OnAfterLoaded - -- @param #Cargo_APC self - -- @param Wrapper.Group#GROUP APC - -- @param #string From - -- @param #string Event - -- @param #string To - Cargo_APC[i].OnAfterLoaded = function( self, APC, From, Event, To ) - self:__Deploy( 5, ZONE:New( "Deploy" ):GetRandomCoordinate( 300, 500 ) ) - end - - --- Unloaded Handler OnAfter for Cargo_APC - -- @function [parent=#Cargo_APC] OnAfterUnloaded - -- @param #Cargo_APC self - -- @param Wrapper.Group#GROUP APC - -- @param #string From - -- @param #string Event - -- @param #string To - Cargo_APC[i].OnAfterUnloaded = function( self, APC, From, Event, To ) - self:Pickup( ZONE:New( "Pickup" ):GetRandomCoordinate( 50, 70 ) ) - end - - Cargo_APC[i]:__Pickup( i * 30, ZONE:New( "Pickup" ):GetRandomCoordinate( 50, 70 ) ) - -end - - - - +--- +-- Name: AIC-APC-004 - APC Pickup +-- Author: FlightControl +-- Date Created: 23 Apr 2018 +-- Date Checked: 01 Jan 2021 + +local InfantryCargoSet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() + +Cargo_APC = {} + +for i = 1, 4 do + Cargo_APC[i] = AI_CARGO_APC:New( GROUP:FindByName( "APC"..i ), InfantryCargoSet, 350 ) + + --- Loaded Handler OnAfter for Cargo_APC + -- @function [parent=#Cargo_APC] OnAfterLoaded + -- @param #Cargo_APC self + -- @param Wrapper.Group#GROUP APC + -- @param #string From + -- @param #string Event + -- @param #string To + Cargo_APC[i].OnAfterLoaded = function( self, APC, From, Event, To ) + self:__Deploy( 5, ZONE:New( "Deploy" ):GetRandomCoordinate( 300, 500 ) ) + end + + --- Unloaded Handler OnAfter for Cargo_APC + -- @function [parent=#Cargo_APC] OnAfterUnloaded + -- @param #Cargo_APC self + -- @param Wrapper.Group#GROUP APC + -- @param #string From + -- @param #string Event + -- @param #string To + Cargo_APC[i].OnAfterUnloaded = function( self, APC, From, Event, To ) + self:Pickup( ZONE:New( "Pickup" ):GetRandomCoordinate( 50, 70 ) ) + end + + Cargo_APC[i]:__Pickup( i * 30, ZONE:New( "Pickup" ):GetRandomCoordinate( 50, 70 ) ) + +end + + + + diff --git a/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AI_Cargo.lua b/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AI_Cargo.lua index a5a08b2e74..bdd9025d41 100644 --- a/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AI_Cargo.lua +++ b/AI/AI_Cargo_APC/AIC-APC-011 - APC Pickup and Deploy/AI_Cargo.lua @@ -1,583 +1,583 @@ ---- **AI** -- (R2.4) - Models the intelligent transportation of infantry and other cargo. --- --- === --- --- ### Author: **FlightControl** --- --- === --- --- @module AI.AI_Cargo --- @image Cargo.JPG - ---- @type AI_CARGO --- @extends Core.Fsm#FSM_CONTROLLABLE - - ---- Base class for the dynamic cargo handling capability for AI groups. --- --- Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation. --- The AI_CARGO module uses the @{Cargo.Cargo} capabilities within the MOOSE framework. --- CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo. --- Please consult the @{Cargo.Cargo} module for more information. --- --- The derived classes from this module are: --- --- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones. --- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones. --- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases. --- --- @field #AI_CARGO -AI_CARGO = { - ClassName = "AI_CARGO", - Coordinate = nil, -- Core.Point#COORDINATE, - Carrier_Cargo = {}, -} - ---- Creates a new AI_CARGO object. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param Core.Set#SET_CARGO CargoSet --- @param #number CombatRadius --- @return #AI_CARGO -function AI_CARGO:New( Carrier, CargoSet ) - - local self = BASE:Inherit( self, FSM_CONTROLLABLE:New( Carrier ) ) -- #AI_CARGO - - self.CargoSet = CargoSet -- Core.Set#SET_CARGO - self.CargoCarrier = Carrier -- Wrapper.Group#GROUP - - self:SetStartState( "Unloaded" ) - - self:AddTransition( "Unloaded", "Pickup", "*" ) - self:AddTransition( "Loaded", "Deploy", "*" ) - - self:AddTransition( "*", "Load", "Boarding" ) - self:AddTransition( { "Boarding", "Loaded" }, "Board", "Boarding" ) - self:AddTransition( "Boarding", "Loaded", "Boarding" ) - self:AddTransition( "Boarding", "PickedUp", "Loaded" ) - - self:AddTransition( "Loaded", "Unload", "Unboarding" ) - self:AddTransition( "Unboarding", "Unboard", "Unboarding" ) - self:AddTransition( "Unboarding", "Unloaded", "Unboarding" ) - self:AddTransition( "Unboarding", "Deployed", "Unloaded" ) - - --- Pickup Handler OnBefore for AI_CARGO - -- @function [parent=#AI_CARGO] OnBeforePickup - -- @param #AI_CARGO self - -- @param #string From - -- @param #string Event - -- @param #string To - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - -- @return #boolean - - --- Pickup Handler OnAfter for AI_CARGO - -- @function [parent=#AI_CARGO] OnAfterPickup - -- @param #AI_CARGO self - -- @param #string From - -- @param #string Event - -- @param #string To - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - - --- Pickup Trigger for AI_CARGO - -- @function [parent=#AI_CARGO] Pickup - -- @param #AI_CARGO self - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - - --- Pickup Asynchronous Trigger for AI_CARGO - -- @function [parent=#AI_CARGO] __Pickup - -- @param #AI_CARGO self - -- @param #number Delay - -- @param Core.Point#COORDINATE Coordinate Pickup place. If not given, loading starts at the current location. - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - - --- Deploy Handler OnBefore for AI_CARGO - -- @function [parent=#AI_CARGO] OnBeforeDeploy - -- @param #AI_CARGO self - -- @param #string From - -- @param #string Event - -- @param #string To - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - -- @return #boolean - - --- Deploy Handler OnAfter for AI_CARGO - -- @function [parent=#AI_CARGO] OnAfterDeploy - -- @param #AI_CARGO self - -- @param #string From - -- @param #string Event - -- @param #string To - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - - --- Deploy Trigger for AI_CARGO - -- @function [parent=#AI_CARGO] Deploy - -- @param #AI_CARGO self - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - - --- Deploy Asynchronous Trigger for AI_CARGO - -- @function [parent=#AI_CARGO] __Deploy - -- @param #AI_CARGO self - -- @param #number Delay - -- @param Core.Point#COORDINATE Coordinate - -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. - - - --- Loaded Handler OnAfter for AI_CARGO - -- @function [parent=#AI_CARGO] OnAfterLoaded - -- @param #AI_CARGO self - -- @param Wrapper.Group#GROUP Carrier - -- @param #string From - -- @param #string Event - -- @param #string To - - --- Unloaded Handler OnAfter for AI_CARGO - -- @function [parent=#AI_CARGO] OnAfterUnloaded - -- @param #AI_CARGO self - -- @param Wrapper.Group#GROUP Carrier - -- @param #string From - -- @param #string Event - -- @param #string To - - --- On after Deployed event. - -- @function [parent=#AI_CARGO] OnAfterDeployed - -- @param #AI_CARGO self - -- @param Wrapper.Group#GROUP Carrier - -- @param #string From From state. - -- @param #string Event Event. - -- @param #string To To state. - -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. - -- @param #boolean Defend Defend for APCs. - - - for _, CarrierUnit in pairs( Carrier:GetUnits() ) do - local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT - CarrierUnit:SetCargoBayWeightLimit() - end - - self.Transporting = false - self.Relocating = false - - return self -end - - - -function AI_CARGO:IsTransporting() - - return self.Transporting == true -end - -function AI_CARGO:IsRelocating() - - return self.Relocating == true -end - - ---- On after Pickup event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP APC --- @param From --- @param Event --- @param To --- @param Core.Point#COORDINATE Coordinate of the pickup point. --- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go. --- @param #number Height Height in meters to move to the home coordinate. --- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. -function AI_CARGO:onafterPickup( APC, From, Event, To, Coordinate, Speed, Height, PickupZone ) - - self.Transporting = false - self.Relocating = true - -end - - ---- On after Deploy event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP APC --- @param From --- @param Event --- @param To --- @param Core.Point#COORDINATE Coordinate Deploy place. --- @param #number Speed Speed in km/h to drive to the depoly coordinate. Default is 50% of max possible speed the unit can go. --- @param #number Height Height in meters to move to the deploy coordinate. --- @param Core.Zone#ZONE DeployZone The zone where the cargo will be deployed. -function AI_CARGO:onafterDeploy( APC, From, Event, To, Coordinate, Speed, Height, DeployZone ) - - self.Relocating = false - self.Transporting = true - -end - ---- On before Load event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. -function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone ) - self:F( { Carrier, From, Event, To } ) - - local Boarding = false - - local LoadInterval = 2 - local LoadDelay = 1 - local Carrier_List = {} - local Carrier_Weight = {} - - if Carrier and Carrier:IsAlive() then - self.Carrier_Cargo = {} - for _, CarrierUnit in pairs( Carrier:GetUnits() ) do - local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT - - local CargoBayFreeWeight = CarrierUnit:GetCargoBayFreeWeight() - self:F({CargoBayFreeWeight=CargoBayFreeWeight}) - - Carrier_List[#Carrier_List+1] = CarrierUnit - Carrier_Weight[CarrierUnit] = CargoBayFreeWeight - end - - local Carrier_Count = #Carrier_List - local Carrier_Index = 1 - - local Loaded = false - - for _, Cargo in UTILS.spairs( self.CargoSet:GetSet(), function( t, a, b ) return t[a]:GetWeight() > t[b]:GetWeight() end ) do - local Cargo = Cargo -- Cargo.Cargo#CARGO - - self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), Carrier:GetName() } ) - - -- Try all Carriers, but start from the one according the Carrier_Index - for Carrier_Loop = 1, #Carrier_List do - - local CarrierUnit = Carrier_List[Carrier_Index] -- Wrapper.Unit#UNIT - - -- This counters loop through the available Carriers. - Carrier_Index = Carrier_Index + 1 - if Carrier_Index > Carrier_Count then - Carrier_Index = 1 - end - - if Cargo:IsUnLoaded() and not Cargo:IsDeployed() then - if Cargo:IsInLoadRadius( CarrierUnit:GetCoordinate() ) then - self:F( { "In radius", CarrierUnit:GetName() } ) - - local CargoWeight = Cargo:GetWeight() - local CarrierSpace=Carrier_Weight[CarrierUnit] - - -- Only when there is space within the bay to load the next cargo item! - if CarrierSpace > CargoWeight then - Carrier:RouteStop() - --Cargo:Ungroup() - Cargo:__Board( -LoadDelay, CarrierUnit ) - self:__Board( LoadDelay, Cargo, CarrierUnit, PickupZone ) - - LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval - - -- So now this CarrierUnit has Cargo that is being loaded. - -- This will be used further in the logic to follow and to check cargo status. - self.Carrier_Cargo[Cargo] = CarrierUnit - Boarding = true - Carrier_Weight[CarrierUnit] = Carrier_Weight[CarrierUnit] - CargoWeight - Loaded = true - - -- Ok, we loaded a cargo, now we can stop the loop. - break - else - self:T(string.format("WARNING: Cargo too heavy for carrier %s. Cargo=%.1f > %.1f free space", tostring(CarrierUnit:GetName()), CargoWeight, CarrierSpace)) - end - end - end - - end - - end - - if not Loaded == true then - -- No loading happened, so we need to pickup something else. - self.Relocating = false - end - end - - return Boarding - -end - - ---- On before Reload event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. -function AI_CARGO:onbeforeReload( Carrier, From, Event, To ) - self:F( { Carrier, From, Event, To } ) - - local Boarding = false - - local LoadInterval = 2 - local LoadDelay = 1 - local Carrier_List = {} - local Carrier_Weight = {} - - if Carrier and Carrier:IsAlive() then - for _, CarrierUnit in pairs( Carrier:GetUnits() ) do - local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT - - Carrier_List[#Carrier_List+1] = CarrierUnit - end - - local Carrier_Count = #Carrier_List - local Carrier_Index = 1 - - local Loaded = false - - for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do - local Cargo = Cargo -- Cargo.Cargo#CARGO - - self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), Carrier:GetName() } ) - - -- Try all Carriers, but start from the one according the Carrier_Index - for Carrier_Loop = 1, #Carrier_List do - - local CarrierUnit = Carrier_List[Carrier_Index] -- Wrapper.Unit#UNIT - - -- This counters loop through the available Carriers. - Carrier_Index = Carrier_Index + 1 - if Carrier_Index > Carrier_Count then - Carrier_Index = 1 - end - - if Cargo:IsUnLoaded() and not Cargo:IsDeployed() then - Carrier:RouteStop() - Cargo:__Board( -LoadDelay, CarrierUnit ) - self:__Board( LoadDelay, Cargo, CarrierUnit ) - - LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval - - -- So now this CarrierUnit has Cargo that is being loaded. - -- This will be used further in the logic to follow and to check cargo status. - self.Carrier_Cargo[Cargo] = CarrierUnit - Boarding = true - Loaded = true - end - - end - - end - - if not Loaded == true then - -- No loading happened, so we need to pickup something else. - self.Relocating = false - end - end - - return Boarding - -end - ---- On after Board event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param Cargo.Cargo#CARGO Cargo Cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit --- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. -function AI_CARGO:onafterBoard( Carrier, From, Event, To, Cargo, CarrierUnit, PickupZone ) - self:F( { Carrier, From, Event, To, Cargo, CarrierUnit:GetName() } ) - - if Carrier and Carrier:IsAlive() and From == "Boarding" then - self:F({ IsLoaded = Cargo:IsLoaded(), Cargo:GetName(), Carrier:GetName() } ) - if not Cargo:IsLoaded() and not Cargo:IsDestroyed() then - self:__Board( -10, Cargo, CarrierUnit, PickupZone ) - return - end - end - - self:__Loaded( 0.1, Cargo, CarrierUnit, PickupZone ) - -end - ---- On after Loaded event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @return #boolean Cargo loaded. --- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. -function AI_CARGO:onafterLoaded( Carrier, From, Event, To, Cargo, PickupZone ) - self:F( { Carrier, From, Event, To } ) - - local Loaded = true - - if Carrier and Carrier:IsAlive() then - for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do - local Cargo = Cargo -- Cargo.Cargo#CARGO - self:F( { IsLoaded = Cargo:IsLoaded(), IsDestroyed = Cargo:IsDestroyed(), Cargo:GetName(), Carrier:GetName() } ) - if not Cargo:IsLoaded() and not Cargo:IsDestroyed() then - Loaded = false - end - end - end - - if Loaded then - self:__PickedUp( 0.1, PickupZone ) - end - -end - ---- On after PickedUp event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. -function AI_CARGO:onafterPickedUp( Carrier, From, Event, To, PickupZone ) - self:F( { Carrier, From, Event, To } ) - - Carrier:RouteResume() - - local HasCargo = false - if Carrier and Carrier:IsAlive() then - for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do - HasCargo = true - break - end - end - - self.Relocating = false - if HasCargo then - self:F( "Transporting" ) - self.Transporting = true - end - -end - - - - ---- On after Unload event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AI_CARGO:onafterUnload( Carrier, From, Event, To, DeployZone, Defend ) - self:F( { Carrier, From, Event, To, DeployZone, Defend = Defend } ) - - local UnboardInterval = 5 - local UnboardDelay = 5 - - if Carrier and Carrier:IsAlive() then - for _, CarrierUnit in pairs( Carrier:GetUnits() ) do - local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT - Carrier:RouteStop() - for _, Cargo in pairs( CarrierUnit:GetCargo() ) do - self:F( { Cargo = Cargo:GetName(), Isloaded = Cargo:IsLoaded() } ) - if Cargo:IsLoaded() then - Cargo:__UnBoard( UnboardDelay ) - UnboardDelay = UnboardDelay + Cargo:GetCount() * UnboardInterval - self:__Unboard( UnboardDelay, Cargo, CarrierUnit, DeployZone, Defend ) - if not Defend == true then - Cargo:SetDeployed( true ) - end - end - end - end - end - -end - ---- On after Unboard event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param #string Cargo.Cargo#CARGO Cargo Cargo object. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AI_CARGO:onafterUnboard( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend ) - self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone, Defend = Defend } ) - - if Carrier and Carrier:IsAlive() and From == "Unboarding" then - if not Cargo:IsUnLoaded() then - self:__Unboard( 10, Cargo, CarrierUnit, DeployZone, Defend ) - return - end - end - - self:Unloaded( Cargo, CarrierUnit, DeployZone, Defend ) - -end - ---- On after Unloaded event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param #string Cargo.Cargo#CARGO Cargo Cargo object. --- @param #boolean Deployed Cargo is deployed. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend ) - self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone, Defend = Defend } ) - - local AllUnloaded = true - - --Cargo:Regroup() - - if Carrier and Carrier:IsAlive() then - for _, CarrierUnit in pairs( Carrier:GetUnits() ) do - local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT - local IsEmpty = CarrierUnit:IsCargoEmpty() - self:I({ IsEmpty = IsEmpty }) - if not IsEmpty then - AllUnloaded = false - break - end - end - - if AllUnloaded == true then - if DeployZone == true then - self.Carrier_Cargo = {} - end - self.CargoCarrier = Carrier - end - end - - if AllUnloaded == true then - self:__Deployed( 5, DeployZone, Defend ) - end - -end - ---- On after Deployed event. --- @param #AI_CARGO self --- @param Wrapper.Group#GROUP Carrier --- @param #string From From state. --- @param #string Event Event. --- @param #string To To state. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. --- @param #boolean Defend Defend for APCs. -function AI_CARGO:onafterDeployed( Carrier, From, Event, To, DeployZone, Defend ) - self:F( { Carrier, From, Event, To, DeployZone = DeployZone, Defend = Defend } ) - - if not Defend == true then - self.Transporting = false - else - self:F( "Defending" ) - - end - -end - +--- **AI** -- (R2.4) - Models the intelligent transportation of infantry and other cargo. +-- +-- === +-- +-- ### Author: **FlightControl** +-- +-- === +-- +-- @module AI.AI_Cargo +-- @image Cargo.JPG + +--- @type AI_CARGO +-- @extends Core.Fsm#FSM_CONTROLLABLE + + +--- Base class for the dynamic cargo handling capability for AI groups. +-- +-- Carriers can be mobilized to intelligently transport infantry and other cargo within the simulation. +-- The AI_CARGO module uses the @{Cargo.Cargo} capabilities within the MOOSE framework. +-- CARGO derived objects must be declared within the mission to make the AI_CARGO object recognize the cargo. +-- Please consult the @{Cargo.Cargo} module for more information. +-- +-- The derived classes from this module are: +-- +-- * @{AI.AI_Cargo_APC} - Cargo transportation using APCs and other vehicles between zones. +-- * @{AI.AI_Cargo_Helicopter} - Cargo transportation using helicopters between zones. +-- * @{AI.AI_Cargo_Airplane} - Cargo transportation using airplanes to and from airbases. +-- +-- @field #AI_CARGO +AI_CARGO = { + ClassName = "AI_CARGO", + Coordinate = nil, -- Core.Point#COORDINATE, + Carrier_Cargo = {}, +} + +--- Creates a new AI_CARGO object. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param Core.Set#SET_CARGO CargoSet +-- @param #number CombatRadius +-- @return #AI_CARGO +function AI_CARGO:New( Carrier, CargoSet ) + + local self = BASE:Inherit( self, FSM_CONTROLLABLE:New( Carrier ) ) -- #AI_CARGO + + self.CargoSet = CargoSet -- Core.Set#SET_CARGO + self.CargoCarrier = Carrier -- Wrapper.Group#GROUP + + self:SetStartState( "Unloaded" ) + + self:AddTransition( "Unloaded", "Pickup", "*" ) + self:AddTransition( "Loaded", "Deploy", "*" ) + + self:AddTransition( "*", "Load", "Boarding" ) + self:AddTransition( { "Boarding", "Loaded" }, "Board", "Boarding" ) + self:AddTransition( "Boarding", "Loaded", "Boarding" ) + self:AddTransition( "Boarding", "PickedUp", "Loaded" ) + + self:AddTransition( "Loaded", "Unload", "Unboarding" ) + self:AddTransition( "Unboarding", "Unboard", "Unboarding" ) + self:AddTransition( "Unboarding", "Unloaded", "Unboarding" ) + self:AddTransition( "Unboarding", "Deployed", "Unloaded" ) + + --- Pickup Handler OnBefore for AI_CARGO + -- @function [parent=#AI_CARGO] OnBeforePickup + -- @param #AI_CARGO self + -- @param #string From + -- @param #string Event + -- @param #string To + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + -- @return #boolean + + --- Pickup Handler OnAfter for AI_CARGO + -- @function [parent=#AI_CARGO] OnAfterPickup + -- @param #AI_CARGO self + -- @param #string From + -- @param #string Event + -- @param #string To + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + + --- Pickup Trigger for AI_CARGO + -- @function [parent=#AI_CARGO] Pickup + -- @param #AI_CARGO self + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + + --- Pickup Asynchronous Trigger for AI_CARGO + -- @function [parent=#AI_CARGO] __Pickup + -- @param #AI_CARGO self + -- @param #number Delay + -- @param Core.Point#COORDINATE Coordinate Pickup place. If not given, loading starts at the current location. + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + + --- Deploy Handler OnBefore for AI_CARGO + -- @function [parent=#AI_CARGO] OnBeforeDeploy + -- @param #AI_CARGO self + -- @param #string From + -- @param #string Event + -- @param #string To + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + -- @return #boolean + + --- Deploy Handler OnAfter for AI_CARGO + -- @function [parent=#AI_CARGO] OnAfterDeploy + -- @param #AI_CARGO self + -- @param #string From + -- @param #string Event + -- @param #string To + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + + --- Deploy Trigger for AI_CARGO + -- @function [parent=#AI_CARGO] Deploy + -- @param #AI_CARGO self + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + + --- Deploy Asynchronous Trigger for AI_CARGO + -- @function [parent=#AI_CARGO] __Deploy + -- @param #AI_CARGO self + -- @param #number Delay + -- @param Core.Point#COORDINATE Coordinate + -- @param #number Speed Speed in km/h. Default is 50% of max possible speed the group can do. + + + --- Loaded Handler OnAfter for AI_CARGO + -- @function [parent=#AI_CARGO] OnAfterLoaded + -- @param #AI_CARGO self + -- @param Wrapper.Group#GROUP Carrier + -- @param #string From + -- @param #string Event + -- @param #string To + + --- Unloaded Handler OnAfter for AI_CARGO + -- @function [parent=#AI_CARGO] OnAfterUnloaded + -- @param #AI_CARGO self + -- @param Wrapper.Group#GROUP Carrier + -- @param #string From + -- @param #string Event + -- @param #string To + + --- On after Deployed event. + -- @function [parent=#AI_CARGO] OnAfterDeployed + -- @param #AI_CARGO self + -- @param Wrapper.Group#GROUP Carrier + -- @param #string From From state. + -- @param #string Event Event. + -- @param #string To To state. + -- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. + -- @param #boolean Defend Defend for APCs. + + + for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT + CarrierUnit:SetCargoBayWeightLimit() + end + + self.Transporting = false + self.Relocating = false + + return self +end + + + +function AI_CARGO:IsTransporting() + + return self.Transporting == true +end + +function AI_CARGO:IsRelocating() + + return self.Relocating == true +end + + +--- On after Pickup event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP APC +-- @param From +-- @param Event +-- @param To +-- @param Core.Point#COORDINATE Coordinate of the pickup point. +-- @param #number Speed Speed in km/h to drive to the pickup coordinate. Default is 50% of max possible speed the unit can go. +-- @param #number Height Height in meters to move to the home coordinate. +-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. +function AI_CARGO:onafterPickup( APC, From, Event, To, Coordinate, Speed, Height, PickupZone ) + + self.Transporting = false + self.Relocating = true + +end + + +--- On after Deploy event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP APC +-- @param From +-- @param Event +-- @param To +-- @param Core.Point#COORDINATE Coordinate Deploy place. +-- @param #number Speed Speed in km/h to drive to the depoly coordinate. Default is 50% of max possible speed the unit can go. +-- @param #number Height Height in meters to move to the deploy coordinate. +-- @param Core.Zone#ZONE DeployZone The zone where the cargo will be deployed. +function AI_CARGO:onafterDeploy( APC, From, Event, To, Coordinate, Speed, Height, DeployZone ) + + self.Relocating = false + self.Transporting = true + +end + +--- On before Load event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. +function AI_CARGO:onbeforeLoad( Carrier, From, Event, To, PickupZone ) + self:F( { Carrier, From, Event, To } ) + + local Boarding = false + + local LoadInterval = 2 + local LoadDelay = 1 + local Carrier_List = {} + local Carrier_Weight = {} + + if Carrier and Carrier:IsAlive() then + self.Carrier_Cargo = {} + for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT + + local CargoBayFreeWeight = CarrierUnit:GetCargoBayFreeWeight() + self:F({CargoBayFreeWeight=CargoBayFreeWeight}) + + Carrier_List[#Carrier_List+1] = CarrierUnit + Carrier_Weight[CarrierUnit] = CargoBayFreeWeight + end + + local Carrier_Count = #Carrier_List + local Carrier_Index = 1 + + local Loaded = false + + for _, Cargo in UTILS.spairs( self.CargoSet:GetSet(), function( t, a, b ) return t[a]:GetWeight() > t[b]:GetWeight() end ) do + local Cargo = Cargo -- Cargo.Cargo#CARGO + + self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), Carrier:GetName() } ) + + -- Try all Carriers, but start from the one according the Carrier_Index + for Carrier_Loop = 1, #Carrier_List do + + local CarrierUnit = Carrier_List[Carrier_Index] -- Wrapper.Unit#UNIT + + -- This counters loop through the available Carriers. + Carrier_Index = Carrier_Index + 1 + if Carrier_Index > Carrier_Count then + Carrier_Index = 1 + end + + if Cargo:IsUnLoaded() and not Cargo:IsDeployed() then + if Cargo:IsInLoadRadius( CarrierUnit:GetCoordinate() ) then + self:F( { "In radius", CarrierUnit:GetName() } ) + + local CargoWeight = Cargo:GetWeight() + local CarrierSpace=Carrier_Weight[CarrierUnit] + + -- Only when there is space within the bay to load the next cargo item! + if CarrierSpace > CargoWeight then + Carrier:RouteStop() + --Cargo:Ungroup() + Cargo:__Board( -LoadDelay, CarrierUnit ) + self:__Board( LoadDelay, Cargo, CarrierUnit, PickupZone ) + + LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval + + -- So now this CarrierUnit has Cargo that is being loaded. + -- This will be used further in the logic to follow and to check cargo status. + self.Carrier_Cargo[Cargo] = CarrierUnit + Boarding = true + Carrier_Weight[CarrierUnit] = Carrier_Weight[CarrierUnit] - CargoWeight + Loaded = true + + -- Ok, we loaded a cargo, now we can stop the loop. + break + else + self:T(string.format("WARNING: Cargo too heavy for carrier %s. Cargo=%.1f > %.1f free space", tostring(CarrierUnit:GetName()), CargoWeight, CarrierSpace)) + end + end + end + + end + + end + + if not Loaded == true then + -- No loading happened, so we need to pickup something else. + self.Relocating = false + end + end + + return Boarding + +end + + +--- On before Reload event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. +function AI_CARGO:onbeforeReload( Carrier, From, Event, To ) + self:F( { Carrier, From, Event, To } ) + + local Boarding = false + + local LoadInterval = 2 + local LoadDelay = 1 + local Carrier_List = {} + local Carrier_Weight = {} + + if Carrier and Carrier:IsAlive() then + for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT + + Carrier_List[#Carrier_List+1] = CarrierUnit + end + + local Carrier_Count = #Carrier_List + local Carrier_Index = 1 + + local Loaded = false + + for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do + local Cargo = Cargo -- Cargo.Cargo#CARGO + + self:F( { IsUnLoaded = Cargo:IsUnLoaded(), IsDeployed = Cargo:IsDeployed(), Cargo:GetName(), Carrier:GetName() } ) + + -- Try all Carriers, but start from the one according the Carrier_Index + for Carrier_Loop = 1, #Carrier_List do + + local CarrierUnit = Carrier_List[Carrier_Index] -- Wrapper.Unit#UNIT + + -- This counters loop through the available Carriers. + Carrier_Index = Carrier_Index + 1 + if Carrier_Index > Carrier_Count then + Carrier_Index = 1 + end + + if Cargo:IsUnLoaded() and not Cargo:IsDeployed() then + Carrier:RouteStop() + Cargo:__Board( -LoadDelay, CarrierUnit ) + self:__Board( LoadDelay, Cargo, CarrierUnit ) + + LoadDelay = LoadDelay + Cargo:GetCount() * LoadInterval + + -- So now this CarrierUnit has Cargo that is being loaded. + -- This will be used further in the logic to follow and to check cargo status. + self.Carrier_Cargo[Cargo] = CarrierUnit + Boarding = true + Loaded = true + end + + end + + end + + if not Loaded == true then + -- No loading happened, so we need to pickup something else. + self.Relocating = false + end + end + + return Boarding + +end + +--- On after Board event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param Cargo.Cargo#CARGO Cargo Cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit +-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. +function AI_CARGO:onafterBoard( Carrier, From, Event, To, Cargo, CarrierUnit, PickupZone ) + self:F( { Carrier, From, Event, To, Cargo, CarrierUnit:GetName() } ) + + if Carrier and Carrier:IsAlive() and From == "Boarding" then + self:F({ IsLoaded = Cargo:IsLoaded(), Cargo:GetName(), Carrier:GetName() } ) + if not Cargo:IsLoaded() and not Cargo:IsDestroyed() then + self:__Board( -10, Cargo, CarrierUnit, PickupZone ) + return + end + end + + self:__Loaded( 0.1, Cargo, CarrierUnit, PickupZone ) + +end + +--- On after Loaded event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @return #boolean Cargo loaded. +-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. +function AI_CARGO:onafterLoaded( Carrier, From, Event, To, Cargo, PickupZone ) + self:F( { Carrier, From, Event, To } ) + + local Loaded = true + + if Carrier and Carrier:IsAlive() then + for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do + local Cargo = Cargo -- Cargo.Cargo#CARGO + self:F( { IsLoaded = Cargo:IsLoaded(), IsDestroyed = Cargo:IsDestroyed(), Cargo:GetName(), Carrier:GetName() } ) + if not Cargo:IsLoaded() and not Cargo:IsDestroyed() then + Loaded = false + end + end + end + + if Loaded then + self:__PickedUp( 0.1, PickupZone ) + end + +end + +--- On after PickedUp event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param Core.Zone#ZONE PickupZone (optional) The zone where the cargo will be picked up. The PickupZone can be nil, if there wasn't any PickupZoneSet provided. +function AI_CARGO:onafterPickedUp( Carrier, From, Event, To, PickupZone ) + self:F( { Carrier, From, Event, To } ) + + Carrier:RouteResume() + + local HasCargo = false + if Carrier and Carrier:IsAlive() then + for Cargo, CarrierUnit in pairs( self.Carrier_Cargo ) do + HasCargo = true + break + end + end + + self.Relocating = false + if HasCargo then + self:F( "Transporting" ) + self.Transporting = true + end + +end + + + + +--- On after Unload event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AI_CARGO:onafterUnload( Carrier, From, Event, To, DeployZone, Defend ) + self:F( { Carrier, From, Event, To, DeployZone, Defend = Defend } ) + + local UnboardInterval = 5 + local UnboardDelay = 5 + + if Carrier and Carrier:IsAlive() then + for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT + Carrier:RouteStop() + for _, Cargo in pairs( CarrierUnit:GetCargo() ) do + self:F( { Cargo = Cargo:GetName(), Isloaded = Cargo:IsLoaded() } ) + if Cargo:IsLoaded() then + Cargo:__UnBoard( UnboardDelay ) + UnboardDelay = UnboardDelay + Cargo:GetCount() * UnboardInterval + self:__Unboard( UnboardDelay, Cargo, CarrierUnit, DeployZone, Defend ) + if not Defend == true then + Cargo:SetDeployed( true ) + end + end + end + end + end + +end + +--- On after Unboard event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param #string Cargo.Cargo#CARGO Cargo Cargo object. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AI_CARGO:onafterUnboard( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend ) + self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone, Defend = Defend } ) + + if Carrier and Carrier:IsAlive() and From == "Unboarding" then + if not Cargo:IsUnLoaded() then + self:__Unboard( 10, Cargo, CarrierUnit, DeployZone, Defend ) + return + end + end + + self:Unloaded( Cargo, CarrierUnit, DeployZone, Defend ) + +end + +--- On after Unloaded event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param #string Cargo.Cargo#CARGO Cargo Cargo object. +-- @param #boolean Deployed Cargo is deployed. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AI_CARGO:onafterUnloaded( Carrier, From, Event, To, Cargo, CarrierUnit, DeployZone, Defend ) + self:F( { Carrier, From, Event, To, Cargo:GetName(), DeployZone = DeployZone, Defend = Defend } ) + + local AllUnloaded = true + + --Cargo:Regroup() + + if Carrier and Carrier:IsAlive() then + for _, CarrierUnit in pairs( Carrier:GetUnits() ) do + local CarrierUnit = CarrierUnit -- Wrapper.Unit#UNIT + local IsEmpty = CarrierUnit:IsCargoEmpty() + self:I({ IsEmpty = IsEmpty }) + if not IsEmpty then + AllUnloaded = false + break + end + end + + if AllUnloaded == true then + if DeployZone == true then + self.Carrier_Cargo = {} + end + self.CargoCarrier = Carrier + end + end + + if AllUnloaded == true then + self:__Deployed( 5, DeployZone, Defend ) + end + +end + +--- On after Deployed event. +-- @param #AI_CARGO self +-- @param Wrapper.Group#GROUP Carrier +-- @param #string From From state. +-- @param #string Event Event. +-- @param #string To To state. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +-- @param #boolean Defend Defend for APCs. +function AI_CARGO:onafterDeployed( Carrier, From, Event, To, DeployZone, Defend ) + self:F( { Carrier, From, Event, To, DeployZone = DeployZone, Defend = Defend } ) + + if not Defend == true then + self.Transporting = false + else + self:F( "Defending" ) + + end + +end + diff --git a/AI/AI_Cargo_Airplane/AIC-PLN-000 - Airplane/AIC-PLN-000 - Airplane.lua b/AI/AI_Cargo_Airplane/AIC-PLN-000 - Airplane/AIC-PLN-000 - Airplane.lua index 80c43702af..45228956f0 100644 --- a/AI/AI_Cargo_Airplane/AIC-PLN-000 - Airplane/AIC-PLN-000 - Airplane.lua +++ b/AI/AI_Cargo_Airplane/AIC-PLN-000 - Airplane/AIC-PLN-000 - Airplane.lua @@ -1,37 +1,37 @@ ---- --- Name: AIC-PLN-000 - Airplane --- Author: FlightControl --- Date Created: 14 Apr 2018 --- Date Checked: 01 Jan 2021 --- Update to latest Moose, working --- - -VehicleCargoSet = SET_CARGO:New():FilterTypes( "Vehicles" ):FilterStart() - -for i = 1, 10 do - local WorkerGroup = GROUP:FindByName( string.format( "Vehicle #%03d", i ) ) - local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Vehicles", string.format( "Vehicle %d", i ), 5000, 35 ) - WorkersCargo:SetWeight(10000) -end - -local Airplane = GROUP:FindByName( "Airplane" ) - -CargoAirplane = AI_CARGO_AIRPLANE:New( Airplane, VehicleCargoSet ) - - -PickupAirbase = AIRBASE:FindByName( AIRBASE.Caucasus.Kobuleti ) -DeployAirbases = { AIRBASE:FindByName( AIRBASE.Caucasus.Batumi ), AIRBASE:FindByName( AIRBASE.Caucasus.Gudauta ) } - -CargoAirplane:Pickup( PickupAirbase:GetCoordinate() ) - -function CargoAirplane:OnAfterLoaded( Airplane, From, Event, To, Cargo ) - CargoAirplane:__Deploy(0.2, DeployAirbases[math.random(#DeployAirbases)]:GetCoordinate(), math.random( 500, 750 ) ) -end - - ---function CargoAirplane:OnAfterUnloaded( Airplane, From, Event, To, Cargo ) -function CargoAirplane:OnAfterDeployed(Airplane, From, Event, To, DeployZone) - CargoAirplane:__Pickup(0.2, PickupAirbase:GetCoordinate(), math.random( 500, 750 ) ) -end - - +--- +-- Name: AIC-PLN-000 - Airplane +-- Author: FlightControl +-- Date Created: 14 Apr 2018 +-- Date Checked: 01 Jan 2021 +-- Update to latest Moose, working +-- + +VehicleCargoSet = SET_CARGO:New():FilterTypes( "Vehicles" ):FilterStart() + +for i = 1, 10 do + local WorkerGroup = GROUP:FindByName( string.format( "Vehicle #%03d", i ) ) + local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Vehicles", string.format( "Vehicle %d", i ), 5000, 35 ) + WorkersCargo:SetWeight(10000) +end + +local Airplane = GROUP:FindByName( "Airplane" ) + +CargoAirplane = AI_CARGO_AIRPLANE:New( Airplane, VehicleCargoSet ) + + +PickupAirbase = AIRBASE:FindByName( AIRBASE.Caucasus.Kobuleti ) +DeployAirbases = { AIRBASE:FindByName( AIRBASE.Caucasus.Batumi ), AIRBASE:FindByName( AIRBASE.Caucasus.Gudauta ) } + +CargoAirplane:Pickup( PickupAirbase:GetCoordinate() ) + +function CargoAirplane:OnAfterLoaded( Airplane, From, Event, To, Cargo ) + CargoAirplane:__Deploy(0.2, DeployAirbases[math.random(#DeployAirbases)]:GetCoordinate(), math.random( 500, 750 ) ) +end + + +--function CargoAirplane:OnAfterUnloaded( Airplane, From, Event, To, Cargo ) +function CargoAirplane:OnAfterDeployed(Airplane, From, Event, To, DeployZone) + CargoAirplane:__Pickup(0.2, PickupAirbase:GetCoordinate(), math.random( 500, 750 ) ) +end + + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-100 - APC - Pickup and Deploy/AID-CGO-100 - APC - Pickup and Deploy.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-100 - APC - Pickup and Deploy/AID-CGO-100 - APC - Pickup and Deploy.lua index d639b671f5..8bcf07915d 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-100 - APC - Pickup and Deploy/AID-CGO-100 - APC - Pickup and Deploy.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-100 - APC - Pickup and Deploy/AID-CGO-100 - APC - Pickup and Deploy.lua @@ -1,13 +1,13 @@ ---- --- Name: AID-CGO-100 - APC - Pickup and Deploy --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-100 - APC - Pickup and Deploy +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-110 - APC - Deploy at Group Zones/AID-CGO-110 - APC - Deploy at Group Zones.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-110 - APC - Deploy at Group Zones/AID-CGO-110 - APC - Deploy at Group Zones.lua index b3f4315e93..362bc43fbc 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-110 - APC - Deploy at Group Zones/AID-CGO-110 - APC - Deploy at Group Zones.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-110 - APC - Deploy at Group Zones/AID-CGO-110 - APC - Deploy at Group Zones.lua @@ -1,17 +1,17 @@ ---- --- Name: AID-CGO-110 - APC - Deploy at Group Zones --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -local ZoneGroup = GROUP:FindByName( "Deploy Group") -local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) - - -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-110 - APC - Deploy at Group Zones +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +local ZoneGroup = GROUP:FindByName( "Deploy Group") +local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) + + +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-120 - APC - Pickup and Deploy Large/AID-CGO-120 - APC - Pickup and Deploy Large.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-120 - APC - Pickup and Deploy Large/AID-CGO-120 - APC - Pickup and Deploy Large.lua index d639b671f5..8bcf07915d 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-120 - APC - Pickup and Deploy Large/AID-CGO-120 - APC - Pickup and Deploy Large.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-120 - APC - Pickup and Deploy Large/AID-CGO-120 - APC - Pickup and Deploy Large.lua @@ -1,13 +1,13 @@ ---- --- Name: AID-CGO-100 - APC - Pickup and Deploy --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-100 - APC - Pickup and Deploy +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-140 - APC - Event Handling/AID-CGO-140 - APC - Event Handling.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-140 - APC - Event Handling/AID-CGO-140 - APC - Event Handling.lua index c630d3322f..a696f2de38 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-140 - APC - Event Handling/AID-CGO-140 - APC - Event Handling.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-140 - APC - Event Handling/AID-CGO-140 - APC - Event Handling.lua @@ -1,172 +1,172 @@ ---- --- Name: AID-CGO-100 - APC - Pickup and Deploy --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetPickupZones = SET_ZONE:New():FilterPrefixes( "Pickup" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, SetPickupZones, SetDeployZones ) -AICargoDispatcherAPC:SetHomeZone( ZONE:New("Home") ) - ---- Pickup Handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. --- @param #number Height Height in meters to move to the pickup coordinate. --- @param Core.Zone#ZONE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherAPC:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height, PickupZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() - - -end - - ---- Load Handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherAPC:OnAfterLoad( From, Event, To, CarrierGroup, PickupZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - ---- PickedUp Handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a carrier has picked up all cargo objects into the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherAPC:OnAfterPickedUp( From, Event, To, CarrierGroup, PickupZone ) - - -- Write here your own code. - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded all cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - ---- Deploy Handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterDeploy --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The deploy coordinate. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. --- @param #number Height Height in meters to move to the deploy coordinate. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAPC:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - - - - - - ---- Unloaded Handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. --- You can use this event handler to post messages to players, or provide status updates etc. --- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. --- A CarrierUnit can be part of the larger CarrierGroup. --- @function OnAfterUnloaded --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Cargo.Cargo#CARGO Cargo The cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAPC:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) - - local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP - - -- Get the name of the DeployZone - local DeployZoneName = DeployZone:GetName() - - local DeployBuildingNames = { - ["Deploy A"] = "Building A", - } - - - -- Now board the infantry into the respective warehouse building. - if DeployZoneName then - local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) - Cargo:__Board( 5, Building, 25 ) - end - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() - - -end - - ---- Deployed Handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a carrier has deployed all cargo objects from the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterDeployed --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAPC:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - ---- Home event handler OnAfter for AICargoDispatcherAPC. --- Use this event handler to tailor the event when a CarrierGroup is returning to the HomeZone, after it has deployed all cargo objects from the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- If there is no HomeZone is specified, the CarrierGroup will stay at the current location after having deployed all cargo. --- @param #AICargoDispatcherAPC self --- @param #string From A string that contains the "*from state name*" when the event was triggered. --- @param #string Event A string that contains the "*event name*" when the event was triggered. --- @param #string To A string that contains the "*to state name*" when the event was triggered. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The home coordinate the Carrier will arrive and stop it's activities. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the home Coordinate. --- @param #number Height Height in meters to move to the home coordinate. --- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAPC:OnAfterHome( From, Event, To, CarrierGroup, Coordinate, Speed, Height, HomeZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo and going home to zone " .. HomeZone:GetName(), MESSAGE.Type.Detailed ):ToAll() - -end - - - -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-100 - APC - Pickup and Deploy +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetPickupZones = SET_ZONE:New():FilterPrefixes( "Pickup" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, SetPickupZones, SetDeployZones ) +AICargoDispatcherAPC:SetHomeZone( ZONE:New("Home") ) + +--- Pickup Handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. +-- @param #number Height Height in meters to move to the pickup coordinate. +-- @param Core.Zone#ZONE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherAPC:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height, PickupZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() + + +end + + +--- Load Handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherAPC:OnAfterLoad( From, Event, To, CarrierGroup, PickupZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + +--- PickedUp Handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a carrier has picked up all cargo objects into the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherAPC:OnAfterPickedUp( From, Event, To, CarrierGroup, PickupZone ) + + -- Write here your own code. + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded all cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +--- Deploy Handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterDeploy +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The deploy coordinate. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. +-- @param #number Height Height in meters to move to the deploy coordinate. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAPC:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + + + + + + +--- Unloaded Handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. +-- A CarrierUnit can be part of the larger CarrierGroup. +-- @function OnAfterUnloaded +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Cargo.Cargo#CARGO Cargo The cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAPC:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) + + local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP + + -- Get the name of the DeployZone + local DeployZoneName = DeployZone:GetName() + + local DeployBuildingNames = { + ["Deploy A"] = "Building A", + } + + + -- Now board the infantry into the respective warehouse building. + if DeployZoneName then + local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) + Cargo:__Board( 5, Building, 25 ) + end + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() + + +end + + +--- Deployed Handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a carrier has deployed all cargo objects from the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterDeployed +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAPC:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +--- Home event handler OnAfter for AICargoDispatcherAPC. +-- Use this event handler to tailor the event when a CarrierGroup is returning to the HomeZone, after it has deployed all cargo objects from the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- If there is no HomeZone is specified, the CarrierGroup will stay at the current location after having deployed all cargo. +-- @param #AICargoDispatcherAPC self +-- @param #string From A string that contains the "*from state name*" when the event was triggered. +-- @param #string Event A string that contains the "*event name*" when the event was triggered. +-- @param #string To A string that contains the "*to state name*" when the event was triggered. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The home coordinate the Carrier will arrive and stop it's activities. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the home Coordinate. +-- @param #number Height Height in meters to move to the home coordinate. +-- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAPC:OnAfterHome( From, Event, To, CarrierGroup, Coordinate, Speed, Height, HomeZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo and going home to zone " .. HomeZone:GetName(), MESSAGE.Type.Detailed ):ToAll() + +end + + + +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-150 - APC - Manpads against enemy helicopters/AID-CGO-150 - APC - Manpads against enemy helicopters.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-150 - APC - Manpads against enemy helicopters/AID-CGO-150 - APC - Manpads against enemy helicopters.lua index f988621bc2..0e27131bc1 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-150 - APC - Manpads against enemy helicopters/AID-CGO-150 - APC - Manpads against enemy helicopters.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-150 - APC - Manpads against enemy helicopters/AID-CGO-150 - APC - Manpads against enemy helicopters.lua @@ -1,21 +1,21 @@ ---- --- Name: AID-CGO-150 - APC - Manpads against enemy helicopters --- Author: FlightControl --- Date Created: 17 May 2018 --- --- This simulates manpads to fight against enemy helicpters. --- So when the enemy helicopters are within combat range, the manpads will unload and will attack the helos. - - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -local ZoneGroup = GROUP:FindByName( "Deploy Group") -local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) - - --- For the manpads to unload on time, a range of 8000 meters is appropriate. -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 8000 ) -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-150 - APC - Manpads against enemy helicopters +-- Author: FlightControl +-- Date Created: 17 May 2018 +-- +-- This simulates manpads to fight against enemy helicpters. +-- So when the enemy helicopters are within combat range, the manpads will unload and will attack the helos. + + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +local ZoneGroup = GROUP:FindByName( "Deploy Group") +local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) + + +-- For the manpads to unload on time, a range of 8000 meters is appropriate. +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 8000 ) +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-151 - APC - Manpads and not defending the carrier/AID-CGO-151 - APC - Manpads and not defending the carrier.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-151 - APC - Manpads and not defending the carrier/AID-CGO-151 - APC - Manpads and not defending the carrier.lua index 74f93810bf..016cc99551 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-151 - APC - Manpads and not defending the carrier/AID-CGO-151 - APC - Manpads and not defending the carrier.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-151 - APC - Manpads and not defending the carrier/AID-CGO-151 - APC - Manpads and not defending the carrier.lua @@ -1,26 +1,26 @@ ---- --- Name: AID-CGO-151 - APC - Manpads and not defending the carrier --- Author: FlightControl --- Date Created: 08 Sep 2018 --- --- This simulates manpads to board APCs and won't disembark to defend the enemy carrier when enemies are nearby.. --- So when the enemy helicopters are within combat range, the manpads will NOT unload and will NOT attack the helos. --- This is because the combat range was not provided, and thus is 0. - - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -local ZoneGroup = GROUP:FindByName( "Deploy Group") -local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) - - --- For the manpads to unload on time, a range of 8000 meters is appropriate. -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) - --- This will work too, so the combat range can be provided, but must be 0. ---AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 0 ) - -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-151 - APC - Manpads and not defending the carrier +-- Author: FlightControl +-- Date Created: 08 Sep 2018 +-- +-- This simulates manpads to board APCs and won't disembark to defend the enemy carrier when enemies are nearby.. +-- So when the enemy helicopters are within combat range, the manpads will NOT unload and will NOT attack the helos. +-- This is because the combat range was not provided, and thus is 0. + + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +local ZoneGroup = GROUP:FindByName( "Deploy Group") +local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) + + +-- For the manpads to unload on time, a range of 8000 meters is appropriate. +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones ) + +-- This will work too, so the combat range can be provided, but must be 0. +--AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 0 ) + +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-152 - APC - Defending the carrier/AID-CGO-152 - APC - Defending the carrier.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-152 - APC - Defending the carrier/AID-CGO-152 - APC - Defending the carrier.lua index 9ec1df3c99..b90014035d 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-152 - APC - Defending the carrier/AID-CGO-152 - APC - Defending the carrier.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-152 - APC - Defending the carrier/AID-CGO-152 - APC - Defending the carrier.lua @@ -1,28 +1,28 @@ ---- --- Name: AID-CGO-152 - APC - Defending the carrier --- Author: FlightControl --- Date Created: 18 Oct 2018 --- --- This simulates infantry to board APCs and will disembark to defend the enemy carrier when enemies are nearby.. - - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -local ZoneGroup = GROUP:FindByName( "Deploy Group") -local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) - - --- For the manpads to unload on time, a range of 8000 meters is appropriate. -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 800 ) - --- This will work too, so the combat range can be provided, but must be 0. ---AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 0 ) - -AICargoDispatcherAPC:Start() - -Sound = USERSOUND:New( "Sounds/BOS05ej9982.ogg" ) - -Sound:ToAll() - +--- +-- Name: AID-CGO-152 - APC - Defending the carrier +-- Author: FlightControl +-- Date Created: 18 Oct 2018 +-- +-- This simulates infantry to board APCs and will disembark to defend the enemy carrier when enemies are nearby.. + + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +local ZoneGroup = GROUP:FindByName( "Deploy Group") +local DeployZone = ZONE_GROUP:New( "Deploy Group", ZoneGroup, 200 ) + + +-- For the manpads to unload on time, a range of 8000 meters is appropriate. +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 800 ) + +-- This will work too, so the combat range can be provided, but must be 0. +--AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 0 ) + +AICargoDispatcherAPC:Start() + +Sound = USERSOUND:New( "Sounds/BOS05ej9982.ogg" ) + +Sound:ToAll() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-160 - APC - Spawning of cargo objects/AID-CGO-160 - APC - Spawning of cargo objects.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-160 - APC - Spawning of cargo objects/AID-CGO-160 - APC - Spawning of cargo objects.lua index 6663908342..229aae2845 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-160 - APC - Spawning of cargo objects/AID-CGO-160 - APC - Spawning of cargo objects.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-160 - APC - Spawning of cargo objects/AID-CGO-160 - APC - Spawning of cargo objects.lua @@ -1,43 +1,43 @@ ---- --- Name: AID-CGO-160 - APC - Spawning of cargo objects --- Author: FlightControl --- Date Created: 11 Sep 2018 --- --- In this demo cargo objects are spawned at random locations within the battle field. --- --- This simulates manpads to board APCs and won't disembark to defend the enemy carrier when enemies are nearby.. --- So when the enemy helicopters are within combat range, the manpads will NOT unload and will NOT attack the helos. --- This is because the combat range was not provided, and thus is 0. - - --- Spawn some random cargo in a zone. - -SpawnInfantry = SPAWN:New( "Infantry" ) -:InitLimit( 30, 100 ) -:InitRandomizePosition(true,500,100) -:InitRandomizeZones( { ZONE:New( "SpawnZone" ) } ) -:OnSpawnGroup( - function( SpawnGroup ) - CARGO_GROUP:New(SpawnGroup,"InfantryType",SpawnGroup:GetName(),150,10) - end -) -:SpawnScheduled( 30, 0 ) - - -local CargoInfantrySet = SET_CARGO:New():FilterTypes( "InfantryType" ):FilterStart() -local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() -local PickupZonesSet = SET_ZONE:New():FilterPrefixes( "Spawn" ):FilterOnce() -local DeployZonesSet = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterOnce() - --- For the manpads to unload on time, a range of 8000 meters is appropriate. -AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, CargoInfantrySet, PickupZonesSet, DeployZonesSet ) - --- This will work too, so the combat range can be provided, but must be 0. ---AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 0 ) - --- Now also make the carriers spawn in. -CarrierSpawn = SPAWN:New( "APC" ):InitLimit( 10, 10 ):InitRandomizePosition( true, 200, 50 ):SpawnScheduled( 10, 0 ) - - -AICargoDispatcherAPC:Start() - +--- +-- Name: AID-CGO-160 - APC - Spawning of cargo objects +-- Author: FlightControl +-- Date Created: 11 Sep 2018 +-- +-- In this demo cargo objects are spawned at random locations within the battle field. +-- +-- This simulates manpads to board APCs and won't disembark to defend the enemy carrier when enemies are nearby.. +-- So when the enemy helicopters are within combat range, the manpads will NOT unload and will NOT attack the helos. +-- This is because the combat range was not provided, and thus is 0. + + +-- Spawn some random cargo in a zone. + +SpawnInfantry = SPAWN:New( "Infantry" ) +:InitLimit( 30, 100 ) +:InitRandomizePosition(true,500,100) +:InitRandomizeZones( { ZONE:New( "SpawnZone" ) } ) +:OnSpawnGroup( + function( SpawnGroup ) + CARGO_GROUP:New(SpawnGroup,"InfantryType",SpawnGroup:GetName(),150,10) + end +) +:SpawnScheduled( 30, 0 ) + + +local CargoInfantrySet = SET_CARGO:New():FilterTypes( "InfantryType" ):FilterStart() +local SetAPC = SET_GROUP:New():FilterPrefixes( "APC" ):FilterStart() +local PickupZonesSet = SET_ZONE:New():FilterPrefixes( "Spawn" ):FilterOnce() +local DeployZonesSet = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterOnce() + +-- For the manpads to unload on time, a range of 8000 meters is appropriate. +AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, CargoInfantrySet, PickupZonesSet, DeployZonesSet ) + +-- This will work too, so the combat range can be provided, but must be 0. +--AICargoDispatcherAPC = AI_CARGO_DISPATCHER_APC:New( SetAPC, SetCargoInfantry, nil, SetDeployZones, 0 ) + +-- Now also make the carriers spawn in. +CarrierSpawn = SPAWN:New( "APC" ):InitLimit( 10, 10 ):InitRandomizePosition( true, 200, 50 ):SpawnScheduled( 10, 0 ) + + +AICargoDispatcherAPC:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-200 - Helicopter - Pickup and Deploy/AID-CGO-200 - Helicopter - Pickup and Deploy.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-200 - Helicopter - Pickup and Deploy/AID-CGO-200 - Helicopter - Pickup and Deploy.lua index 43bc6f1c57..34c9b1c205 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-200 - Helicopter - Pickup and Deploy/AID-CGO-200 - Helicopter - Pickup and Deploy.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-200 - Helicopter - Pickup and Deploy/AID-CGO-200 - Helicopter - Pickup and Deploy.lua @@ -1,13 +1,13 @@ ---- --- Name: AID-CGO-200 - Helicopter - Pickup and Deploy --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:Start() - +--- +-- Name: AID-CGO-200 - Helicopter - Pickup and Deploy +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-201 - Helicopter - DeployZone Orbit/AID-CGO-201 - Helicopter - DeployZone Orbit.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-201 - Helicopter - DeployZone Orbit/AID-CGO-201 - Helicopter - DeployZone Orbit.lua index 993ef0b5b6..51a401bb6d 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-201 - Helicopter - DeployZone Orbit/AID-CGO-201 - Helicopter - DeployZone Orbit.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-201 - Helicopter - DeployZone Orbit/AID-CGO-201 - Helicopter - DeployZone Orbit.lua @@ -1,14 +1,14 @@ ---- --- Name: AID-CGO-201 - Helicopter - DeployZone Orbit --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) -AICargoDispatcherHelicopter:Start() - +--- +-- Name: AID-CGO-201 - Helicopter - DeployZone Orbit +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) +AICargoDispatcherHelicopter:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-202 - Helicopter - Spawning of Helicopters/AID-CGO-202 - Helicopter - Spawning of Helicopters.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-202 - Helicopter - Spawning of Helicopters/AID-CGO-202 - Helicopter - Spawning of Helicopters.lua index e978be3e9c..923b37ad37 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-202 - Helicopter - Spawning of Helicopters/AID-CGO-202 - Helicopter - Spawning of Helicopters.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-202 - Helicopter - Spawning of Helicopters/AID-CGO-202 - Helicopter - Spawning of Helicopters.lua @@ -1,18 +1,18 @@ ---- --- Name: AID-CGO-202 - Helicopter - Spawning of Helicopters --- Author: FlightControl --- Date Created: 19 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:Start() - -HelicopterSpawn = SPAWN - :New( "Helicopter" ) - :InitLimit( 4, 20 ) - :InitLateActivated( true ) - :SpawnScheduled( 20, 0.5 ) +--- +-- Name: AID-CGO-202 - Helicopter - Spawning of Helicopters +-- Author: FlightControl +-- Date Created: 19 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:Start() + +HelicopterSpawn = SPAWN + :New( "Helicopter" ) + :InitLimit( 4, 20 ) + :InitLateActivated( true ) + :SpawnScheduled( 20, 0.5 ) diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-203 - Helicopter - Spawning of Infantry/AID-CGO-203 - Helicopter - Spawning of Infantry.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-203 - Helicopter - Spawning of Infantry/AID-CGO-203 - Helicopter - Spawning of Infantry.lua index d177ea531e..a734a35f8d 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-203 - Helicopter - Spawning of Infantry/AID-CGO-203 - Helicopter - Spawning of Infantry.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-203 - Helicopter - Spawning of Infantry/AID-CGO-203 - Helicopter - Spawning of Infantry.lua @@ -1,30 +1,30 @@ ---- --- Name: AID-CGO-203 - Helicopter - Spawning of Infantry --- Author: FlightControl --- Date Created: 19 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:Start() - -HelicopterSpawn = SPAWN - :New( "Helicopter" ) - :InitLimit( 4, 20 ) - :InitLateActivated( true ) - :SpawnScheduled( 20, 0.5 ) - -InfantrySpawn = SPAWN - :New( "Infantry" ) - :InitLimit( 20, 60 ) - :OnSpawnGroup( - function( SpawnGroup ) - CARGO_GROUP:New( SpawnGroup, "Infantry", SpawnGroup:GetName(), 500, 25 ) - end - ) - :InitRandomizePosition( true, 1000, 250 ) - :SpawnScheduled( 10, 0.5 ) - +--- +-- Name: AID-CGO-203 - Helicopter - Spawning of Infantry +-- Author: FlightControl +-- Date Created: 19 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:Start() + +HelicopterSpawn = SPAWN + :New( "Helicopter" ) + :InitLimit( 4, 20 ) + :InitLateActivated( true ) + :SpawnScheduled( 20, 0.5 ) + +InfantrySpawn = SPAWN + :New( "Infantry" ) + :InitLimit( 20, 60 ) + :OnSpawnGroup( + function( SpawnGroup ) + CARGO_GROUP:New( SpawnGroup, "Infantry", SpawnGroup:GetName(), 500, 25 ) + end + ) + :InitRandomizePosition( true, 1000, 250 ) + :SpawnScheduled( 10, 0.5 ) + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-210 - Helicopter - Home/AID-CGO-210 - Helicopter - Home.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-210 - Helicopter - Home/AID-CGO-210 - Helicopter - Home.lua index c2af7a85d8..2a7cd271f9 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-210 - Helicopter - Home/AID-CGO-210 - Helicopter - Home.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-210 - Helicopter - Home/AID-CGO-210 - Helicopter - Home.lua @@ -1,13 +1,13 @@ ---- --- Name: AID-CGO-210 - Helicopter - Home --- Author: FlightControl --- Date Created: 10 May 2018 --- - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) -AICargoDispatcherHelicopter:Start() +--- +-- Name: AID-CGO-210 - Helicopter - Home +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) +AICargoDispatcherHelicopter:Start() diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-220 - Helicopter - Randomize Coordinates/AID-CGO-220 - Helicopter - Randomize Coordinates.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-220 - Helicopter - Randomize Coordinates/AID-CGO-220 - Helicopter - Randomize Coordinates.lua index e9eca93557..a8c4bfdf80 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-220 - Helicopter - Randomize Coordinates/AID-CGO-220 - Helicopter - Randomize Coordinates.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-220 - Helicopter - Randomize Coordinates/AID-CGO-220 - Helicopter - Randomize Coordinates.lua @@ -1,16 +1,16 @@ ---- --- Name: AID-CGO-220 - Helicopter - Randomize Coordinates --- Author: FlightControl --- Date Created: 10 May 2018 --- --- Demonstrates the way how the pickup and deploy locations can be randomized. - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:Start() - -AICargoDispatcherHelicopter:SetPickupRadius( 100, 50 ) -AICargoDispatcherHelicopter:SetDeployRadius( 100, 50 ) +--- +-- Name: AID-CGO-220 - Helicopter - Randomize Coordinates +-- Author: FlightControl +-- Date Created: 10 May 2018 +-- +-- Demonstrates the way how the pickup and deploy locations can be randomized. + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:Start() + +AICargoDispatcherHelicopter:SetPickupRadius( 100, 50 ) +AICargoDispatcherHelicopter:SetDeployRadius( 100, 50 ) diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-230 - Helicopter - DeployZone Probability/AID-CGO-230 - Helicopter - DeployZone Probability.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-230 - Helicopter - DeployZone Probability/AID-CGO-230 - Helicopter - DeployZone Probability.lua index 4a96b975b7..59dee05197 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-230 - Helicopter - DeployZone Probability/AID-CGO-230 - Helicopter - DeployZone Probability.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-230 - Helicopter - DeployZone Probability/AID-CGO-230 - Helicopter - DeployZone Probability.lua @@ -1,18 +1,18 @@ ---- --- Name: AID-CGO-230 - Helicopter - DeployZone Probability --- Author: FlightControl --- Date Created: 15 May 2018 --- --- Demonstrates the way how the deploy locations can be set to a specific probability distribution. - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) -AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) -AICargoDispatcherHelicopter:Start() - -SetDeployZones:SetZoneProbability( "Deploy A", 0.1 ) -SetDeployZones:SetZoneProbability( "Deploy B", 0.1 ) +--- +-- Name: AID-CGO-230 - Helicopter - DeployZone Probability +-- Author: FlightControl +-- Date Created: 15 May 2018 +-- +-- Demonstrates the way how the deploy locations can be set to a specific probability distribution. + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, nil, SetDeployZones ) +AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) +AICargoDispatcherHelicopter:Start() + +SetDeployZones:SetZoneProbability( "Deploy A", 0.1 ) +SetDeployZones:SetZoneProbability( "Deploy B", 0.1 ) SetDeployZones:SetZoneProbability( "Deploy C", 0.8 ) \ No newline at end of file diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-240 - Helicopter - Unloaded Event Handling/AID-CGO-240 - Helicopter - Unloaded Event Handling.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-240 - Helicopter - Unloaded Event Handling/AID-CGO-240 - Helicopter - Unloaded Event Handling.lua index 808f62cc93..46d62ea505 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-240 - Helicopter - Unloaded Event Handling/AID-CGO-240 - Helicopter - Unloaded Event Handling.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-240 - Helicopter - Unloaded Event Handling/AID-CGO-240 - Helicopter - Unloaded Event Handling.lua @@ -1,176 +1,176 @@ ---- --- Name: AID-CGO-240 - Helicopter - Unloaded Event Handling --- Author: FlightControl --- Date Created: 15 May 2018 --- --- Demonstrates the way how the deploy locations can be set to a specific probability distribution. - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetPickupZones = SET_ZONE:New():FilterPrefixes( "Pickup" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, SetPickupZones, SetDeployZones ) -AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) - - - ---- Pickup Handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. --- @param #number Height Height in meters to move to the pickup coordinate. -function AICargoDispatcherHelicopter:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo.", MESSAGE.Type.Information ):ToAll() - - -end - - ---- Load Handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. -function AICargoDispatcherHelicopter:OnAfterLoad( From, Event, To, CarrierGroup ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo.", MESSAGE.Type.Information ):ToAll() - -end - - ---- Loaded event handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has loaded a cargo object. --- You can use this event handler to post messages to players, or provide status updates etc. --- Note that if more cargo objects were loading or boarding into the CarrierUnit, then this event can be triggered multiple times for each different Cargo/CarrierUnit. --- A CarrierUnit can be part of the larger CarrierGroup. --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was triggered. --- @param #string Event A string that contains the "*event name*" when the event was triggered. --- @param #string To A string that contains the "*to state name*" when the event was triggered. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Cargo.Cargo#CARGO Cargo The cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo loading operation. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherHelicopter:OnAfterLoaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, PickupZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded cargo " .. Cargo:GetName(), MESSAGE.Type.Information ):ToAll() - -end - ---- Deploy Handler OnAfter for AI_CARGO_DISPATCHER. --- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterPickedUp --- @param self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The deploy coordinate. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. --- @param #number Height Height in meters to move to the deploy coordinate. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - - - - - - ---- Unloaded Handler OnAfter for AI_CARGO_DISPATCHER. --- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. --- You can use this event handler to post messages to players, or provide status updates etc. --- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. --- A CarrierUnit can be part of the larger CarrierGroup. --- @function OnAfterUnloaded --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Cargo.Cargo#CARGO Cargo The cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) - - local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP - - -- Get the name of the DeployZone - local DeployZoneName = DeployZone:GetName() - - local DeployBuildingNames = { - ["Deploy A"] = "Building A", - ["Deploy B"] = "Building B", - ["Deploy C"] = "Building C", - } - - - -- Now board the infantry into the respective warehouse building. - if DeployZoneName then - local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) - Cargo:__Board( 5, Building, 25 ) - end - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() - - -end - - ---- Deployed Handler OnAfter for AI_CARGO_DISPATCHER. --- Use this event handler to tailor the event when a carrier has deployed all cargo objects from the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterDeployed --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - ---- Home event handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierGroup is returning to the HomeZone, after it has deployed all cargo objects from the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- If there is no HomeZone is specified, the CarrierGroup will stay at the current location after having deployed all cargo. --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was triggered. --- @param #string Event A string that contains the "*event name*" when the event was triggered. --- @param #string To A string that contains the "*to state name*" when the event was triggered. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The home coordinate the Carrier will arrive and stop it's activities. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the home Coordinate. --- @param #number Height Height in meters to move to the home coordinate. --- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterHome( From, Event, To, CarrierGroup, Coordinate, Speed, Height, HomeZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo and going home to zone " .. HomeZone:GetName(), MESSAGE.Type.Detailed ):ToAll() - -end - - -AICargoDispatcherHelicopter:Start() +--- +-- Name: AID-CGO-240 - Helicopter - Unloaded Event Handling +-- Author: FlightControl +-- Date Created: 15 May 2018 +-- +-- Demonstrates the way how the deploy locations can be set to a specific probability distribution. + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetPickupZones = SET_ZONE:New():FilterPrefixes( "Pickup" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Deploy" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, SetPickupZones, SetDeployZones ) +AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) + + + +--- Pickup Handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. +-- @param #number Height Height in meters to move to the pickup coordinate. +function AICargoDispatcherHelicopter:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo.", MESSAGE.Type.Information ):ToAll() + + +end + + +--- Load Handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +function AICargoDispatcherHelicopter:OnAfterLoad( From, Event, To, CarrierGroup ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo.", MESSAGE.Type.Information ):ToAll() + +end + + +--- Loaded event handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has loaded a cargo object. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- Note that if more cargo objects were loading or boarding into the CarrierUnit, then this event can be triggered multiple times for each different Cargo/CarrierUnit. +-- A CarrierUnit can be part of the larger CarrierGroup. +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was triggered. +-- @param #string Event A string that contains the "*event name*" when the event was triggered. +-- @param #string To A string that contains the "*to state name*" when the event was triggered. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Cargo.Cargo#CARGO Cargo The cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo loading operation. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherHelicopter:OnAfterLoaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, PickupZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded cargo " .. Cargo:GetName(), MESSAGE.Type.Information ):ToAll() + +end + +--- Deploy Handler OnAfter for AI_CARGO_DISPATCHER. +-- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterPickedUp +-- @param self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The deploy coordinate. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. +-- @param #number Height Height in meters to move to the deploy coordinate. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + + + + + + +--- Unloaded Handler OnAfter for AI_CARGO_DISPATCHER. +-- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. +-- A CarrierUnit can be part of the larger CarrierGroup. +-- @function OnAfterUnloaded +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Cargo.Cargo#CARGO Cargo The cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) + + local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP + + -- Get the name of the DeployZone + local DeployZoneName = DeployZone:GetName() + + local DeployBuildingNames = { + ["Deploy A"] = "Building A", + ["Deploy B"] = "Building B", + ["Deploy C"] = "Building C", + } + + + -- Now board the infantry into the respective warehouse building. + if DeployZoneName then + local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) + Cargo:__Board( 5, Building, 25 ) + end + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() + + +end + + +--- Deployed Handler OnAfter for AI_CARGO_DISPATCHER. +-- Use this event handler to tailor the event when a carrier has deployed all cargo objects from the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterDeployed +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +--- Home event handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierGroup is returning to the HomeZone, after it has deployed all cargo objects from the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- If there is no HomeZone is specified, the CarrierGroup will stay at the current location after having deployed all cargo. +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was triggered. +-- @param #string Event A string that contains the "*event name*" when the event was triggered. +-- @param #string To A string that contains the "*to state name*" when the event was triggered. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The home coordinate the Carrier will arrive and stop it's activities. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the home Coordinate. +-- @param #number Height Height in meters to move to the home coordinate. +-- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterHome( From, Event, To, CarrierGroup, Coordinate, Speed, Height, HomeZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo and going home to zone " .. HomeZone:GetName(), MESSAGE.Type.Detailed ):ToAll() + +end + + +AICargoDispatcherHelicopter:Start() diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-250 - Helicopter - Front-Line Enforcements/AID-CGO-250 - Helicopter - Front-Line Enforcements.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-250 - Helicopter - Front-Line Enforcements/AID-CGO-250 - Helicopter - Front-Line Enforcements.lua index 8ed55da356..5381a35135 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-250 - Helicopter - Front-Line Enforcements/AID-CGO-250 - Helicopter - Front-Line Enforcements.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-250 - Helicopter - Front-Line Enforcements/AID-CGO-250 - Helicopter - Front-Line Enforcements.lua @@ -1,206 +1,206 @@ ---- --- Name: AID-CGO-250 - Helicopter - Front-Line Enforcements --- Author: FlightControl --- Date Created: 20 Sep 2018 --- --- Demonstrates the way how front-line enforcements can be setup using helicopter transportations. - -local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() -local SetPickupZones = SET_ZONE:New():FilterPrefixes( "Pickup" ):FilterStart() -local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Defense" ):FilterStart() - -AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, SetPickupZones, SetDeployZones ) -AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) - - --- Here we setup the spawning of Infantry. -SpawnCargoInfantry = SPAWN - :New( "Infantry" ) - :InitLimit( 40, 60 ) - :InitRandomizeZones( { ZONE_POLYGON:NewFromGroupName( "Pickup Location" ) } ) - :OnSpawnGroup( - function( SpawnGroup ) - -- This will automatically add also the CargoInfantry object to the SetCargoInfantry (in the background through the event system). - local CargoInfantry = CARGO_GROUP:New( SpawnGroup, "Infantry", SpawnGroup:GetName(), 150 ) - end - ) - :SpawnScheduled( 60, 0.5 ) - --- Now we create 4 zones based on GROUP objects within the battlefield, which form the front line defense points. -local ZoneDefense1 = ZONE_GROUP:New( "Defense 1", GROUP:FindByName("Defense #001"), 1500 ) -local ZoneDefense2 = ZONE_GROUP:New( "Defense 2", GROUP:FindByName("Defense #002"), 1500 ) -local ZoneDefense3 = ZONE_GROUP:New( "Defense 3", GROUP:FindByName("Defense #003"), 1500 ) -local ZoneDefense4 = ZONE_GROUP:New( "Defense 4", GROUP:FindByName("Defense #004"), 1500 ) - - --- Here we setup the spawning of Helicopters. - - - ---- Pickup Handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. --- @param #number Height Height in meters to move to the pickup coordinate. -function AICargoDispatcherHelicopter:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo.", MESSAGE.Type.Information ):ToAll() - - -end - - ---- Load Handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. -function AICargoDispatcherHelicopter:OnAfterLoad( From, Event, To, CarrierGroup ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo.", MESSAGE.Type.Information ):ToAll() - -end - - ---- Loaded event handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has loaded a cargo object. --- You can use this event handler to post messages to players, or provide status updates etc. --- Note that if more cargo objects were loading or boarding into the CarrierUnit, then this event can be triggered multiple times for each different Cargo/CarrierUnit. --- A CarrierUnit can be part of the larger CarrierGroup. --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was triggered. --- @param #string Event A string that contains the "*event name*" when the event was triggered. --- @param #string To A string that contains the "*to state name*" when the event was triggered. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Cargo.Cargo#CARGO Cargo The cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo loading operation. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherHelicopter:OnAfterLoaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, PickupZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded cargo " .. Cargo:GetName(), MESSAGE.Type.Information ):ToAll() - -end - ---- Deploy Handler OnAfter for AI_CARGO_DISPATCHER. --- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterPickedUp --- @param self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The deploy coordinate. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. --- @param #number Height Height in meters to move to the deploy coordinate. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - - - - - - ---- Unloaded Handler OnAfter for AI_CARGO_DISPATCHER. --- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. --- You can use this event handler to post messages to players, or provide status updates etc. --- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. --- A CarrierUnit can be part of the larger CarrierGroup. --- @function OnAfterUnloaded --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Cargo.Cargo#CARGO Cargo The cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) - - local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP - - -- Get the name of the DeployZone - local DeployZoneName = DeployZone:GetName() - - local DeployBuildingNames = { - ["Deploy A"] = "Building A", - ["Deploy B"] = "Building B", - ["Deploy C"] = "Building C", - } - - - -- Now board the infantry into the respective warehouse building. - if DeployZoneName then - local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) - Cargo:__Board( 5, Building, 25 ) - end - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() - - -end - - ---- Deployed Handler OnAfter for AI_CARGO_DISPATCHER. --- Use this event handler to tailor the event when a carrier has deployed all cargo objects from the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterDeployed --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - ---- Home event handler OnAfter for AICargoDispatcherHelicopter. --- Use this event handler to tailor the event when a CarrierGroup is returning to the HomeZone, after it has deployed all cargo objects from the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- If there is no HomeZone is specified, the CarrierGroup will stay at the current location after having deployed all cargo. --- @param #AICargoDispatcherHelicopter self --- @param #string From A string that contains the "*from state name*" when the event was triggered. --- @param #string Event A string that contains the "*event name*" when the event was triggered. --- @param #string To A string that contains the "*to state name*" when the event was triggered. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The home coordinate the Carrier will arrive and stop it's activities. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the home Coordinate. --- @param #number Height Height in meters to move to the home coordinate. --- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherHelicopter:OnAfterHome( From, Event, To, CarrierGroup, Coordinate, Speed, Height, HomeZone ) - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo and going home to zone " .. HomeZone:GetName(), MESSAGE.Type.Detailed ):ToAll() - -end - - -AICargoDispatcherHelicopter:SetPickupRadius( 30, 10 ) -AICargoDispatcherHelicopter:SetDeployRadius( 200, 100 ) -AICargoDispatcherHelicopter:SetPickupSpeed( 300, 200 ) -AICargoDispatcherHelicopter:SetDeploySpeed( 300, 200 ) -AICargoDispatcherHelicopter:SetPickupHeight( 100, 30 ) -AICargoDispatcherHelicopter:SetDeployHeight( 100, 30 ) - -AICargoDispatcherHelicopter:ScheduleOnce( 10, AICargoDispatcherHelicopter.Start, AICargoDispatcherHelicopter ) +--- +-- Name: AID-CGO-250 - Helicopter - Front-Line Enforcements +-- Author: FlightControl +-- Date Created: 20 Sep 2018 +-- +-- Demonstrates the way how front-line enforcements can be setup using helicopter transportations. + +local SetCargoInfantry = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local SetHelicopter = SET_GROUP:New():FilterPrefixes( "Helicopter" ):FilterStart() +local SetPickupZones = SET_ZONE:New():FilterPrefixes( "Pickup" ):FilterStart() +local SetDeployZones = SET_ZONE:New():FilterPrefixes( "Defense" ):FilterStart() + +AICargoDispatcherHelicopter = AI_CARGO_DISPATCHER_HELICOPTER:New( SetHelicopter, SetCargoInfantry, SetPickupZones, SetDeployZones ) +AICargoDispatcherHelicopter:SetHomeZone( ZONE:FindByName( "Home" ) ) + + +-- Here we setup the spawning of Infantry. +SpawnCargoInfantry = SPAWN + :New( "Infantry" ) + :InitLimit( 40, 60 ) + :InitRandomizeZones( { ZONE_POLYGON:NewFromGroupName( "Pickup Location" ) } ) + :OnSpawnGroup( + function( SpawnGroup ) + -- This will automatically add also the CargoInfantry object to the SetCargoInfantry (in the background through the event system). + local CargoInfantry = CARGO_GROUP:New( SpawnGroup, "Infantry", SpawnGroup:GetName(), 150 ) + end + ) + :SpawnScheduled( 60, 0.5 ) + +-- Now we create 4 zones based on GROUP objects within the battlefield, which form the front line defense points. +local ZoneDefense1 = ZONE_GROUP:New( "Defense 1", GROUP:FindByName("Defense #001"), 1500 ) +local ZoneDefense2 = ZONE_GROUP:New( "Defense 2", GROUP:FindByName("Defense #002"), 1500 ) +local ZoneDefense3 = ZONE_GROUP:New( "Defense 3", GROUP:FindByName("Defense #003"), 1500 ) +local ZoneDefense4 = ZONE_GROUP:New( "Defense 4", GROUP:FindByName("Defense #004"), 1500 ) + + +-- Here we setup the spawning of Helicopters. + + + +--- Pickup Handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. +-- @param #number Height Height in meters to move to the pickup coordinate. +function AICargoDispatcherHelicopter:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo.", MESSAGE.Type.Information ):ToAll() + + +end + + +--- Load Handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +function AICargoDispatcherHelicopter:OnAfterLoad( From, Event, To, CarrierGroup ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo.", MESSAGE.Type.Information ):ToAll() + +end + + +--- Loaded event handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has loaded a cargo object. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- Note that if more cargo objects were loading or boarding into the CarrierUnit, then this event can be triggered multiple times for each different Cargo/CarrierUnit. +-- A CarrierUnit can be part of the larger CarrierGroup. +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was triggered. +-- @param #string Event A string that contains the "*event name*" when the event was triggered. +-- @param #string To A string that contains the "*to state name*" when the event was triggered. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Cargo.Cargo#CARGO Cargo The cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo loading operation. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherHelicopter:OnAfterLoaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, PickupZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded cargo " .. Cargo:GetName(), MESSAGE.Type.Information ):ToAll() + +end + +--- Deploy Handler OnAfter for AI_CARGO_DISPATCHER. +-- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterPickedUp +-- @param self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The deploy coordinate. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. +-- @param #number Height Height in meters to move to the deploy coordinate. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + + + + + + +--- Unloaded Handler OnAfter for AI_CARGO_DISPATCHER. +-- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. +-- A CarrierUnit can be part of the larger CarrierGroup. +-- @function OnAfterUnloaded +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Cargo.Cargo#CARGO Cargo The cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) + + local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP + + -- Get the name of the DeployZone + local DeployZoneName = DeployZone:GetName() + + local DeployBuildingNames = { + ["Deploy A"] = "Building A", + ["Deploy B"] = "Building B", + ["Deploy C"] = "Building C", + } + + + -- Now board the infantry into the respective warehouse building. + if DeployZoneName then + local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) + Cargo:__Board( 5, Building, 25 ) + end + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() + + +end + + +--- Deployed Handler OnAfter for AI_CARGO_DISPATCHER. +-- Use this event handler to tailor the event when a carrier has deployed all cargo objects from the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterDeployed +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +--- Home event handler OnAfter for AICargoDispatcherHelicopter. +-- Use this event handler to tailor the event when a CarrierGroup is returning to the HomeZone, after it has deployed all cargo objects from the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- If there is no HomeZone is specified, the CarrierGroup will stay at the current location after having deployed all cargo. +-- @param #AICargoDispatcherHelicopter self +-- @param #string From A string that contains the "*from state name*" when the event was triggered. +-- @param #string Event A string that contains the "*event name*" when the event was triggered. +-- @param #string To A string that contains the "*to state name*" when the event was triggered. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The home coordinate the Carrier will arrive and stop it's activities. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the home Coordinate. +-- @param #number Height Height in meters to move to the home coordinate. +-- @param Core.Zone#ZONE HomeZone The zone wherein the carrier will return when all cargo has been transported. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherHelicopter:OnAfterHome( From, Event, To, CarrierGroup, Coordinate, Speed, Height, HomeZone ) + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo and going home to zone " .. HomeZone:GetName(), MESSAGE.Type.Detailed ):ToAll() + +end + + +AICargoDispatcherHelicopter:SetPickupRadius( 30, 10 ) +AICargoDispatcherHelicopter:SetDeployRadius( 200, 100 ) +AICargoDispatcherHelicopter:SetPickupSpeed( 300, 200 ) +AICargoDispatcherHelicopter:SetDeploySpeed( 300, 200 ) +AICargoDispatcherHelicopter:SetPickupHeight( 100, 30 ) +AICargoDispatcherHelicopter:SetDeployHeight( 100, 30 ) + +AICargoDispatcherHelicopter:ScheduleOnce( 10, AICargoDispatcherHelicopter.Start, AICargoDispatcherHelicopter ) diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-300 - Airplane - Pickup and Deploy/AID-CGO-300 - Airplane - Pickup and Deploy.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-300 - Airplane - Pickup and Deploy/AID-CGO-300 - Airplane - Pickup and Deploy.lua index b4c9bbfc90..ab2569dda2 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-300 - Airplane - Pickup and Deploy/AID-CGO-300 - Airplane - Pickup and Deploy.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-300 - Airplane - Pickup and Deploy/AID-CGO-300 - Airplane - Pickup and Deploy.lua @@ -1,17 +1,17 @@ ---- --- Name: AID-CGO-300 - Airplane - Pickup and Deploy --- Author: FlightControl --- Date Created: 02 Aug 2018 --- - -local CargoInfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local AirplanesSet = SET_GROUP:New():FilterPrefixes( "Airplane" ):FilterStart() -local PickupZoneSet = SET_ZONE:New() -local DeployZoneSet = SET_ZONE:New() - -PickupZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Gudauta ) ) -DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Sochi_Adler ) ) - -AICargoDispatcherAirplanes = AI_CARGO_DISPATCHER_AIRPLANE:New( AirplanesSet, CargoInfantrySet, PickupZoneSet, DeployZoneSet ) -AICargoDispatcherAirplanes:Start() - +--- +-- Name: AID-CGO-300 - Airplane - Pickup and Deploy +-- Author: FlightControl +-- Date Created: 02 Aug 2018 +-- + +local CargoInfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local AirplanesSet = SET_GROUP:New():FilterPrefixes( "Airplane" ):FilterStart() +local PickupZoneSet = SET_ZONE:New() +local DeployZoneSet = SET_ZONE:New() + +PickupZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Gudauta ) ) +DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Sochi_Adler ) ) + +AICargoDispatcherAirplanes = AI_CARGO_DISPATCHER_AIRPLANE:New( AirplanesSet, CargoInfantrySet, PickupZoneSet, DeployZoneSet ) +AICargoDispatcherAirplanes:Start() + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-310 - Airplane - Pickup and Deploy Multiple/AID-CGO-310 - Airplane - Pickup and Deploy Multiple.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-310 - Airplane - Pickup and Deploy Multiple/AID-CGO-310 - Airplane - Pickup and Deploy Multiple.lua index af6f24ff04..7cb8115c85 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-310 - Airplane - Pickup and Deploy Multiple/AID-CGO-310 - Airplane - Pickup and Deploy Multiple.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-310 - Airplane - Pickup and Deploy Multiple/AID-CGO-310 - Airplane - Pickup and Deploy Multiple.lua @@ -1,21 +1,21 @@ ---- --- Name: AID-CGO-310 - Airplane - Pickup and Deploy Multiple --- Author: FlightControl --- Date Created: 03 Aug 2018 --- - -local CargoInfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local AirplanesSet = SET_GROUP:New():FilterPrefixes( "Airplane" ):FilterStart() -local PickupZoneSet = SET_ZONE:New() -local DeployZoneSet = SET_ZONE:New() - -PickupZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Gudauta ) ) -DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Sochi_Adler ) ) - -AICargoDispatcherAirplanes = AI_CARGO_DISPATCHER_AIRPLANE:New( AirplanesSet, CargoInfantrySet, PickupZoneSet, DeployZoneSet ) -AICargoDispatcherAirplanes:Start() - -for CargoName, Cargo in pairs( CargoInfantrySet:GetSet() ) do - AICargoDispatcherAirplanes:I( { Cargo = Cargo:GetName() } ) -end - +--- +-- Name: AID-CGO-310 - Airplane - Pickup and Deploy Multiple +-- Author: FlightControl +-- Date Created: 03 Aug 2018 +-- + +local CargoInfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local AirplanesSet = SET_GROUP:New():FilterPrefixes( "Airplane" ):FilterStart() +local PickupZoneSet = SET_ZONE:New() +local DeployZoneSet = SET_ZONE:New() + +PickupZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Gudauta ) ) +DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Sochi_Adler ) ) + +AICargoDispatcherAirplanes = AI_CARGO_DISPATCHER_AIRPLANE:New( AirplanesSet, CargoInfantrySet, PickupZoneSet, DeployZoneSet ) +AICargoDispatcherAirplanes:Start() + +for CargoName, Cargo in pairs( CargoInfantrySet:GetSet() ) do + AICargoDispatcherAirplanes:I( { Cargo = Cargo:GetName() } ) +end + diff --git a/AI/AI_Cargo_Dispatcher/AID-CGO-340 - Airplane - Event Handling/AID-CGO-340 - Airplane - Event Handling.lua b/AI/AI_Cargo_Dispatcher/AID-CGO-340 - Airplane - Event Handling/AID-CGO-340 - Airplane - Event Handling.lua index 8424c0d461..2cd5cc7804 100644 --- a/AI/AI_Cargo_Dispatcher/AID-CGO-340 - Airplane - Event Handling/AID-CGO-340 - Airplane - Event Handling.lua +++ b/AI/AI_Cargo_Dispatcher/AID-CGO-340 - Airplane - Event Handling/AID-CGO-340 - Airplane - Event Handling.lua @@ -1,153 +1,153 @@ ---- --- Name: AID-CGO-340 - Airplane - Event Handling --- Author: FlightControl --- Date Created: 02 Aug 2018 --- - -local CargoInfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() -local AirplanesSet = SET_GROUP:New():FilterPrefixes( "Airplane" ):FilterStart() -local PickupZoneSet = SET_ZONE:New() -local DeployZoneSet = SET_ZONE:New() - -PickupZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Gudauta ) ) -DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Sochi_Adler ) ) -DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Maykop_Khanskaya ) ) -DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Mineralnye_Vody ) ) -DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Vaziani ) ) - -AICargoDispatcherAirplanes = AI_CARGO_DISPATCHER_AIRPLANE:New( AirplanesSet, CargoInfantrySet, PickupZoneSet, DeployZoneSet ) -AICargoDispatcherAirplanes:SetHomeZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Kobuleti ) ) - ---- Pickup Handler OnAfter for AICargoDispatcherAirplanes. --- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. --- @param #number Height Height in meters to move to the pickup coordinate. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherAirplanes:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height, PickupZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() - - -end - - ---- Load Handler OnAfter for AICargoDispatcherAirplanes. --- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherAirplanes:OnAfterLoad( From, Event, To, CarrierGroup, PickupZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - ---- PickedUp Handler OnAfter for AICargoDispatcherAirplanes. --- Use this event handler to tailor the event when a carrier has picked up all cargo objects into the CarrierGroup. --- You can use this event handler to post messages to players, or provide status updates etc. --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. -function AICargoDispatcherAirplanes:OnAfterPickedUp( From, Event, To, CarrierGroup, PickupZone ) - - -- Write here your own code. - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded all cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - ---- Deploy Handler OnAfter for AICargoDispatcherAirplanes. --- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. --- You can use this event handler to post messages to players, or provide status updates etc. --- @function OnAfterDeploy --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Point#COORDINATE Coordinate The deploy coordinate. --- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. --- @param #number Height Height in meters to move to the deploy coordinate. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAirplanes:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - ---- Unloaded Handler OnAfter for AICargoDispatcherAirplanes. --- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. --- You can use this event handler to post messages to players, or provide status updates etc. --- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. --- A CarrierUnit can be part of the larger CarrierGroup. --- @function OnAfterUnloaded --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Cargo.Cargo#CARGO Cargo The cargo object. --- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAirplanes:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) - - -- Write here your own code. - local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP - - -- Get the name of the DeployZone - local DeployZoneName = DeployZone:GetName() - - local DeployBuildingNames = { - ["Deploy A"] = "Building A", - } - - - -- Now board the infantry into the respective warehouse building. - if DeployZoneName then - local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) - Cargo:__Board( 5, Building, 25 ) - end - - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() - - -end - - ---- Deployed Handler OnAfter for AICargoDispatcherAirplanes. --- @function OnAfterDeployed --- @param #AICargoDispatcherAirplanes self --- @param #string From A string that contains the "*from state name*" when the event was fired. --- @param #string Event A string that contains the "*event name*" when the event was fired. --- @param #string To A string that contains the "*to state name*" when the event was fired. --- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. --- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. -function AICargoDispatcherAirplanes:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) - - -- Write here your own code. - MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() - -end - - -AICargoDispatcherAirplanes:Start() - +--- +-- Name: AID-CGO-340 - Airplane - Event Handling +-- Author: FlightControl +-- Date Created: 02 Aug 2018 +-- + +local CargoInfantrySet = SET_CARGO:New():FilterTypes( "Infantry" ):FilterStart() +local AirplanesSet = SET_GROUP:New():FilterPrefixes( "Airplane" ):FilterStart() +local PickupZoneSet = SET_ZONE:New() +local DeployZoneSet = SET_ZONE:New() + +PickupZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Gudauta ) ) +DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Sochi_Adler ) ) +DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Maykop_Khanskaya ) ) +DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Mineralnye_Vody ) ) +DeployZoneSet:AddZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Vaziani ) ) + +AICargoDispatcherAirplanes = AI_CARGO_DISPATCHER_AIRPLANE:New( AirplanesSet, CargoInfantrySet, PickupZoneSet, DeployZoneSet ) +AICargoDispatcherAirplanes:SetHomeZone( ZONE_AIRBASE:New( AIRBASE.Caucasus.Kobuleti ) ) + +--- Pickup Handler OnAfter for AICargoDispatcherAirplanes. +-- Use this event handler to tailor the event when a CarrierGroup is routed towards a new pickup Coordinate and a specified Speed. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The coordinate of the pickup location. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the pickup Coordinate. +-- @param #number Height Height in meters to move to the pickup coordinate. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherAirplanes:OnAfterPickup( From, Event, To, CarrierGroup, Coordinate, Speed, Height, PickupZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is picking up cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() + + +end + + +--- Load Handler OnAfter for AICargoDispatcherAirplanes. +-- Use this event handler to tailor the event when a CarrierGroup has initiated the loading or boarding of cargo within reporting or near range. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherAirplanes:OnAfterLoad( From, Event, To, CarrierGroup, PickupZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is loading cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + +--- PickedUp Handler OnAfter for AICargoDispatcherAirplanes. +-- Use this event handler to tailor the event when a carrier has picked up all cargo objects into the CarrierGroup. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE_AIRBASE PickupZone (optional) The zone from where the cargo is picked up. Note that the zone is optional and may not be provided, but for AI_CARGO_DISPATCHER_AIRBASE there will always be a PickupZone, as the pickup location is an airbase zone. +function AICargoDispatcherAirplanes:OnAfterPickedUp( From, Event, To, CarrierGroup, PickupZone ) + + -- Write here your own code. + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " has loaded all cargo at airbase " .. PickupZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +--- Deploy Handler OnAfter for AICargoDispatcherAirplanes. +-- Use this event handler to tailor the event when a CarrierGroup is routed to a deploy coordinate, to Unload all cargo objects in each CarrierUnit. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- @function OnAfterDeploy +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Point#COORDINATE Coordinate The deploy coordinate. +-- @param #number Speed The velocity in meters per second on which the CarrierGroup is routed towards the deploy Coordinate. +-- @param #number Height Height in meters to move to the deploy coordinate. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAirplanes:OnAfterDeploy( From, Event, To, CarrierGroup, Coordinate, Speed, Height, DeployZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName().. " is starting deployment of all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +--- Unloaded Handler OnAfter for AICargoDispatcherAirplanes. +-- Use this event handler to tailor the event when a CarrierUnit of a CarrierGroup has unloaded a cargo object. +-- You can use this event handler to post messages to players, or provide status updates etc. +-- Note that if more cargo objects were unloading or unboarding from the CarrierUnit, then this event can be fired multiple times for each different Cargo/CarrierUnit. +-- A CarrierUnit can be part of the larger CarrierGroup. +-- @function OnAfterUnloaded +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Cargo.Cargo#CARGO Cargo The cargo object. +-- @param Wrapper.Unit#UNIT CarrierUnit The carrier unit that is executing the cargo unloading operation. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAirplanes:OnAfterUnloaded( From, Event, To, CarrierGroup, Cargo, CarrierUnit, DeployZone ) + + -- Write here your own code. + local CargoGroup = Cargo:GetObject() -- Wrapper.Group#GROUP + + -- Get the name of the DeployZone + local DeployZoneName = DeployZone:GetName() + + local DeployBuildingNames = { + ["Deploy A"] = "Building A", + } + + + -- Now board the infantry into the respective warehouse building. + if DeployZoneName then + local Building = STATIC:FindByName( DeployBuildingNames[DeployZoneName] ) + Cargo:__Board( 5, Building, 25 ) + end + + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. ", Unit " .. CarrierUnit:GetName() .. " has unloaded cargo " .. Cargo:GetName() .. " in zone " .. DeployZone:GetName() .. " and cargo is moving to building " .. DeployBuildingNames[DeployZoneName], MESSAGE.Type.Information ):ToAll() + + +end + + +--- Deployed Handler OnAfter for AICargoDispatcherAirplanes. +-- @function OnAfterDeployed +-- @param #AICargoDispatcherAirplanes self +-- @param #string From A string that contains the "*from state name*" when the event was fired. +-- @param #string Event A string that contains the "*event name*" when the event was fired. +-- @param #string To A string that contains the "*to state name*" when the event was fired. +-- @param Wrapper.Group#GROUP CarrierGroup The group object that contains the CarrierUnits. +-- @param Core.Zone#ZONE DeployZone The zone wherein the cargo is deployed. This can be any zone type, like a ZONE, ZONE_GROUP, ZONE_AIRBASE. +function AICargoDispatcherAirplanes:OnAfterDeployed( From, Event, To, CarrierGroup, DeployZone ) + + -- Write here your own code. + MESSAGE:NewType( "Group " .. CarrierGroup:GetName() .. " deployed all cargo in zone " .. DeployZone:GetName(), MESSAGE.Type.Information ):ToAll() + +end + + +AICargoDispatcherAirplanes:Start() + diff --git a/AI/AI_Cargo_Helicopter/AIC-HEL-000 - Helicopter/AIC-HEL-000 - Helicopter.lua b/AI/AI_Cargo_Helicopter/AIC-HEL-000 - Helicopter/AIC-HEL-000 - Helicopter.lua index eeff770c0e..635f49da3d 100644 --- a/AI/AI_Cargo_Helicopter/AIC-HEL-000 - Helicopter/AIC-HEL-000 - Helicopter.lua +++ b/AI/AI_Cargo_Helicopter/AIC-HEL-000 - Helicopter/AIC-HEL-000 - Helicopter.lua @@ -1,38 +1,38 @@ ---- --- Name: AIC-HEL-000 - Helicopter --- Author: FlightControl --- Date Created: 13 Apr 2018 --- Date Checked: 01 Jan 2021 --- Updated Moose, needs fix #1417 to work --- -BASE:TraceClass("AI_CARGO") -BASE:TraceClass("AI_CARGO_HELICOPTER") -BASE:TraceOn() - -WorkerCargoSet = SET_CARGO:New():FilterTypes( "Workers" ):FilterStart() - - -for i = 1, 5 do - local WorkerGroup = GROUP:FindByName( string.format( "Infantry %03d", i ) ) - local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Workers", string.format( "Infantry %d", i ), 750, 35 ) -end - -local Helicopter = GROUP:FindByName( "Helicopter" ) - -CargoHelicopter = AI_CARGO_HELICOPTER:New( Helicopter, WorkerCargoSet ) - - -PickupZone = ZONE:New( "PickupZone" ) -DeployZones = { ZONE:New( "DeployZone Alpha" ), ZONE:New( "DeployZone Beta" ), ZONE:New( "DeployZone Gamma" ) } - -CargoHelicopter:Pickup( PickupZone:GetRandomCoordinate( 400, 100 ) ) - -function CargoHelicopter:OnAfterLoaded( Helicopter, From, Event, To, Cargo ) - CargoHelicopter:__Deploy(5,DeployZones[math.random( 1, #DeployZones ) ]:GetRandomCoordinate( 500, 100 ), math.random( 50, 250 ) ) -end - - -function CargoHelicopter:OnAfterUnloaded( Helicopter, From, Event, To, Cargo ) - CargoHelicopter:__Pickup( 5,PickupZone:GetRandomCoordinate( 500, 200 ), math.random( 50, 250 ) ) -end - +--- +-- Name: AIC-HEL-000 - Helicopter +-- Author: FlightControl +-- Date Created: 13 Apr 2018 +-- Date Checked: 01 Jan 2021 +-- Updated Moose, needs fix #1417 to work +-- +BASE:TraceClass("AI_CARGO") +BASE:TraceClass("AI_CARGO_HELICOPTER") +BASE:TraceOn() + +WorkerCargoSet = SET_CARGO:New():FilterTypes( "Workers" ):FilterStart() + + +for i = 1, 5 do + local WorkerGroup = GROUP:FindByName( string.format( "Infantry %03d", i ) ) + local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Workers", string.format( "Infantry %d", i ), 750, 35 ) +end + +local Helicopter = GROUP:FindByName( "Helicopter" ) + +CargoHelicopter = AI_CARGO_HELICOPTER:New( Helicopter, WorkerCargoSet ) + + +PickupZone = ZONE:New( "PickupZone" ) +DeployZones = { ZONE:New( "DeployZone Alpha" ), ZONE:New( "DeployZone Beta" ), ZONE:New( "DeployZone Gamma" ) } + +CargoHelicopter:Pickup( PickupZone:GetRandomCoordinate( 400, 100 ) ) + +function CargoHelicopter:OnAfterLoaded( Helicopter, From, Event, To, Cargo ) + CargoHelicopter:__Deploy(5,DeployZones[math.random( 1, #DeployZones ) ]:GetRandomCoordinate( 500, 100 ), math.random( 50, 250 ) ) +end + + +function CargoHelicopter:OnAfterUnloaded( Helicopter, From, Event, To, Cargo ) + CargoHelicopter:__Pickup( 5,PickupZone:GetRandomCoordinate( 500, 200 ), math.random( 50, 250 ) ) +end + diff --git a/AI/AI_Cargo_Helicopter/AIC-HEL-010 - Blue Helicopter/AIC-HEL-000 - Helicopter.lua b/AI/AI_Cargo_Helicopter/AIC-HEL-010 - Blue Helicopter/AIC-HEL-000 - Helicopter.lua index eeff770c0e..635f49da3d 100644 --- a/AI/AI_Cargo_Helicopter/AIC-HEL-010 - Blue Helicopter/AIC-HEL-000 - Helicopter.lua +++ b/AI/AI_Cargo_Helicopter/AIC-HEL-010 - Blue Helicopter/AIC-HEL-000 - Helicopter.lua @@ -1,38 +1,38 @@ ---- --- Name: AIC-HEL-000 - Helicopter --- Author: FlightControl --- Date Created: 13 Apr 2018 --- Date Checked: 01 Jan 2021 --- Updated Moose, needs fix #1417 to work --- -BASE:TraceClass("AI_CARGO") -BASE:TraceClass("AI_CARGO_HELICOPTER") -BASE:TraceOn() - -WorkerCargoSet = SET_CARGO:New():FilterTypes( "Workers" ):FilterStart() - - -for i = 1, 5 do - local WorkerGroup = GROUP:FindByName( string.format( "Infantry %03d", i ) ) - local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Workers", string.format( "Infantry %d", i ), 750, 35 ) -end - -local Helicopter = GROUP:FindByName( "Helicopter" ) - -CargoHelicopter = AI_CARGO_HELICOPTER:New( Helicopter, WorkerCargoSet ) - - -PickupZone = ZONE:New( "PickupZone" ) -DeployZones = { ZONE:New( "DeployZone Alpha" ), ZONE:New( "DeployZone Beta" ), ZONE:New( "DeployZone Gamma" ) } - -CargoHelicopter:Pickup( PickupZone:GetRandomCoordinate( 400, 100 ) ) - -function CargoHelicopter:OnAfterLoaded( Helicopter, From, Event, To, Cargo ) - CargoHelicopter:__Deploy(5,DeployZones[math.random( 1, #DeployZones ) ]:GetRandomCoordinate( 500, 100 ), math.random( 50, 250 ) ) -end - - -function CargoHelicopter:OnAfterUnloaded( Helicopter, From, Event, To, Cargo ) - CargoHelicopter:__Pickup( 5,PickupZone:GetRandomCoordinate( 500, 200 ), math.random( 50, 250 ) ) -end - +--- +-- Name: AIC-HEL-000 - Helicopter +-- Author: FlightControl +-- Date Created: 13 Apr 2018 +-- Date Checked: 01 Jan 2021 +-- Updated Moose, needs fix #1417 to work +-- +BASE:TraceClass("AI_CARGO") +BASE:TraceClass("AI_CARGO_HELICOPTER") +BASE:TraceOn() + +WorkerCargoSet = SET_CARGO:New():FilterTypes( "Workers" ):FilterStart() + + +for i = 1, 5 do + local WorkerGroup = GROUP:FindByName( string.format( "Infantry %03d", i ) ) + local WorkersCargo = CARGO_GROUP:New( WorkerGroup, "Workers", string.format( "Infantry %d", i ), 750, 35 ) +end + +local Helicopter = GROUP:FindByName( "Helicopter" ) + +CargoHelicopter = AI_CARGO_HELICOPTER:New( Helicopter, WorkerCargoSet ) + + +PickupZone = ZONE:New( "PickupZone" ) +DeployZones = { ZONE:New( "DeployZone Alpha" ), ZONE:New( "DeployZone Beta" ), ZONE:New( "DeployZone Gamma" ) } + +CargoHelicopter:Pickup( PickupZone:GetRandomCoordinate( 400, 100 ) ) + +function CargoHelicopter:OnAfterLoaded( Helicopter, From, Event, To, Cargo ) + CargoHelicopter:__Deploy(5,DeployZones[math.random( 1, #DeployZones ) ]:GetRandomCoordinate( 500, 100 ), math.random( 50, 250 ) ) +end + + +function CargoHelicopter:OnAfterUnloaded( Helicopter, From, Event, To, Cargo ) + CargoHelicopter:__Pickup( 5,PickupZone:GetRandomCoordinate( 500, 200 ), math.random( 50, 250 ) ) +end +