Removed Test Missions from main repository

This commit is contained in:
FlightControl 2017-03-30 07:51:16 +02:00
parent f692b2bc90
commit 2d5970e75e
277 changed files with 35926 additions and 6157 deletions

View File

@ -6,12 +6,11 @@ __Moose = {}
__Moose.Include = function( IncludeFile )
if not __Moose.Includes[ IncludeFile ] then
__Moose.Includes[IncludeFile] = IncludeFile
env.info( "Include:" .. IncludeFile .. " from " .. __Moose.ProgramPath )
local f = assert( base.loadfile( __Moose.ProgramPath .. IncludeFile .. ".lua" ) )
local f = assert( base.loadfile( __Moose.ProgramPath .. IncludeFile ) )
if f == nil then
error ("Could not load Moose file " .. IncludeFile .. ".lua" )
error ("Moose: Could not load Moose file " .. IncludeFile )
else
env.info( "Moose:" .. IncludeFile .. " loaded from " .. __Moose.ProgramPath )
env.info( "Moose: " .. IncludeFile .. " dynamically loaded from " .. __Moose.ProgramPath )
return f()
end
end

View File

@ -1,56 +1,56 @@
Utilities\Routines
Utilities\Utils
Utilities/Routines.lua
Utilities/Utils.lua
Core\Base
Core\Scheduler
Core\ScheduleDispatcher
Core\Event
Core\Menu
Core\Zone
Core\Database
Core\Set
Core\Point
Core\Message
Core\Fsm
Core\Radio
Core/Base.lua
Core/Scheduler.lua
Core/ScheduleDispatcher.lua
Core/Event.lua
Core/Menu.lua
Core/Zone.lua
Core/Database.lua
Core/Set.lua
Core/Point.lua
Core/Message.lua
Core/Fsm.lua
Core/Radio.lua
Wrapper\Object
Wrapper\Identifiable
Wrapper\Positionable
Wrapper\Controllable
Wrapper\Group
Wrapper\Unit
Wrapper\Client
Wrapper\Static
Wrapper\Airbase
Wrapper\Scenery
Wrapper/Object.lua
Wrapper/Identifiable.lua
Wrapper/Positionable.lua
Wrapper/Controllable.lua
Wrapper/Group.lua
Wrapper/Unit.lua
Wrapper/Client.lua
Wrapper/Static.lua
Wrapper/Airbase.lua
Wrapper/Scenery.lua
Functional\Scoring
Functional\CleanUp
Functional\Spawn
Functional\Movement
Functional\Sead
Functional\Escort
Functional\MissileTrainer
Functional\AirbasePolice
Functional\Detection
Functional/Scoring.lua
Functional/CleanUp.lua
Functional/Spawn.lua
Functional/Movement.lua
Functional/Sead.lua
Functional/Escort.lua
Functional/MissileTrainer.lua
Functional/AirbasePolice.lua
Functional/Detection.lua
AI\AI_Balancer
AI\AI_Patrol
AI\AI_Cap
AI\AI_Cas
AI\AI_Cargo
AI/AI_Balancer.lua
AI/AI_Patrol.lua
AI/AI_Cap.lua
AI/AI_Cas.lua
AI/AI_Cargo.lua
Actions\Act_Assign
Actions\Act_Route
Actions\Act_Account
Actions\Act_Assist
Actions/Act_Assign.lua
Actions/Act_Route.lua
Actions/Act_Account.lua
Actions/Act_Assist.lua
Tasking\CommandCenter
Tasking\Mission
Tasking\Task
Tasking\DetectionManager
Tasking\Task_A2G_Dispatcher
Tasking\Task_A2G
Tasking/CommandCenter.lua
Tasking/Mission.lua
Tasking/Task.lua
Tasking/DetectionManager.lua
Tasking/Task_A2G_Dispatcher.lua
Tasking/Task_A2G.lua
Moose.lua

35867
Moose Mission Setup/Moose.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -40,13 +40,6 @@ MooseLoader:close()
MooseFile:write( MooseLoaderText )
if MooseDynamicStatic == "D" then
MooseFile:write( "BASE:TraceOnOff( true )\n" )
end
if MooseDynamicStatic == "S" then
MooseFile:write( "BASE:TraceOnOff( false )\n" )
end
local MooseSourcesFile = io.open( MooseSourcesFilePath, "r" )
local MooseSource = MooseSourcesFile:read("*l")
@ -54,7 +47,7 @@ local MooseSource = MooseSourcesFile:read("*l")
while( MooseSource ) do
if MooseSource ~= "" then
local MooseFilePath = MooseDevelopmentPath .. "\\" .. MooseSource .. ".lua"
local MooseFilePath = MooseDevelopmentPath .. "/" .. MooseSource
if MooseDynamicStatic == "D" then
print( "Load dynamic: " .. MooseSource )
MooseFile:write( "__Moose.Include( '" .. MooseSource .. "' )\n" )
@ -72,6 +65,13 @@ while( MooseSource ) do
MooseSource = MooseSourcesFile:read("*l")
end
if MooseDynamicStatic == "D" then
MooseFile:write( "BASE:TraceOnOff( true )\n" )
end
if MooseDynamicStatic == "S" then
MooseFile:write( "BASE:TraceOnOff( false )\n" )
end
MooseFile:write( "env.info( '*** MOOSE INCLUDE END *** ' )\n" )
MooseSourcesFile:close()

View File

@ -1,3 +0,0 @@
local PlanesClientSet = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
local AirbasePolice = AIRBASEPOLICE_CAUCASUS:New( PlanesClientSet )

View File

@ -1,3 +0,0 @@
local PlanesClientSet = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
local AirbasePolice = AIRBASEPOLICE_NEVADA:New( PlanesClientSet )

View File

@ -1,10 +0,0 @@
Clean = CLEANUP:New( 'CLEAN_BATUMI', 180 )
SpawnRU = SPAWN:New( 'RU Attack Heli Batumi'):InitLimit( 2, 20 ):SpawnScheduled( 2, 0.2 )
SpawnUS = SPAWN:New( 'US Attack Heli Batumi'):InitLimit( 2, 20 ):SpawnScheduled( 2, 0.2 )

View File

@ -1,28 +0,0 @@
---
-- Name: AIB-001 - Spawned AI
-- Author: FlightControl
-- Date Created: 07 Dec 2016
--
-- # Situation:
--
-- For the red coalition, 2 client slots are foreseen.
-- We test the AI spawning frequency, validating the number of spawned AI,
-- matching the amount of players that not have joined the mission.
-- When players join, AI should fly to the nearest 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.
-- 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 )

View File

@ -1,43 +0,0 @@
-- 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

View File

@ -1,24 +0,0 @@
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 )

View File

@ -1,47 +0,0 @@
-- 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

