mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Merge remote-tracking branch 'refs/remotes/origin/master' into FlightControl
# Conflicts: # Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua # Moose Mission Setup/Moose.lua # Moose Test Missions/ABP - Airbase Police/APL-001 - Caucasus/APL-001 - Caucasus.miz # Moose Test Missions/ABP - Airbase Police/APL-002 - Nevada/APL-002 - Nevada.miz # Moose Test Missions/ACL - Airbase Cleaner/ACL-001 - Airbase CleanUp/ACL-001 - Airbase CleanUp.miz # Moose Test Missions/AIB - AI Balancing/AIB-001 - Spawned AI/AIB-001 - Spawned AI.miz # Moose Test Missions/AIB - AI Balancing/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz # Moose Test Missions/AIB - AI Balancing/AIB-003 - Two coalitions InitCleanUp test/AIB-003 - Two coalitions InitCleanUp test.miz # Moose Test Missions/AIB - AI Balancing/AIB-004 - Respawn Test when Destroyed/AIB-004 - Respawn Test when Destroyed.miz # Moose Test Missions/AIB - AI Balancing/AIB-005 - Patrol AI and Randomize Zones/AIB-005 - Patrol AI and Randomize Zones.miz # Moose Test Missions/AIB - AI Balancing/AIB-006 - Declutter AI at Airbases/AIB-006 - Declutter AI at Airbases.miz # Moose Test Missions/CAP - Combat Air Patrol/CAP-001 - Combat Air Patrol/CAP-001 - Combat Air Patrol.miz # Moose Test Missions/CAP - Combat Air Patrol/CAP-010 - CAP and Engage within Range/CAP-010 - CAP and Engage within Range.miz # Moose Test Missions/CAP - Combat Air Patrol/CAP-011 - CAP and Engage within Zone/CAP-011 - CAP and Engage within Zone.miz # Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a ZONE-ME Test.miz # Moose Test Missions/CAS - Close Air Support/CAS-001 - CAS in a Zone by Airplane Group/CAS-001 - CAS in a Zone by Airplane Group.miz # Moose Test Missions/CAS - Close Air Support/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed/CAS-002 - CAS in a Zone by Airplane Group - Engage with Speed.miz # Moose Test Missions/CAS - Close Air Support/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude/CAS-003 - CAS in a Zone by Airplane Group - Engage with Speed and Altitude.miz # Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz # Moose Test Missions/CAS - Close Air Support/CAS-011 - CAS in a Zone by Helicopter Group/CAS-011 - CAS in a Zone by Helicopter Group.miz # Moose Test Missions/CAS - Close Air Support/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups/CAS-111 - Multiple CAS in 1 Radius Zone by Helicopter and AirPlane Groups.miz # Moose Test Missions/CGO - Cargo/CGO-001 - Unit Boarding/CGO-001 - Unit Boarding.miz # Moose Test Missions/CGO - Cargo/CGO-002 - Unit Unboarding/CGO-002 - Unit Unboarding.miz # Moose Test Missions/CGO - Cargo/CGO-003 - Unit Transferring/CGO-003 - Unit Transferring.miz # Moose Test Missions/CGO - Cargo/CGO-101 - Group Boarding/CGO-101 - Group Boarding.miz # Moose Test Missions/CGO - Cargo/CGO-102 - Group Unboarding/CGO-102 - Group Unboarding.miz # Moose Test Missions/CGO - Cargo/CGO-103 - Group Transferring/CGO-103 - Group Transferring.miz # Moose Test Missions/CGO - Cargo/CGO-201 - Package Boarding/CGO-201 - Package Boarding.miz # Moose Test Missions/CGO - Cargo/CGO-202 - Package Unboarding/CGO-202 - Package Unboarding.miz # Moose Test Missions/DET - Detection/DET-001 - Detection Areas/DET-001 - Detection Areas.miz # Moose Test Missions/DET - Detection/DET-101 - Detection Reporting/DET-101 - Detection Reporting.miz # Moose Test Missions/ESC - Escorting/ESC-001 - Escorting Helicopters/ESC-001 - Escorting Helicopters.miz # Moose Test Missions/EVT - Event Handling/EVT-001 - API Demo 1/EVT-001 - API Demo 1.miz # Moose Test Missions/EVT - Event Handling/EVT-100 - OnEventShot Example/EVT-100 - OnEventShot Example.miz # Moose Test Missions/EVT - Event Handling/EVT-101 - OnEventHit Example/EVT-101 - OnEventHit Example.miz # Moose Test Missions/EVT - Event Handling/EVT-102 - OnEventTakeoff Example/EVT-102 - OnEventTakeoff Example.miz # Moose Test Missions/EVT - Event Handling/EVT-103 - OnEventLand Example/EVT-103 - OnEventLand Example.miz # Moose Test Missions/EVT - Event Handling/EVT-104 - OnEventCrash Example/EVT-104 - OnEventCrash Example.miz # Moose Test Missions/FSM - Finite State Machine/FSM-100 - Transition Explanation/FSM-100 - Transition Explanation.miz # Moose Test Missions/GRP - Group Commands/GRP-200 - Follow Group/GRP-200 - Follow Group.miz # Moose Test Missions/GRP - Group Commands/GRP-300 - Switch WayPoints/GRP-300 - Switch WayPoints.miz # Moose Test Missions/GRP - Group Commands/Moose_Test_WRAPPER.miz # Moose Test Missions/MEN - Menu Options/MEN-001 - Menu Client/MEN-001 - Menu Client.miz # Moose Test Missions/MEN - Menu Options/MEN-002 - Menu Coalition/MEN-002 - Menu Coalition.miz # Moose Test Missions/MEN - Menu Options/MEN-003 - Menu Group/MEN-003 - Menu Group.miz # Moose Test Missions/MIT - Missile Trainer/MIT-001 - Missile Trainer/MIT-001 - Missile Trainer.miz # Moose Test Missions/MOOSE_Test_Template.miz # Moose Test Missions/PAT - Patrolling/PAT-001 - Switching Patrol Zones/PAT-001 - Switching Patrol Zones.miz # Moose Test Missions/SCH - Scheduler/SCH-000 - Simple Scheduling/SCH-000 - Simple Scheduling.miz # Moose Test Missions/SCH - Scheduler/SCH-001 - Simple Object Scheduling/SCH-001 - Simple Object Scheduling.miz # Moose Test Missions/SCH - Scheduler/SCH-100 - Simple Repeat Scheduling/SCH-100 - Simple Repeat Scheduling.miz # Moose Test Missions/SCH - Scheduler/SCH-110 - Object Repeat Scheduling/SCH-110 - Object Repeat Scheduling.miz # Moose Test Missions/SCH - Scheduler/SCH-200 - Simple Repeat Scheduling Stop and Start/SCH-200 - Simple Repeat Scheduling Stop and Start.miz # Moose Test Missions/SCH - Scheduler/SCH-300 - GC Simple Object Scheduling/SCH-300 - GC Simple Object Scheduling.miz # Moose Test Missions/SCH - Scheduler/SCH-310 - GC Object Repeat Scheduling/SCH-310 - GC Object Repeat Scheduling.miz # Moose Test Missions/SET - Data Sets/SET-001 - Airbase Sets/SET-001 - Airbase Sets.miz # Moose Test Missions/SET - Data Sets/SET-101 - Group Sets/SET-101 - Group Sets.miz # Moose Test Missions/SET - Data Sets/SET-201 - Client Sets/SET-201 - Client Sets.miz # Moose Test Missions/SEV - SEAD Evasion/SEV-001 - SEAD Evasion/SEV-001 - SEAD Evasion.miz # Moose Test Missions/SPA - Spawning/SPA-010 - Spawn Demo/SPA-010 - Spawn Demo.miz # Moose Test Missions/SPA - Spawning/SPA-011 - Ground Ops - Simple Spawning/SPA-011 - Ground Ops - Simple Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-012 - Ground Ops - Multiple Spawns/SPA-012 - Ground Ops - Multiple Spawns.miz # Moose Test Missions/SPA - Spawning/SPA-013 - Ground Ops - Scheduled Spawns/SPA-013 - Ground Ops - Scheduled Spawns.miz # Moose Test Missions/SPA - Spawning/SPA-014 - Ground Ops - Scheduled Spawns Limited/SPA-014 - Ground Ops - Scheduled Spawns Limited.miz # Moose Test Missions/SPA - Spawning/SPA-015 - Ground Ops - Randomize Route/SPA-015 - Ground Ops - Randomize Route.miz # Moose Test Missions/SPA - Spawning/SPA-016 - Ground Ops - Randomize Zones/SPA-016 - Ground Ops - Randomize Zones.miz # Moose Test Missions/SPA - Spawning/SPA-017 - Ground Ops - Set AI inactive while spawning/SPA-017 - Ground Ops - Set AI inactive while spawning.miz # Moose Test Missions/SPA - Spawning/SPA-018 - Ground Ops - Randomize Templates/SPA-018 - Ground Ops - Randomize Templates.miz # Moose Test Missions/SPA - Spawning/SPA-100 - CleanUp Inactive Units/SPA-100 - CleanUp Inactive Units.miz # Moose Test Missions/SPA - Spawning/SPA-110 - Limit Spawning/SPA-110 - Limit Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-120 - Repeat Spawning/SPA-120 - Repeat Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit/SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit.miz # Moose Test Missions/SPA - Spawning/SPA-130 - Uncontrolled Spawning/SPA-130 - Uncontrolled Spawning.miz # Moose Test Missions/SPA - Spawning/SPA-200 - Randomize Unit Types/SPA-200 - Randomize Unit Types.miz # Moose Test Missions/SPA - Spawning/SPA-220 - Randomize Zones/SPA-220 - Randomize Zones.miz # Moose Test Missions/SPA - Spawning/SPA-310 - Spawn at Static position/SPA-310 - Spawn at Static position.miz # Moose Test Missions/SPA - Spawning/SPA-320 - Spawn at Unit position/SPA-320 - Spawn at Unit position.miz # Moose Test Missions/SPA - Spawning/SPA-330 - Spawn at Vec2 position/SPA-330 - Spawn at Vec2 position.miz # Moose Test Missions/SPA - Spawning/SPA-340 - Spawn at Vec3 position/SPA-340 - Spawn at Vec3 position.miz # Moose Test Missions/TAD - Task Dispatching/TAD-010 - Task Dispatching Demo/TAD-010 - Task Dispatching Demo.miz # Moose Test Missions/TSK - Task Modelling/TSK-010 - Task Modelling - SEAD/TSK-010 - Task Modelling - SEAD.miz # Moose Test Missions/TSK - Task Modelling/TSK-020 - Task Modelling - Pickup/TSK-020 - Task Modelling - Pickup.miz # Moose Test Missions/ZON - Zones/ZON-100 - Normal Zone/ZON-100 - Normal Zone.miz # Moose Test Missions/ZON - Zones/ZON-200 - Group Zone/ZON-200 - Group Zone.miz # Moose Test Missions/ZON - Zones/ZON-300 - Unit Zone/ZON-300 - Unit Zone.miz # Moose Test Missions/ZON - Zones/ZON-400 - Radius Zone/ZON-400 - Radius Zone.miz # Moose Test Missions/ZON - Zones/ZON-500 - Polygon Zone/ZON-500 - Polygon Zone.miz # Moose Test Missions/ZON - Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones/ZON-510 - Send message if Clients fly the first time in the Polygon Zones.miz
This commit is contained in:
commit
5c090b108c
1
.gitignore
vendored
1
.gitignore
vendored
@ -224,3 +224,4 @@ _gsdata_/
|
||||
#GITHUB
|
||||
.gitattributes
|
||||
.gitignore
|
||||
Moose Test Missions/MOOSE_Test_Template.miz
|
||||
|
||||
@ -601,7 +601,7 @@ function AI_PATROL_ZONE:onafterStart( Controllable, From, Event, To )
|
||||
self.Controllable:OnReSpawn(
|
||||
function( PatrolGroup )
|
||||
self:E( "ReSpawn" )
|
||||
self:__Reset()
|
||||
self:__Reset( 1 )
|
||||
self:__Route( 5 )
|
||||
end
|
||||
)
|
||||
|
||||
@ -152,6 +152,10 @@
|
||||
--
|
||||
-- @module Event
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--- The EVENT structure
|
||||
-- @type EVENT
|
||||
-- @field #EVENT.Events Events
|
||||
@ -721,3 +725,18 @@ function EVENT:onEvent( Event )
|
||||
end
|
||||
end
|
||||
|
||||
--- The EVENTHANDLER structure
|
||||
-- @type EVENTHANDLER
|
||||
-- @extends Core.Base#BASE
|
||||
EVENTHANDLER = {
|
||||
ClassName = "EVENTHANDLER",
|
||||
ClassID = 0,
|
||||
}
|
||||
|
||||
--- The EVENTHANDLER constructor
|
||||
-- @param #EVENTHANDLER self
|
||||
-- @return #EVENTHANDLER
|
||||
function EVENTHANDLER:New()
|
||||
self = BASE:Inherit( self, BASE:New() ) -- #EVENTHANDLER
|
||||
return self
|
||||
end
|
||||
|
||||
@ -627,16 +627,20 @@ do -- FSM
|
||||
return function( self, DelaySeconds, ... )
|
||||
self:T2( "Delayed Event: " .. EventName )
|
||||
local CallID = 0
|
||||
if DelaySeconds < 0 then -- Only call the event ONCE!
|
||||
DelaySeconds = math.abs( DelaySeconds )
|
||||
if not self._EventSchedules[EventName] then
|
||||
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
|
||||
self._EventSchedules[EventName] = CallID
|
||||
if DelaySeconds ~= nil then
|
||||
if DelaySeconds < 0 then -- Only call the event ONCE!
|
||||
DelaySeconds = math.abs( DelaySeconds )
|
||||
if not self._EventSchedules[EventName] then
|
||||
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
|
||||
self._EventSchedules[EventName] = CallID
|
||||
else
|
||||
-- reschedule
|
||||
end
|
||||
else
|
||||
-- reschedule
|
||||
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
|
||||
end
|
||||
else
|
||||
CallID = self.CallScheduler:Schedule( self, self._handler, { EventName, ... }, DelaySeconds or 1 )
|
||||
error( "FSM: An asynchronous event trigger requires a DelaySeconds parameter!!! This can be positive or negative! Sorry, but will not process this." )
|
||||
end
|
||||
self:T2( { CallID = CallID } )
|
||||
end
|
||||
|
||||
@ -848,7 +848,7 @@ function TASK:onenterAssigned( From, Event, To )
|
||||
self:E("Task Assigned")
|
||||
|
||||
self:MessageToGroups( "Task " .. self:GetName() .. " has been assigned to your group." )
|
||||
self:GetMission():__Start()
|
||||
self:GetMission():__Start( 1 )
|
||||
end
|
||||
|
||||
|
||||
@ -864,7 +864,7 @@ function TASK:onenterSuccess( From, Event, To )
|
||||
self:MessageToGroups( "Task " .. self:GetName() .. " is successful! Good job!" )
|
||||
self:UnAssignFromGroups()
|
||||
|
||||
self:GetMission():__Complete()
|
||||
self:GetMission():__Complete( 1 )
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -0,0 +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
|
||||
|
||||
local 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.
|
||||
|
||||
local 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.
|
||||
|
||||
local 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.
|
||||
|
||||
|
||||
local 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
|
||||
local 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)
|
||||
|
||||
local 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)
|
||||
|
||||
local 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")
|
||||
|
||||
local 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
|
||||
Binary file not shown.
@ -0,0 +1,27 @@
|
||||
---
|
||||
-- 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.
|
||||
--
|
||||
|
||||
local CapSpawn = SPAWN:New( "Plane" ):InitLimit(1,2):InitRepeatOnLanding()
|
||||
|
||||
local CapGroup = CapSpawn:Spawn()
|
||||
|
||||
local PatrolZone = ZONE:New( "Patrol Zone" )
|
||||
|
||||
local 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.
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,34 @@
|
||||
---
|
||||
-- Name: EVT-401 - Generic OnEventHit Example
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 15 February 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- Ground targets are shooting each other.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the ground forces shooting each other.
|
||||
-- 2. Observe when a tank receives a hit, a dcs.log entry is written in the logging.
|
||||
-- 3. The generic EventHandler objects should receive the hit events.
|
||||
|
||||
local CC = COMMANDCENTER:New( UNIT:FindByName( "HQ" ), "HQ" )
|
||||
|
||||
local EventHandler1 = EVENTHANDLER:New()
|
||||
local EventHandler2 = EVENTHANDLER:New()
|
||||
|
||||
EventHandler1:HandleEvent( EVENTS.Hit )
|
||||
EventHandler2:HandleEvent( EVENTS.Hit )
|
||||
|
||||
function EventHandler1:OnEventHit( EventData )
|
||||
self:E("hello 1")
|
||||
CC:GetPositionable():MessageToAll( "I just got hit!", 15 , "Alert!" )
|
||||
end
|
||||
|
||||
function EventHandler2:OnEventHit( EventData )
|
||||
self:E("hello 2")
|
||||
CC:GetPositionable():MessageToAll( "I just got hit!", 15, "Alert!" )
|
||||
end
|
||||
|
||||
|
||||
Binary file not shown.
@ -0,0 +1,63 @@
|
||||
---
|
||||
-- Name: EVT-103 - OnEventLand Example
|
||||
-- Author: CraigOwen
|
||||
-- Date Created: 12 February 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- A client plane is landing on an airfield, trying to pick a rope in the landing zones.
|
||||
-- When the plane landed in one of the zones, a vehicle flares and a message ist printed out to the client.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Land the plane.
|
||||
-- 2. When the plane landed, observe your message and the signal.
|
||||
-- 3. Check the contents of the fields of the S_EVENT_LAND entry in the dcs.log file.
|
||||
|
||||
-- Create a unit which signalizes if the client landed good.
|
||||
signal = UNIT:FindByName("LandingZoneChallenge - Signal")
|
||||
|
||||
-- Create the zones used for the landing check
|
||||
-- Init Zone
|
||||
InitZone = ZONE:New("LandingChallange - InitZone")
|
||||
|
||||
-- Ropes
|
||||
zonegroup1 = GROUP:FindByName("LandingZoneChallenge - RopeGroup 1" )
|
||||
zonegroup2 = GROUP:FindByName("LandingZoneChallenge - RopeGroup 2" )
|
||||
zonegroup3 = GROUP:FindByName("LandingZoneChallenge - RopeGroup 3" )
|
||||
LandZoneRope1 = ZONE_POLYGON:New( "Rope1", zonegroup1)
|
||||
LandZoneRope2 = ZONE_POLYGON:New( "Rope2", zonegroup2)
|
||||
LandZoneRope3 = ZONE_POLYGON:New( "Rope3", zonegroup3)
|
||||
|
||||
-- Create a variable Plane that holds a reference to CLIENT object (created by moose at the beginning of the mission) with the name "Plane".
|
||||
Plane = CLIENT:FindByName( "Plane" )
|
||||
-- Subscribe to the event Land. The Land event occurs when a plane lands at an airfield.
|
||||
Plane:HandleEvent( EVENTS.Land )
|
||||
|
||||
-- This function will be called whenever the Plane-Object (client) lands!
|
||||
function Plane:OnEventLand( EventData )
|
||||
|
||||
-- check wether the client landet at the right airport, where the challenge is located
|
||||
if not Plane:IsInZone(InitZone) then
|
||||
return
|
||||
end
|
||||
|
||||
-- check if the touchdown took place inside of one of the zones
|
||||
if Plane:IsInZone(LandZoneRope1) then
|
||||
MESSAGE:New("Great job! You picked the first rope.", 15, "Landing challenge" ):ToClient( Plane )
|
||||
signal:FlareGreen()
|
||||
elseif Plane:IsInZone(LandZoneRope2) then
|
||||
MESSAGE:New("Good job! You picked the second rope.", 15, "Landing challenge" ):ToClient( Plane )
|
||||
signal:FlareYellow()
|
||||
elseif Plane:IsInZone(LandZoneRope3) then
|
||||
MESSAGE:New("Close! You picked the last rope.", 15, "Landing challenge" ):ToClient( Plane )
|
||||
signal:FlareRed()
|
||||
else
|
||||
MESSAGE:New("Too bad, no rope picked! Thrust your engines and try again.", 15, "Landing challenge" ):ToClient( Plane )
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
MESSAGE:New("Try to land on the runway in between the red trucks.", 15, "Landing challenge"):ToClient(Plane)
|
||||
Binary file not shown.
@ -0,0 +1,41 @@
|
||||
---
|
||||
-- Name: SPA-121 - Air Ops - Scheduled Spawns with Repeat on Landing with Limit
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 05 Feb 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- One airplane and one helicopter will be spawned.
|
||||
-- Only one airplane and one helicopter can be alive at the same time.
|
||||
-- Upon landing, the airplane and helicopter will respawn at Kutaisi.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the spawning of the airplane and helicopter
|
||||
-- 2. There should not be more airplanes alive than there are set by InitLimit.
|
||||
-- 3. Upon landing, the planes should respawn.
|
||||
-- 4. The KA-50 should respawn itself directly when landed.
|
||||
-- 5. The A-10C should respawn itself when the air unit has parked at the ramp.
|
||||
|
||||
|
||||
do
|
||||
|
||||
-- Declare SPAWN objects
|
||||
local Spawn_KA_50 = SPAWN:New("KA-50"):InitLimit( 1, 10 )
|
||||
local Spawn_A_10C = SPAWN:New("A-10C"):InitLimit( 1, 10 )
|
||||
|
||||
-- Choose repeat functionality
|
||||
|
||||
-- Repeat on landing
|
||||
Spawn_KA_50:InitRepeatOnLanding()
|
||||
|
||||
-- Repeat on enging shutdown (when landed on the airport)
|
||||
Spawn_A_10C:InitRepeatOnEngineShutDown()
|
||||
|
||||
-- Now SPAWN the GROUPs
|
||||
Spawn_KA_50:SpawnScheduled(30,0)
|
||||
Spawn_A_10C:SpawnScheduled(30,0)
|
||||
|
||||
-- Now run the mission and observe the behaviour.
|
||||
|
||||
end
|
||||
Binary file not shown.
@ -1,41 +0,0 @@
|
||||
---
|
||||
-- MOOSE SPAWN repeat test scenario
|
||||
-- -------------------------------
|
||||
-- There are 8 GROUPs Spawned.
|
||||
-- They fly around Kutaisi and will land.
|
||||
-- Upon landing:
|
||||
-- 1. The KA-50 and the C-101EB should respawn itself directly when landed.
|
||||
-- 2. the MI-8MTV2 and the A-10C should respawn itself when the air unit has parked at the ramp.
|
||||
--
|
||||
|
||||
do
|
||||
|
||||
-- Declare SPAWN objects
|
||||
local Spawn_KA_50 = SPAWN:New("KA-50")
|
||||
local Spawn_MI_8MTV2 = SPAWN:New("MI-8MTV2")
|
||||
local Spawn_C_101EB = SPAWN:New("C-101EB")
|
||||
local Spawn_A_10C = SPAWN:New("A-10C")
|
||||
|
||||
-- Choose repeat functionality
|
||||
|
||||
-- Repeat on landing
|
||||
Spawn_KA_50:InitRepeatOnLanding()
|
||||
Spawn_C_101EB:InitRepeatOnLanding()
|
||||
|
||||
-- Repeat on enging shutdown (when landed on the airport)
|
||||
Spawn_MI_8MTV2:InitRepeatOnEngineShutDown()
|
||||
Spawn_A_10C:InitRepeatOnEngineShutDown()
|
||||
|
||||
-- Now SPAWN the GROUPs
|
||||
Spawn_KA_50:Spawn()
|
||||
Spawn_C_101EB:Spawn()
|
||||
Spawn_MI_8MTV2:Spawn()
|
||||
Spawn_A_10C:Spawn()
|
||||
Spawn_KA_50:Spawn()
|
||||
Spawn_C_101EB:Spawn()
|
||||
Spawn_MI_8MTV2:Spawn()
|
||||
Spawn_A_10C:Spawn()
|
||||
|
||||
-- Now run the mission and observe the behaviour.
|
||||
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user