View File

@ -1,51 +0,0 @@
-- 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

View File

@ -1,43 +0,0 @@
-- 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

View File

@ -1,163 +0,0 @@
-- 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

View File

@ -1,23 +0,0 @@
---
-- Name: CAP-001 - Combat Air Patrol
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
-- The Su-27 airplane will patrol in PatrolZone.
-- It will not engage any enemy automatically.
--
-- # Test cases:
--
-- 1. Observe the Su-27 patrolling.
--
local CapPlane = GROUP:FindByName( "Plane" )
local PatrolZone = ZONE:New( "Patrol Zone" )
AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 )
AICapZone:SetControllable( CapPlane )
AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.

View File

@ -1,27 +0,0 @@
---
-- Name: CAP-010 - CAP and Engage within Range
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
--
-- The Su-27 airplane will patrol in PatrolZone.
-- It will engage when it detects the airplane and when the A-10C is within the engage range.
--
-- # Test cases:
--
-- 1. Observe the Su-27 patrolling.
-- 2. Observe that, when the A-10C is within the engage range, it will engage.
-- 3. After engage, observe that the Su-27 returns to the PatrolZone.
-- 4. If you want, you can wait until the Su-27 is out of fuel and will land.
CapPlane = GROUP:FindByName( "Plane" )
PatrolZone = ZONE:New( "Patrol Zone" )
AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 )
AICapZone:SetControllable( CapPlane )
AICapZone:SetEngageRange( 20000 ) -- Set the Engage Range to 20.000 meters. The AI won't engage when the enemy is beyond 20.000 meters.
AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.

View File

@ -1,32 +0,0 @@
---
-- Name: CAP-011 - CAP and Engage within Zone
-- Author: FlightControl
-- Date Created: 16 January 2017
--
-- # Situation:
--
-- The Su-27 airplane will patrol in PatrolZone.
-- It will engage when it detects the airplane and when the A-10C is within the CapEngageZone.
--
-- # Test cases:
--
-- 1. Observe the Su-27 patrolling.
-- 2. Observe that, when the A-10C is within the engage zone, it will engage.
-- 3. After engage, observe that the Su-27 returns to the PatrolZone.
-- 4. If you want, you can wait until the Su-27 is out of fuel and will land.
CapPlane = GROUP:FindByName( "Plane" )
PatrolZone = ZONE:New( "Patrol Zone" )
AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 )
EngageZoneGroup = GROUP:FindByName( "Engage Zone" )
CapEngageZone = ZONE_POLYGON:New( "Engage Zone", EngageZoneGroup )
AICapZone:SetControllable( CapPlane )
AICapZone:SetEngageZone( CapEngageZone ) -- Set the Engage Zone. The AI will only engage when the bogeys are within the CapEngageZone.
AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.

View File

@ -1,43 +0,0 @@
---
-- Name: CAP-012 - CAP - Test Abort
-- Author: FlightControl
-- Date Created: 14 Mar 2017
--
-- # Situation:
--
-- The Su-27 airplane will patrol in PatrolZone.
-- It will engage when it detects the airplane and when the A-10C is within the CapEngageZone.
-- It will abort the engagement after 1 minute and return to the patrol zone.
--
-- # Test cases:
--
-- 1. Observe the Su-27 patrolling.
-- 2. Observe that, when the A-10C is within the engage zone, it will engage.
-- 3. After engage, observe that the Su-27 returns to the PatrolZone.
-- 4. When it engages, it will abort the engagement after 1 minute.
CapPlane = GROUP:FindByName( "Plane" )
PatrolZone = ZONE:New( "Patrol Zone" )
AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 )
EngageZoneGroup = GROUP:FindByName( "Engage Zone" )
CapEngageZone = ZONE_POLYGON:New( "Engage Zone", EngageZoneGroup )
AICapZone:SetControllable( CapPlane )
AICapZone:SetEngageZone( CapEngageZone ) -- Set the Engage Zone. The AI will only engage when the bogeys are within the CapEngageZone.
AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
function AICapZone:OnAfterEngage(Controllable,From,Event,To)
AICapZone:__Abort( 60 )
end
function AICapZone:OnAfterAbort(Controllable,From,Event,To)
BASE:E("MISSION ABORTED! Returning to Patrol Zone!")
MESSAGE:New("MISSION ABORTED! Returning to Patrol Zone!",30,"ALERT!")
end

View File

@ -1,27 +0,0 @@
---
-- Name: CAP-020 - Combat Air Patrol RTB Test
-- Author: FlightControl
-- Date Created: 14 February 2017
--
-- # Situation:
-- The Su-27 airplane will patrol in PatrolZone.
-- It will return to base when out of fuel.
--
-- # Test cases:
--
-- 1. Observe the Su-27 patrolling.
-- 2. It should return to base when out of fuel.
--
CapSpawn = SPAWN:New( "Plane" ):InitLimit(1,2):InitRepeatOnLanding()
CapGroup = CapSpawn:Spawn()
PatrolZone = ZONE:New( "Patrol Zone" )
AICapZone = AI_CAP_ZONE:New( PatrolZone, 500, 1000, 500, 600 )
AICapZone:SetControllable( CapGroup )
AICapZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.

View File

@ -1,74 +0,0 @@
---
-- Name: CAS-001 - CAS in a Zone by Airplane Group
-- Author: FlightControl
-- Date Created: 13 January 2017
--
-- # Situation:
--
-- A group of 4 Su-25T at patrolling north of an engage zone for 10 minutes.
-- After 10 minutes, the command center orders the Su-25T to engage the zone and execute a CAS.
--
-- # Test cases:
--
-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
-- 2. The Su-25T are not detecting any target during the patrol.
-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the Su-25T eliminating the targets.
-- 6. Observe the Su-25T defenses.
-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
-- 8. The Su-25T will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Plane" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 600 )
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,75 +0,0 @@
---
-- Name: CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed
-- Author: FlightControl
-- Date Created: 06 February 2017
--
-- # Situation:
--
-- A group of 4 Su-25T at patrolling north of an engage zone for 1 minute.
-- After 1 minute, the command center orders the Su-25T to engage the zone and execute a CAS.
--
-- # Test cases:
--
-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
-- 2. The Su-25T are not detecting any target during the patrol.
-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone.
-- 3.1. The approach speed to the engage zone is set to 400 km/h.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the Su-25T eliminating the targets.
-- 6. Observe the Su-25T defenses.
-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
-- 8. The Su-25T will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Plane" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 60, 400 ) -- Engage after one minute with a speed of 400 km/h.
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,76 +0,0 @@
---
-- Name: CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude
-- Author: FlightControl
-- Date Created: 6 February 2017
--
-- # Situation:
--
-- A group of 4 Su-25T at patrolling north of an engage zone for 1 minute.
-- After 1 minute, the command center orders the Su-25T to engage the zone and execute a CAS.
--
-- # Test cases:
--
-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
-- 2. The Su-25T are not detecting any target during the patrol.
-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone
-- 3.1. The approach speed to the engage zone is set to 400 km/h.
-- 3.2. The altitude to the engage zone and CAS execution is set to 500 meters.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the Su-25T eliminating the targets.
-- 6. Observe the Su-25T defenses.
-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
-- 8. The Su-25T will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Plane" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 600, 350, 4000 ) -- Engage after 10 minutes with a speed of 350 km/h and an altitude of 4000 meters.
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,81 +0,0 @@
---
-- Name: CAS-004 - CAS in a Zone by Airplane Group - Test Abort
-- Author: FlightControl
-- Date Created: 14 Mar 2017
--
-- # Situation:
--
-- A group of 4 Su-25T at patrolling north of an engage zone for 1 minute.
-- After 10 minutes, the command center orders the Su-25T to engage the zone and execute a CAS.
-- After 12 minutes, the mission is aborted.
--
-- # Test cases:
--
-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
-- 2. The Su-25T are not detecting any target during the patrol.
-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone
-- 3.1. The approach speed to the engage zone is set to 350 km/h.
-- 3.2. The altitude to the engage zone and CAS execution is set to 4000 meters.
-- 4. Observe the mission being aborted. A message will be sent.
-- 5. The Su-25T will go back patrolling.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Plane" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 600, 350, 4000 ) -- Engage after 10 minutes with a speed of 350 km/h and an altitude of 4000 meters.
-- After 12 minutes, tell the group CASPlane to abort the engagement.
AICasZone:__Abort( 720 ) -- Abort the engagement.
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
function AICasZone:OnAfterAbort(Controllable,From,Event,To)
BASE:E( "MISSION ABORT! Back to patrol zone." )
MESSAGE:New("Mission ABORTED! Back to the Patrol Zone!",30,"ALERT!"):ToAll()
end
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,78 +0,0 @@
---
-- Name: CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend
-- Author: FlightControl
-- Date Created: 18 Mar 2017
--
-- # Situation:
--
-- A group of 4 Su-25T at patrolling north of an engage zone for 1 minute.
-- After 1 minute, the command center orders the Su-25T to engage the zone and execute a CAS.
-- The planes should expend 4 weapons per run.
--
-- # Test cases:
--
-- 1. Observe that the Su-25T is patrolling in the patrol zone, until the engage command is given.
-- 2. The Su-25T are not detecting any target during the patrol.
-- 3. When the Su-25T is commanded to engage, the group will fly to the engage zone
-- 3.1. The approach speed to the engage zone is set to 400 km/h.
-- 3.2. The altitude to the engage zone and CAS execution is set to 500 meters.
-- 3.3. The planes should expend 4 weapons per run.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the Su-25T eliminating the targets.
-- 6. Observe the Su-25T defenses.
-- 7. When all targets within the engage zone are destroyed, the Su-25T CAS task is set to Accomplished.
-- 8. The Su-25T will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Plane" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 1 minute, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 60, 600, 8000, AI.Task.WeaponExpend.FOUR ) -- Engage with a speed of 600 km/h and an altitude of 8000 meters, weapn expend 4.
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,76 +0,0 @@
---
-- Name: CAS-010 - CAS in a Zone by Helicopter
-- Author: FlightControl
-- Date Created: 6 February 2017
--
-- # Situation:
--
-- A group of 1 Ka-50 patrolling north of an engage zone for 1 minute.
-- After 1 minute, the command center orders the Ka-50 to engage the zone and execute a CAS.
--
-- # Test cases:
--
-- 1. Observe that the Ka-50 is patrolling in the patrol zone, until the engage command is given.
-- 2. The Ka-50 are not detecting any target during the patrol.
-- 3. When the Ka-50 is commanded to engage, the group will fly to the engage zone.
-- 3.1. Engage Speed is set to 100 km/h.
-- 3.2. Engage Altitude is set to 150 meters.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the Ka-50 eliminating the targets.
-- 6. Observe the Ka-50 defenses.
-- 7. When all targets within the engage zone are destroyed, the Ka-50 CAS task is set to Accomplished.
-- 8. The Ka-50 will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Helicopter" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 60, 100, 150 )
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,75 +0,0 @@
---
-- Name: CAS-011 - CAS in a Zone by Helicopter Group
-- Author: FlightControl
-- Date Created: 6 February 2017
--
-- # Situation:
--
-- A group of 4 Ka-50 patrolling north of an engage zone for 1 minute.
-- After 1 minute, the command center orders the Ka-50 to engage the zone and execute a CAS.
--
-- # Test cases:
--
-- 1. Observe that the Ka-50 is patrolling in the patrol zone, until the engage command is given.
-- 2. The Ka-50 are not detecting any target during the patrol.
-- 3. When the Ka-50 is commanded to engage, the group will fly to the engage zone.
-- 3.1. Engage Speed is set to 100 km/h.
-- 3.2. Engage Altitude is set to 150 meters.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the Ka-50 eliminating the targets.
-- 6. Observe the Ka-50 defenses.
-- 7. When all targets within the engage zone are destroyed, the Ka-50 CAS task is set to Accomplished.
-- 8. The Ka-50 will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variable (in this case called CASPlane) and
-- using the GROUP function find the aircraft group called "Plane" and assign to this variable
CASPlane = GROUP:FindByName( "Helicopter" )
-- Create a local Variable (in this cased called PatrolZone and
-- using the ZONE function find the pre-defined zone called "Patrol Zone" and assign it to this variable
PatrolZone = ZONE:New( "Patrol Zone" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZone:SetControllable( CASPlane )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlane to engage the targets located in the engagement zone called CASEngagement Zone. (600 is 600 seconds)
AICasZone:__Engage( 60, 100, 150 )
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Plane will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
Check:Stop( CheckScheduleID )
AICasZone:__RTB( 1 )
end

View File

@ -1,91 +0,0 @@
---
-- Name: CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups
-- Author: FlightControl
-- Date Created: 6 February 2017
--
-- # Situation:
--
-- A group of 4 Ka-50 and 5 Su-25T are patrolling north in two engage zone for 5 minutes.
-- After 5 minutes, the command center orders the groups to engage the zone and execute a CAS.
--
-- # Test cases:
--
-- 1. Observe that the groups is patrolling in the patrol zone, until the engage command is given.
-- 2. The groups are not detecting any target during the patrol.
-- 3. When the groups is commanded to engage, the group will fly to the engage zone.
-- 3.1. Engage Speed for the Su-25T is set to 350 km/h.
-- 3.2. Engage Altitude for the Su-25T is set to 1500 meters.
-- 3.3. Engage Speed for the Ka-50 is set to 100 km/h.
-- 3.4. Engage Altitude for the Ka-50 is set to 150 meters.
-- 4. Detection is activated and detected targets within the engage zone are assigned for CAS.
-- 5. Observe the groups eliminating the targets.
-- 6. Observe the groups defenses.
-- 7. When all targets within the engage zone are destroyed, the groups CAS task is set to Accomplished.
-- 8. The groups will return to base.
-- Create a local variable (in this case called CASEngagementZone) and
-- using the ZONE function find the pre-defined zone called "Engagement Zone"
-- currently on the map and assign it to this variable
CASEngagementZone = ZONE:New( "Engagement Zone" )
-- Create a local variables (in this case called CASPlane and CASHelicopters) and
-- using the GROUP function find the aircraft group called "Plane" and "Helicopter" and assign to these variables
CASPlane = GROUP:FindByName( "Plane" )
CASHelicopter = GROUP:FindByName( "Helicopter" )
-- Create two patrol zones, one for the Planes and one for the Helicopters.
PatrolZonePlanes = ZONE:New( "Patrol Zone Planes" )
PatrolZoneHelicopters = ZONE:New( "Patrol Zone Helicopters" )
-- Create and object (in this case called AICasZone) and
-- using the functions AI_CAS_ZONE assign the parameters that define this object
-- (in this case PatrolZone, 500, 1000, 500, 600, CASEngagementZone)
AICasZonePlanes = AI_CAS_ZONE:New( PatrolZonePlanes, 400, 500, 500, 2500, CASEngagementZone )
AICasZoneHelicopters = AI_CAS_ZONE:New( PatrolZoneHelicopters, 100, 250, 300, 1000, CASEngagementZone )
-- Create an object (in this case called Targets) and
-- using the GROUP function find the group labeled "Targets" and assign it to this object
Targets = GROUP:FindByName("Targets")
-- Tell the program to use the object (in this case called CASPlane) as the group to use in the CAS function
AICasZonePlanes:SetControllable( CASPlane )
AICasZoneHelicopters:SetControllable( CASHelicopter )
-- Tell the group CASPlane to start the mission in 1 second.
AICasZonePlanes:__Start( 1 ) -- They should startup, and start patrolling in the PatrolZone.
AICasZoneHelicopters:__Start( 1 ) -- They should startup, and start patrolling in the PatrolZone.
-- After 10 minutes, tell the group CASPlanes and CASHelicopters to engage the targets located in the engagement zone called CASEngagement Zone.
AICasZonePlanes:__Engage( 300, 350, 1500 ) -- Engage with a speed of 350 km/h and 1500 meter altitude.
AICasZoneHelicopters:__Engage( 300, 100, 150 ) -- Engage with a speed of 100 km/h and 150 meter altitude.
-- Check every 60 seconds whether the Targets have been eliminated.
-- When the trigger completed has been fired, the Planes and Helicopters will go back to the Patrol Zone.
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E( "Test Mission: " .. Targets:GetSize() .. " targets left to be destroyed.")
else
BASE:E( "Test Mission: The required targets are destroyed." )
Check:Stop( CheckScheduleID )
AICasZonePlanes:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
AICasZoneHelicopters:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return home ...
function AICasZonePlanes:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Su-25T back to base." )
AICasZonePlanes:__RTB( 1 )
end
-- When the targets in the zone are destroyed, (see scheduled function), the helicpters will return home ...
function AICasZoneHelicopters:OnAfterAccomplish( Controllable, From, Event, To )
BASE:E( "Test Mission: Sending the Ka-50 back to base." )
AICasZoneHelicopters:__RTB( 1 )
end

View File

@ -1,11 +0,0 @@
CargoEngineer = UNIT:FindByName( "Engineer" )
InfantryCargo = AI_CARGO_UNIT:New( CargoEngineer, "Engineer", "Engineer Sven", "81", 2000, 25 )
CargoCarrier = UNIT:FindByName( "Carrier" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrier )

View File

@ -1,11 +0,0 @@
CargoEngineer = UNIT:FindByName( "Engineer" )
InfantryCargo = AI_CARGO_UNIT:New( CargoEngineer, "Engineer", "Engineer Sven", "81", 2000, 25 )
CargoCarrier = UNIT:FindByName( "Carrier" )
-- This will Load immediately the Cargo into the Carrier, regardless where the Cargo is.
InfantryCargo:Load( CargoCarrier )
-- This will Unboard the Cargo from the Carrier.
InfantryCargo:UnBoard()

View File

@ -1,25 +0,0 @@
CargoEngineer = UNIT:FindByName( "Engineer" )
InfantryCargo = AI_CARGO_UNIT:New( CargoEngineer, "Engineer", "Engineer Sven", "81", 2000, 25 )
CargoCarrierFrom = UNIT:FindByName( "CarrierFrom" )
CargoCarrierTo = UNIT:FindByName( "CarrierTo" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrierFrom )
-- Once the Cargo has been loaded into the Carrier, drive to a point and unload the Cargo.
function InfantryCargo:OnEnterLoaded()
self:__UnBoard( 1 )
self.OnEnterLoaded = nil
end
-- Once the Cargo has been unloaded from the Carrier (the Cargo has arrived to the unload gathering point), OnBoard the Cargo in the other Carrier.
function InfantryCargo:OnEnterUnLoaded()
self:__Board( 1, CargoCarrierTo )
self.OnEnterUnLoaded = nil
end

View File

@ -1,16 +0,0 @@
CargoSet = SET_BASE:New()
CargoSet:Add( "Engineer1", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer1" ), "Engineers", "Engineer", 81, 2000, 25 ) )
CargoSet:Add( "Engineer2", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer2" ), "Engineers", "Engineer", 64, 2000, 25 ) )
CargoSet:Add( "Engineer3", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer3" ), "Engineers", "Engineer", 72, 2000, 25 ) )
CargoSet:Add( "Engineer4", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer4" ), "Engineers", "Engineer", 69, 2000, 25 ) )
InfantryCargo = AI_CARGO_GROUPED:New( CargoSet, "Engineers", "Engineers", 2000, 25 )
CargoCarrier = UNIT:FindByName( "Carrier" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrier )

View File

@ -1,16 +0,0 @@
CargoSet = SET_BASE:New()
CargoSet:Add( "Engineer1", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer1" ), "Engineers", "Engineer", 81, 2000, 25 ) )
CargoSet:Add( "Engineer2", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer2" ), "Engineers", "Engineer", 64, 2000, 25 ) )
CargoSet:Add( "Engineer3", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer3" ), "Engineers", "Engineer", 72, 2000, 25 ) )
CargoSet:Add( "Engineer4", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer4" ), "Engineers", "Engineer", 69, 2000, 25 ) )
InfantryCargo = AI_CARGO_GROUPED:New( CargoSet, "Engineers", "Engineers", 2000, 25 )
CargoCarrier = UNIT:FindByName( "Carrier" )
-- This will Load immediately the Cargo into the Carrier, regardless where the Cargo is.
InfantryCargo:Load( CargoCarrier )
-- This will Unboard the Cargo from the Carrier.
InfantryCargo:UnBoard()

View File

@ -1,29 +0,0 @@
CargoSet = SET_BASE:New()
CargoSet:Add( "Engineer1", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer1" ), "Engineers", "Engineer", 81, 2000, 25 ) )
CargoSet:Add( "Engineer2", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer2" ), "Engineers", "Engineer", 64, 2000, 25 ) )
CargoSet:Add( "Engineer3", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer3" ), "Engineers", "Engineer", 72, 2000, 25 ) )
CargoSet:Add( "Engineer4", AI_CARGO_UNIT:New( UNIT:FindByName( "Engineer4" ), "Engineers", "Engineer", 69, 2000, 25 ) )
InfantryCargo = AI_CARGO_GROUPED:New( CargoSet, "Engineers", "Engineers", 2000, 25 )
CargoCarrierFrom = UNIT:FindByName( "CarrierFrom" )
CargoCarrierTo = UNIT:FindByName( "CarrierTo" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
InfantryCargo:Board( CargoCarrierFrom )
-- Once the Cargo has been loaded into the Carrier, drive to a point and unload the Cargo.
function InfantryCargo:OnEnterLoaded()
self:__UnBoard( 1 )
self.OnEnterLoaded = nil
end
-- Once the Cargo has been unloaded from the Carrier (the Cargo has arrived to the unload gathering point), OnBoard the Cargo in the other Carrier.
function InfantryCargo:OnEnterUnLoaded()
self:__Board( 1, CargoCarrierTo )
self.OnEnterUnLoaded = nil
end

View File

@ -1,11 +0,0 @@
DeliveryUnit = UNIT:FindByName( "Delivery" )
Letter = AI_CARGO_PACKAGE:New( DeliveryUnit, "Letter", "Secret Orders", "0.3", 2000, 25 )
CargoCarrier = UNIT:FindByName( "Carrier" )
-- This call will make the Cargo run to the CargoCarrier.
-- Upon arrival at the CargoCarrier, the Cargo will be Loaded into the Carrier.
-- This process is now fully automated.
Letter:Board( CargoCarrier, 40, 3, 25, 90 )

View File

@ -1,13 +0,0 @@
CargoEngineer = UNIT:FindByName( "Engineer" )
InfantryCargo = AI_CARGO_UNIT:New( CargoEngineer, "Engineer", "Engineer Sven", "81", 2000, 25 )
CargoCarrier = UNIT:FindByName( "Carrier" )
-- This will Load the Cargo into the Carrier, regardless where the Cargo is.
InfantryCargo:Load( CargoCarrier )
-- This will Unboard the Cargo from the Carrier.
-- The Cargo will run from the Carrier to a point in the NearRadius around the Carrier.
-- Unboard the Cargo with a speed of 10 km/h, go to 200 meters 180 degrees from the Carrier, iin a zone of 25 meters (NearRadius).
InfantryCargo:UnBoard( 10, 2, 20, 10, 180 )

View File

@ -1,24 +0,0 @@
---
-- Name: DET-001 - Detection Areas
-- Author: FlightControl
-- Date Created: 04 Feb 2017
--
-- # Situation:
--
-- A small blue vehicle with laser detection methods is detecting targets.
-- Targets are grouped within areas. A detection range and zone range is given to group the detected units.
-- This demo will group 5 red vehicles in areas. One vehicle is diving from one group to the other.
--
-- # Test cases:
--
-- 1. Observe the flaring of the areas formed
-- 2. Observe the smoking of the units detected
-- 3. Observe the areas being flexibly changed very detection run.
-- 4. The truck driving from the one group to the other, will leave the first area, and will join the second.
-- 5. While driving in between the areas, it will have a separate area.
FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC Group" ):FilterStart()
FACDetection = DETECTION_AREAS:New( FACSetGroup, 150, 250 ):BoundDetectedZones():SmokeDetectedUnits()
FACDetection:__Start( 5 )

View File

@ -1,56 +0,0 @@
---
-- Name: DET-100 - Detection Probability Distance
-- Author: FlightControl
-- Date Created: 04 Feb 2017
--
-- # Situation:
--
-- Demonstrates the DistanceProbability factor during the detection of units.
--
-- Two JTAC are detecting 4 units, which are 10 km away.
-- The first JTAC has no DistanceProbability set.
-- The second JTAC has a DistanceProbability set.
--
-- # Test cases:
--
-- 1. Observe the reporting of both the first and second JTAC. The second should report slower the detection than the first.
-- 2. Eventually all units should be detected by both JTAC.
RecceSetGroup1 = SET_GROUP:New():FilterPrefixes( "Recce 1" ):FilterStart()
RecceSetGroup2 = SET_GROUP:New():FilterPrefixes( "Recce 2" ):FilterStart()
HQ = GROUP:FindByName( "HQ" )
CC = COMMANDCENTER:New( HQ, "HQ" )
RecceDetection1 = DETECTION_UNITS:New( RecceSetGroup1 )
RecceDetection2 = DETECTION_UNITS:New( RecceSetGroup2 )
RecceDetection2:SetDistanceProbability( 0.2 ) -- Set a 20% probability that a vehicle can be detected at 4km distance.
RecceDetection1:Start()
RecceDetection2:Start()
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection1:OnAfterDetect(From,Event,To)
local DetectionReport = RecceDetection1:DetectedReportDetailed()
HQ:MessageToAll( DetectionReport, 15, "Detection 1 - No distance Probability" )
end
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection2:OnAfterDetect(From,Event,To)
local DetectionReport = RecceDetection2:DetectedReportDetailed()
HQ:MessageToAll( DetectionReport, 15, "Detection 2 - Distance Probability" )
end

View File

@ -1,9 +0,0 @@
FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC Group" ):FilterStart()
FACDetection = DETECTION_AREAS:New( FACSetGroup, 1000, 250 )
SeadClientSet = SET_CLIENT:New():FilterCoalitions( "blue" ):FilterStart()
DestroyClientSet = SET_CLIENT:New():FilterCoalitions( "blue" ):FilterStart()
FACReporting = FAC_REPORTING:New( FACClientSet, FACDetection )

View File

@ -1,62 +0,0 @@
---
-- Name: DET-120 - Detection Probability Zones
-- Author: FlightControl
-- Date Created: 04 Feb 2017
--
-- # Situation:
--
-- Demonstrates the DistanceProbability factor during the detection of units.
--
-- Two JTAC are detecting 4 units, which are 10 km away.
-- The first JTAC has no DistanceProbability set.
-- The second JTAC has a DistanceProbability set.
--
-- # Test cases:
--
-- 1. Observe the reporting of both the first and second JTAC. The second should report slower the detection than the first.
-- 2. Eventually all units should be detected by both JTAC.
RecceSetGroup1 = SET_GROUP:New():FilterPrefixes( "Recce 1" ):FilterStart()
RecceSetGroup2 = SET_GROUP:New():FilterPrefixes( "Recce 2" ):FilterStart()
HQ = GROUP:FindByName( "HQ" )
CC = COMMANDCENTER:New( HQ, "HQ" )
RecceDetection1 = DETECTION_UNITS:New( RecceSetGroup1 )
RecceDetection2 = DETECTION_UNITS:New( RecceSetGroup2 )
ForestZone = ZONE_POLYGON:New( "ForestZone", GROUP:FindByName( "ForestZone" ) )
RecceDetection2:SetZoneProbability( { { ForestZone, 0.1 } } ) -- Set a 10% probability that a vehicle can be detected within the forest.
RecceDetection1:Start()
RecceDetection2:Start()
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection1:OnAfterDetect(From,Event,To)
local DetectionReport = self:DetectedReportDetailed()
HQ:MessageToAll( DetectionReport, 15, "Detection 1 - No Zone Probability" )
end
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection2:OnAfterDetect(From,Event,To)
local DetectionReport = self:DetectedReportDetailed()
HQ:MessageToAll( DetectionReport, 15, "Detection 2 - Forest Zone Probability" )
end
garbagecollect()

View File

@ -1,42 +0,0 @@
---
-- Name: DET-200 - Detection UNITS
-- Author: FlightControl
-- Date Created: 13 Feb 2017
--
-- # Situation:
--
-- Demonstrates the detection of units.
--
-- A Set of Recce are detecting a large group of units, which are 5 km away.
-- Select one of the blue Recce, and press F7. Watch the reporting of the detection evolve.
-- The enemy is approaching.
--
-- # Test cases:
--
-- 1. Observe the detection reporting of both the Recce.
-- 2. Eventually all units should be detected by both Recce.
RecceSetGroup = SET_GROUP:New():FilterPrefixes( "Recce" ):FilterStart()
HQ = GROUP:FindByName( "HQ" )
CC = COMMANDCENTER:New( HQ, "HQ" )
RecceDetection = DETECTION_UNITS:New( RecceSetGroup )
RecceDetection:Start()
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection:OnAfterDetect(From,Event,To)
self:E("Detect")
local DetectionReport = RecceDetection:DetectedReportDetailed()
CC:MessageToAll( DetectionReport, 15, "" )
end

View File

@ -1,42 +0,0 @@
---
-- Name: DET-210 - Detection TYPES
-- Author: FlightControl
-- Date Created: 13 Feb 2017
--
-- # Situation:
--
-- Demonstrates the detection of units.
--
-- A Set of Recce are detecting a large group of units, which are 5 km away.
-- Select one of the blue Recce, and press F7. Watch the reporting of the detection evolve.
-- The enemy is approaching.
--
-- The blue Recce will report the detected units grouped per vehicle type!
--
-- # Test cases:
--
-- 1. Observe the detection reporting of both the Recce.
-- 2. Eventually all units should be detected by both Recce.
RecceSetGroup = SET_GROUP:New():FilterPrefixes( "Recce" ):FilterStart()
HQ = GROUP:FindByName( "HQ" )
CC = COMMANDCENTER:New( HQ, "HQ" )
RecceDetection = DETECTION_TYPES:New( RecceSetGroup )
RecceDetection:Start()
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection:OnAfterDetect(From,Event,To)
local DetectionReport = RecceDetection:DetectedReportDetailed()
CC:MessageToAll( DetectionReport, 15, "" )
end

View File

@ -1,58 +0,0 @@
---
-- Name: DET-100 - Detection Probability Distance
-- Author: FlightControl
-- Date Created: 04 Feb 2017
--
-- # Situation:
--
-- Demonstrates the DistanceProbability factor during the detection of units.
--
-- Two JTAC are detecting 4 units, which are 10 km away.
-- The first JTAC has no DistanceProbability set.
-- The second JTAC has a DistanceProbability set.
--
-- # Test cases:
--
-- 1. Observe the reporting of both the first and second JTAC. The second should report slower the detection than the first.
-- 2. Eventually all units should be detected by both JTAC.
RecceSetGroup1 = SET_GROUP:New():FilterPrefixes( "Recce 1" ):FilterStart()
RecceSetGroup2 = SET_GROUP:New():FilterPrefixes( "Recce 2" ):FilterStart()
HQ = GROUP:FindByName( "HQ" )
CC = COMMANDCENTER:New( HQ, "HQ" )
RecceDetection1 = DETECTION_AREAS:New( RecceSetGroup1, 1000 )
RecceDetection1:BoundDetectedZones()
RecceDetection2 = DETECTION_AREAS:New( RecceSetGroup2, 1000 )
RecceDetection2:SetDistanceProbability( 0.2 ) -- Set a 20% probability that a vehicle can be detected at 4km distance.
RecceDetection1:BoundDetectedZones()
RecceDetection1:Start()
RecceDetection2:Start()
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection1:OnAfterDetect(From,Event,To)
local DetectionReport = RecceDetection1:DetectedReportDetailed()
HQ:MessageToAll( DetectionReport, 15, "Detection 1 - No distance Probability" )
end
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection2:OnAfterDetect(From,Event,To)
local DetectionReport = RecceDetection2:DetectedReportDetailed()
HQ:MessageToAll( DetectionReport, 15, "Detection 2 - Distance Probability" )
end

View File

@ -1,46 +0,0 @@
---
-- Name: DET-255 - Detection AEAS with Destroys
-- Author: FlightControl
-- Date Created: 06 Mar 2017
--
-- # Situation:
--
-- A small blue vehicle with laser detection methods is detecting targets.
-- Targets are grouped within areas. A detection range and zone range is given to group the detected units.
-- This demo will group red vehicles in areas. One vehicle is diving from one group to the other.
-- After 30 seconds, one vehicle is destroyed in a zone.
-- After 60 seconds, a vehicle is destroyed that is a leader of a zone.
-- After 90 seconds, all vehicles are destroyed in a zone.
--
-- # Test cases:
--
-- 1. Observe the flaring of the areas formed
-- 2. Observe the smoking of the units detected
-- 3. Observe the areas being flexibly changed very detection run.
-- 4. The truck driving from the one group to the other, will leave the first area, and will join the second.
-- 5. While driving in between the areas, it will have a separate area.
-- 6. Observe the correct removal or relocation of the ZONEs.
FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC Group" ):FilterStart()
FACDetection = DETECTION_AREAS:New( FACSetGroup, 150, 250 ):BoundDetectedZones():SmokeDetectedUnits()
FACDetection:__Start( 5 )
SCHEDULER:New( nil,function()
local Target = UNIT:FindByName( "Target #004")
Target:Destroy()
end, {}, 30
)
SCHEDULER:New( nil,function()
local Target = UNIT:FindByName( "Target #006")
Target:Destroy()
end, {}, 60
)
SCHEDULER:New( nil,function()
local Target = UNIT:FindByName( "Target #007")
Target:Destroy()
end, {}, 90
)

View File

@ -1,70 +0,0 @@
---
-- Name: DET-500 - Handle Detected Event - Govern Artillery Demo
-- Author: FlightControl
-- Date Created: 13 Feb 2017
--
-- # Situation:
--
-- Demonstrates the detection of units.
--
-- A Set of Recces are detecting a large group of units, which are 5 km away.
-- Once the Recces detect the enemy, the artilley units are controlled and will fire a missile to the target.
--
-- # Test cases:
--
-- 1. Observe the detected reporting of the recces.
-- 2. When one Recce group detects a target, it will select an artillery unit and fire a missile.
-- 3. This will run until all Recces have eliminated the targets.
RecceSetGroup = SET_GROUP:New():FilterCoalitions( "blue" ):FilterPrefixes( "Recce" ):FilterStart()
ArtillerySetGroup = SET_GROUP:New():FilterCoalitions( "blue" ):FilterPrefixes( "Artillery" ):FilterStart()
HQ = GROUP:FindByName( "HQ" )
CC = COMMANDCENTER:New( HQ, "HQ" )
RecceDetection = DETECTION_UNITS:New( RecceSetGroup )
RecceDetection:SetDetectionInterval( 5 )
RecceDetection:Start()
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
function RecceDetection:OnAfterDetect(From,Event,To)
local DetectionReport = RecceDetection:DetectedReportDetailed()
CC:GetPositionable():MessageToAll( DetectionReport, 15, "" )
end
local ArtilleryTime = {}
local ArtilleryAim = 180
--- OnAfter Transition Handler for Event Detect.
-- @param Functional.Detection#DETECTION_UNITS self
-- @param #string From The From State string.
-- @param #string Event The Event string.
-- @param #string To The To State string.
-- @param Wrapper.Unit#UNIT DetectedUnits
function RecceDetection:OnAfterDetected( From, Event, To, DetectedUnits )
self:E( { From, Event, To, DetectedUnits } )
for DetectedUnitID, DetectedUnit in pairs( DetectedUnits ) do
local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
local Artillery = ArtillerySetGroup:GetRandom() -- Wrapper.Group#GROUP
if ArtilleryTime[Artillery] and ArtilleryTime[Artillery] <= timer.getTime() - ArtilleryAim then
ArtilleryTime[Artillery] = nil
end
if not ArtilleryTime[Artillery] then
local Task = Artillery:TaskFireAtPoint( DetectedUnit:GetVec2(), 500, 4 ) -- Fire 2 rockets to the target point.
Artillery:SetTask( Task, 0.5 )
ArtilleryTime[Artillery] = timer.getTime()
end
end
end

View File

@ -1,25 +0,0 @@
---
-- Name: DET-900 - Detection Test with RED FACA
-- Author: FlightControl
-- Date Created: 06 Mar 2017
--
-- # Situation:
--
-- A red FACA is detecting targets while airborne.
-- Targets are grouped within areas. A detection range and zone range is given to group the detected units.
-- This demo will group blue vehicles in areas.
-- Upon the detection capabilities of the red FACA, the blue vehicles will be grouped when detected.
-- All blue vehicles have ROE on hold.
--
-- # Test cases:
--
-- 1. Observe the tyres put around the detected areas formed
-- 2. Observe the smoking of the units detected
-- 3. Observe the areas being flexibly changed very detection run.
FACSetGroup = SET_GROUP:New():FilterPrefixes( "FAC" ):FilterStart()
FACDetection = DETECTION_AREAS:New( FACSetGroup, 2000, 250 ):BoundDetectedZones():SmokeDetectedUnits()
FACDetection:__Start( 5 )

View File

@ -1,89 +0,0 @@
---
-- Name: ESC-001 - Escorting Helicopters
-- Author: FlightControl
-- Date Created: 10 Mar 2017
--
-- # Situation:
--
-- Your client helicopter is flying in the battle field.
-- It is escorted by an MI-28N, which you can command...
-- Use the menu options to:
-- - Make the escort follow you.
-- - Report detected targets.
-- - Attack targets
-- - Flare
--
-- # Test cases:
--
-- 1. When executing the commands, observe the MI-28N reactions.
do
local function EventAliveHelicopter( Client )
local EscortGroupHeli1 = SpawnEscortHeli:ReSpawn(1)
local EscortHeli1 = ESCORT
:New( Client, EscortGroupHeli1, "Escort Helicopter" )
:MenuFollowAt( 100 )
:MenuFollowAt( 200 )
:MenuHoldAtEscortPosition( 20, 10, "Hold at %d meters for %d seconds" )
:MenuHoldAtLeaderPosition( 120 )
:MenuFlare( "Disperse Flares" )
:MenuSmoke()
:MenuReportTargets( 60, 20 )
:MenuResumeMission()
:MenuROE()
:MenuAssistedAttack()
EscortHeli1:SetDetection( EscortHeliDetection )
local EscortGroupArtillery = SpawnEscortArtillery:ReSpawn(1)
local EscortArtillery = ESCORT
:New( Client, EscortGroupArtillery, "Escort Artillery" )
:Menus()
end
local function EventAlivePlane( Client )
local EscortGroupPlane2 = SpawnEscortPlane:ReSpawn(1)
local EscortPlane2 = ESCORT
:New( Client, EscortGroupPlane2, "Escort Test Plane" )
:MenuFollowAt( 100 )
:MenuFollowAt( 200 )
:MenuHoldAtEscortPosition( 20, 10, "Hold at %d meters for %d seconds" )
:MenuHoldAtLeaderPosition( 120 )
:MenuFlare( "Disperse Flares" )
:MenuSmoke()
:MenuReportTargets( 60, 20 )
:MenuResumeMission()
:MenuAssistedAttack()
:MenuROE()
:MenuEvasion()
local EscortGroupGround2 = SpawnEscortGround:ReSpawn(1)
local EscortGround2 = ESCORT
:New( Client, EscortGroupGround2, "Test Ground" )
:Menus()
local EscortGroupShip2 = SpawnEscortShip:ReSpawn(1)
local EscortShip2 = ESCORT
:New( Client, EscortGroupShip2, "Test Ship" )
:Menus()
end
SpawnEscortHeli = SPAWN:New( "Escort Helicopter" )
SpawnEscortPlane = SPAWN:New( "Escort Plane" )
SpawnEscortGround = SPAWN:New( "Escort Ground" )
SpawnEscortShip = SPAWN:New( "Escort Ship" )
SpawnEscortArtillery = SPAWN:New( "Ground Attack Assistance" )
EscortHeliSetGroup = SET_GROUP:New():FilterPrefixes("Escort Helicopter"):FilterStart()
EscortHeliDetection = DETECTION_AREAS:New( EscortHeliSetGroup, 1000, 500 )
EscortHeliDetection:BoundDetectedZones()
EscortHeliDetection:SetDetectionInterval( 15 )
EscortClientHeli = CLIENT:FindByName( "Lead Helicopter", "Fly around and observe the behaviour of the escort helicopter" ):Alive( EventAliveHelicopter )
EscortClientPlane = CLIENT:FindByName( "Lead Plane", "Fly around and observe the behaviour of the escort airplane. Select Navigate->Joun-Up and airplane should follow you. Change speed and directions." )
:Alive( EventAlivePlane )
end
env.info( "Test Mission loaded" )

View File

@ -1,40 +0,0 @@
---
-- Name: EVT-001 - API Demo 1
-- Author: FlightControl
-- Date Created: 7 February 2017
--
-- # Situation:
--
-- A task shoots another tank. If one of the is dead, the event will be catched.
--
-- # Test cases:
--
-- 1. Observe the tanks shooting each other.
-- 2. If one of the tanks die, an event will be catched.
-- 3. Observe the surviving unit smoking.
local Tank1 = UNIT:FindByName( "Tank A" )
local Tank2 = UNIT:FindByName( "Tank B" )
Tank1:HandleEvent( EVENTS.Dead )
Tank2:HandleEvent( EVENTS.Dead )
--- @param Wrapper.Unit#UNIT self
function Tank1:OnEventDead( EventData )
self:SmokeGreen()
end
--- @param Wrapper.Unit#UNIT self
function Tank2:OnEventDead( EventData )
self:SmokeBlue()
end
function Tank2:OnEventCrash(EventData)
end

View File

@ -1,25 +0,0 @@
---
-- Name: EVT-100 - UNIT OnEventShot Example
-- Author: FlightControl
-- Date Created: 7 Feb 2017
--
-- # Situation:
--
-- A plane is flying in the air and shoots an missile to a ground target.
--
-- # Test cases:
--
-- 1. Observe the plane shooting the missile.
-- 2. Observe when the plane shoots the missile, a dcs.log entry is written in the logging.
-- 3. Check the contents of the fields of the S_EVENT_SHOT entry.
Plane = UNIT:FindByName( "Plane" )
Plane:HandleEvent( EVENTS.Shot )
function Plane:OnEventShot( EventData )
Plane:MessageToAll( "I just fired a missile!", 15, "Alert!" )
end

View File

@ -1,32 +0,0 @@
---
-- Name: EVT-101 - UNIT OnEventHit Example
-- Author: FlightControl
-- Date Created: 7 Feb 2017
--
-- # Situation:
--
-- A plane is flying in the air and shoots an missile to a ground target.
--
-- # Test cases:
--
-- 1. Observe the plane shooting the missile.
-- 2. Observe when the missile hits the target, a dcs.log entry is written in the logging.
-- 3. Check the contents of the fields of the S_EVENT_HIT entry.
Plane = UNIT:FindByName( "Plane" )
Tank = UNIT:FindByName( "Tank" )
Plane:HandleEvent( EVENTS.Hit )
Tank:HandleEvent( EVENTS.Hit )
function Plane:OnEventHit( EventData )
Plane:MessageToAll( "I just got hit!", 15, "Alert!" )
end
function Tank:OnEventHit( EventData )
Tank:MessageToAll( "I just got hit!", 15, "Alert!" )
end

View File

@ -1,33 +0,0 @@
---
-- Name: EVT-102 - UNIT OnEventTakeoff Example
-- Author: FlightControl
-- Date Created: 7 Feb 2017
--
-- # Situation:
--
-- A human plane and an AI plane are taking off from an airfield.
--
-- # Test cases:
--
-- 1. Take-Off the planes from the runway.
-- 2. When the planes take-off, observe the message being sent.
-- 3. Check the contents of the fields of the S_EVENT_TAKEOFF entry in the dcs.log file.
PlaneAI = UNIT:FindByName( "PlaneAI" )
PlaneHuman = UNIT:FindByName( "PlaneHuman" )
PlaneAI:HandleEvent( EVENTS.Takeoff )
PlaneHuman:HandleEvent( EVENTS.Takeoff )
function PlaneAI:OnEventTakeoff( EventData )
PlaneHuman:MessageToAll( "AI Taking Off", 15, "Alert!" )
end
function PlaneHuman:OnEventTakeoff( EventData )
PlaneHuman:MessageToAll( "Player " .. PlaneHuman:GetPlayerName() .. " is Taking Off", 15, "Alert!" )
end

View File

@ -1,38 +0,0 @@
---
-- Name: EVT-103 - UNIT OnEventLand Example
-- Author: FlightControl
-- Date Created: 7 Feb 2017
--
-- # Situation:
--
-- An AI plane is landing on an airfield.
-- When the plane landed, a new plane is spawned.
--
-- # Test cases:
--
-- 1. Observe the plane landing.
-- 2. When the AI plane lands, observe the new plane being spawned.
-- 3. Check the contents of the fields of the S_EVENT_LAND entry in the dcs.log file.
-- Create a variable PlaneAI that holds a reference to UNIT object (created by moose at the beginning of the mission) with the name "PlaneAI".
PlaneAI = UNIT:FindByName( "PlaneAI" )
-- Create a SPAWN object to spawn a new plane once the hold one lands.
SpawnPlane = SPAWN:New( "SpawnPlaneAI" )
-- Declare a new variable that will hold the new spawned SpawnPlaneAI
local NewPlane
-- Subscribe to the event Land. The Land event occurs when a plane lands at an airfield.
PlaneAI:HandleEvent( EVENTS.Land )
-- Because the PlaneAI object is subscribed to the Land event, the following method will be automatically
-- called when the land event is happening FOR THE PlaneAI UNIT only!
function PlaneAI:OnEventLand( EventData )
-- Okay, the PlaneAI has landed, now spawn the new plane ( a predator )
NewPlane = SpawnPlane:Spawn()
end

Some files were not shown because too many files have changed in this diff Show More