mirror of
https://github.com/FlightControl-Master/MOOSE_MISSIONS.git
synced 2026-08-23 02:08:06 +00:00
Updated Moose.lua
This commit is contained in:
@@ -1,43 +1,43 @@
|
||||
-- Name: AIB-002 - Patrol AI.lua
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 December 2016
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area until fuel is empty and return to the home base.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa.
|
||||
-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa.
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
local PatrolZones = {}
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" )
|
||||
local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
|
||||
|
||||
PatrolZones[AIGroup] = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 )
|
||||
PatrolZones[AIGroup]:ManageFuel( 0.2, 60 )
|
||||
PatrolZones[AIGroup]:SetControllable( AIGroup )
|
||||
PatrolZones[AIGroup]:__Start( 5 )
|
||||
|
||||
end
|
||||
-- Name: AIB-002 - Patrol AI.lua
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 December 2016
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area until fuel is empty and return to the home base.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa.
|
||||
-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa.
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
local PatrolZones = {}
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" )
|
||||
local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
|
||||
|
||||
PatrolZones[AIGroup] = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 )
|
||||
PatrolZones[AIGroup]:ManageFuel( 0.2, 60 )
|
||||
PatrolZones[AIGroup]:SetControllable( AIGroup )
|
||||
PatrolZones[AIGroup]:__Start( 5 )
|
||||
|
||||
end
|
||||
|
||||
+24
-24
@@ -1,24 +1,24 @@
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart()
|
||||
RU_AirbasesSet:Flush()
|
||||
RU_AI_Balancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet )
|
||||
|
||||
|
||||
US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" )
|
||||
US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 )
|
||||
US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn )
|
||||
|
||||
--RU_AI_Balancer:ReturnToHomeAirbase( 10000 )
|
||||
|
||||
--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" )
|
||||
--local PatrolZoneBlue = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
--local PatrolZoneB = AI_PATROL_ZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 )
|
||||
--US_AI_Balancer:SetPatrolZone( PatrolZoneB )
|
||||
--
|
||||
--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Red" )
|
||||
--local PatrolZoneRed = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
--local PatrolZoneR = AI_PATROL_ZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 )
|
||||
--RU_AI_Balancer:SetPatrolZone( PatrolZoneR )
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
RU_AirbasesSet = SET_AIRBASE:New():FilterCoalitions("red"):FilterStart()
|
||||
RU_AirbasesSet:Flush()
|
||||
RU_AI_Balancer:ReturnToNearestAirbases( 10000, RU_AirbasesSet )
|
||||
|
||||
|
||||
US_PlanesClientSet = SET_CLIENT:New():FilterCountries( "USA" ):FilterCategories( "plane" )
|
||||
US_PlanesSpawn = SPAWN:New( "AI US" ):InitCleanUp( 20 )
|
||||
US_AI_Balancer = AI_BALANCER:New( US_PlanesClientSet, US_PlanesSpawn )
|
||||
|
||||
--RU_AI_Balancer:ReturnToHomeAirbase( 10000 )
|
||||
|
||||
--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Blue" )
|
||||
--local PatrolZoneBlue = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
--local PatrolZoneB = AI_PATROL_ZONE:New( PatrolZoneBlue, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 )
|
||||
--US_AI_Balancer:SetPatrolZone( PatrolZoneB )
|
||||
--
|
||||
--local PatrolZoneGroup = GROUP:FindByName( "Patrol Zone Red" )
|
||||
--local PatrolZoneRed = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
--local PatrolZoneR = AI_PATROL_ZONE:New( PatrolZoneRed, 3000, 6000, 900, 1100 ):ManageFuel( 0.2, 180 )
|
||||
--RU_AI_Balancer:SetPatrolZone( PatrolZoneR )
|
||||
|
||||
+47
-47
@@ -1,47 +1,47 @@
|
||||
-- Name: AIB-004 - Respawn Test when Destroyed.lua
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 January 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area.
|
||||
--
|
||||
-- The blue side has SAMs nearby.
|
||||
-- Once the red AI takes off, the red AI is attacked by the blue SAMs.
|
||||
-- Red AI should be killed and once that happens, a Respawn of the group should happen!
|
||||
-- The Respawn happens through the InitCleanUp() API of SPAWN.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Monitor that once a red AI is destroyed, that it ReSpawns...
|
||||
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" )
|
||||
local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
|
||||
|
||||
local Patrol = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:__Start( 5 )
|
||||
|
||||
end
|
||||
|
||||
-- Name: AIB-004 - Respawn Test when Destroyed.lua
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 7 January 2017
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area.
|
||||
--
|
||||
-- The blue side has SAMs nearby.
|
||||
-- Once the red AI takes off, the red AI is attacked by the blue SAMs.
|
||||
-- Red AI should be killed and once that happens, a Respawn of the group should happen!
|
||||
-- The Respawn happens through the InitCleanUp() API of SPAWN.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Monitor that once a red AI is destroyed, that it ReSpawns...
|
||||
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" )
|
||||
local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup )
|
||||
|
||||
|
||||
local Patrol = AI_PATROL_ZONE:New( PatrolZone, 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:__Start( 5 )
|
||||
|
||||
end
|
||||
|
||||
|
||||
+51
-51
@@ -1,51 +1,51 @@
|
||||
-- Name: AIB-005 - Patrol AI and Randomize Zones
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 10 Jan 2016
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area until fuel is empty and return to the home base.
|
||||
-- For each AI being spawned, ensure that they fly to a random zone defined within the mission editor.
|
||||
-- Right now there are two patrol zones defined, so the AI should start patrolliing in one of these zones.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa.
|
||||
-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa.
|
||||
-- 6. Ensure that you see the AI patrol in one of the two zones ...
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
-- Create the first polygon zone ...
|
||||
PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" )
|
||||
PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 )
|
||||
|
||||
-- Create the second polygon zone ...
|
||||
PatrolZoneGroup2 = GROUP:FindByName( "PatrolZone2" )
|
||||
PatrolZone2 = ZONE_POLYGON:New( "PatrolZone2", PatrolZoneGroup2 )
|
||||
|
||||
-- Now, create an array of these zones ...
|
||||
PatrolZoneArray = { PatrolZone1, PatrolZone2 }
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local Patrol = AI_PATROL_ZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:Start()
|
||||
|
||||
end
|
||||
-- Name: AIB-005 - Patrol AI and Randomize Zones
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 10 Jan 2016
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- The red AI should start patrolling an area until fuel is empty and return to the home base.
|
||||
-- For each AI being spawned, ensure that they fly to a random zone defined within the mission editor.
|
||||
-- Right now there are two patrol zones defined, so the AI should start patrolliing in one of these zones.
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. If no player is logging into the red slots, 2 red AI planes should be alive.
|
||||
-- 2. If a player joins one red slot, one red AI plane should return to the nearest home base.
|
||||
-- 3. If two players join the red slots, no AI plane should be spawned, and all airborne AI planes should return to the nearest home base.
|
||||
-- 4. Spawned AI should take-off from the airbase, and start patrolling the area around Anapa.
|
||||
-- 5. When the AI is out-of-fuel, it should report it is returning to the home base, and land at Anapa.
|
||||
-- 6. Ensure that you see the AI patrol in one of the two zones ...
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
-- Create the first polygon zone ...
|
||||
PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" )
|
||||
PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 )
|
||||
|
||||
-- Create the second polygon zone ...
|
||||
PatrolZoneGroup2 = GROUP:FindByName( "PatrolZone2" )
|
||||
PatrolZone2 = ZONE_POLYGON:New( "PatrolZone2", PatrolZoneGroup2 )
|
||||
|
||||
-- Now, create an array of these zones ...
|
||||
PatrolZoneArray = { PatrolZone1, PatrolZone2 }
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local Patrol = AI_PATROL_ZONE:New( PatrolZoneArray[math.random( 1, 2 )], 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:Start()
|
||||
|
||||
end
|
||||
|
||||
+43
-43
@@ -1,43 +1,43 @@
|
||||
-- Name: AIB-005 - Patrol AI and Randomize Zones
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 10 Jan 2016
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- You'll notice a lot of AI is being spawned, as there are a lot of slots...
|
||||
-- If the SPAWN API :InitCleanUp( secs ) is NOT used, you'll notice that the planes block each other on the runway.
|
||||
-- After a short period of time, nothing will move anymore...
|
||||
-- The :InitCleanUp( seconds ) API of the SPAWN class ensure that any AI that is parked longer than the
|
||||
-- specified amount of seconds, is respawned back at the parking position.
|
||||
-- This frees up the other planes departing, and the airbase is in this way decluttered...
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the de-cluttering of planes at Krymsk.
|
||||
-- 2. Play with the InitCleanUp API of the SPAWN class, extende the amount of seconds to find the optimal setting.
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
-- Create the first polygon zone ...
|
||||
PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" )
|
||||
PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 )
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local Patrol = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:__Start( 5 )
|
||||
|
||||
end
|
||||
-- Name: AIB-005 - Patrol AI and Randomize Zones
|
||||
-- Author: FlightControl
|
||||
-- Date Created: 10 Jan 2016
|
||||
--
|
||||
-- # Situation:
|
||||
--
|
||||
-- For the red coalition, 2 client slots are foreseen.
|
||||
-- For those players that have not joined the mission, red AI is spawned.
|
||||
-- You'll notice a lot of AI is being spawned, as there are a lot of slots...
|
||||
-- If the SPAWN API :InitCleanUp( secs ) is NOT used, you'll notice that the planes block each other on the runway.
|
||||
-- After a short period of time, nothing will move anymore...
|
||||
-- The :InitCleanUp( seconds ) API of the SPAWN class ensure that any AI that is parked longer than the
|
||||
-- specified amount of seconds, is respawned back at the parking position.
|
||||
-- This frees up the other planes departing, and the airbase is in this way decluttered...
|
||||
--
|
||||
-- # Test cases:
|
||||
--
|
||||
-- 1. Observe the de-cluttering of planes at Krymsk.
|
||||
-- 2. Play with the InitCleanUp API of the SPAWN class, extende the amount of seconds to find the optimal setting.
|
||||
|
||||
-- Define the SET of CLIENTs from the red coalition. This SET is filled during startup.
|
||||
RU_PlanesClientSet = SET_CLIENT:New():FilterCountries( "RUSSIA" ):FilterCategories( "plane" )
|
||||
|
||||
-- Define the SPAWN object for the red AI plane template.
|
||||
-- We use InitCleanUp to check every 20 seconds, if there are no planes blocked at the airbase, waithing for take-off.
|
||||
-- If a blocked plane exists, this red plane will be ReSpawned.
|
||||
RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 )
|
||||
|
||||
-- Start the AI_BALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter.
|
||||
RU_AI_Balancer = AI_BALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn )
|
||||
|
||||
-- Create the first polygon zone ...
|
||||
PatrolZoneGroup1 = GROUP:FindByName( "PatrolZone1" )
|
||||
PatrolZone1 = ZONE_POLYGON:New( "PatrolZone1", PatrolZoneGroup1 )
|
||||
|
||||
function RU_AI_Balancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
|
||||
local Patrol = AI_PATROL_ZONE:New( PatrolZone1, 3000, 6000, 400, 600 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:__Start( 5 )
|
||||
|
||||
end
|
||||
|
||||
+163
-163
@@ -1,163 +1,163 @@
|
||||
-- Name: AIB-007 - AI Balancers For all airports and both coalitions
|
||||
-- Author: Delta99
|
||||
-- Date Created: 11 Feb 2017
|
||||
--
|
||||
-- Originally created to solve issues jg7xman (from Moose Slack group) was having in creating
|
||||
-- AI_BALANCER across multiple airbases.
|
||||
|
||||
-- # Situation:
|
||||
--
|
||||
-- AI_BALANCERS created per airbase for both coalitions. Mutiple patrol zones are created
|
||||
-- for each side. Each flight that is created by AI_BALANCER will pick a random patrol zone
|
||||
-- to patrol.
|
||||
|
||||
-- # Test Cases
|
||||
--
|
||||
-- 1. Observe at least 1 flight spawning and taking off from each airbase.
|
||||
-- 2. Each flight patrols randomly in one of its sides zones.
|
||||
-- 3. AI will respawn after killed.
|
||||
-- 4. Additional client slots are available at Sochi. If players don't take a slot there
|
||||
-- will be more than one AI taking off from Sochi.
|
||||
-- 5. Batumi contains a flight of 3 units rather than just 1 like most of the rest of the airbases.
|
||||
-- 6. Watch the coalition AI clash and kill each other.
|
||||
|
||||
-- Create the Red Patrol Zone Array
|
||||
|
||||
-- This zone array will be used in the AI_BALANCER to randomize the patrol
|
||||
-- zone that each spawned group will patrol
|
||||
|
||||
RedPatrolZone = {}
|
||||
RedPatrolZone[1] = ZONE:New( "RedPatrolZone1" )
|
||||
RedPatrolZone[2] = ZONE:New( "RedPatrolZone2" )
|
||||
RedPatrolZone[3] = ZONE:New( "RedPatrolZone3" )
|
||||
RedPatrolZone[4] = ZONE:New( "RedPatrolZone4" )
|
||||
RedPatrolZone[5] = ZONE:New( "RedPatrolZone5" )
|
||||
RedPatrolZone[6] = ZONE:New( "RedPatrolZone6" )
|
||||
|
||||
-- Russian CAP Aircraft
|
||||
|
||||
-- These are the aircraft created in the mission editor that the AI will spawn
|
||||
-- with replacing any CLIENT created aircraft in the mission that a human
|
||||
-- player does not take.
|
||||
|
||||
RU_PlanesSpawn = {}
|
||||
RU_PlanesSpawn[1] = SPAWN:New( "RU CAP Anapa AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[2] = SPAWN:New( "RU CAP Beslan AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[3] = SPAWN:New( "RU CAP Gelendzhik AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[4] = SPAWN:New( "RU CAP Krasnodar Center AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[5] = SPAWN:New( "RU CAP Krasnodar Pashkovsky AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[6] = SPAWN:New( "RU CAP Krymsk AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[7] = SPAWN:New( "RU CAP Maykop AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[8] = SPAWN:New( "RU CAP Mineralnye Vody AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[9] = SPAWN:New( "RU CAP Mozdok AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[10] = SPAWN:New( "RU CAP Nalchik AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[11] = SPAWN:New( "RU CAP Novorossiysk AB" ):InitCleanUp( 45 )
|
||||
|
||||
-- Russian Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot)
|
||||
|
||||
-- If you want more client slots per airbase that you want AI to be able to take control of then
|
||||
-- name them with the prefixes below and they will be picked up automatically by FilterPrevixes.
|
||||
--
|
||||
-- For example, if you want another Client slot available at Anapa name it "RU CLIENT Anapa AB 2".
|
||||
-- The code here does not need to be changed. Only an addition in the mission editor. An example
|
||||
-- of this can be found on the USA side at Sochi AB.
|
||||
|
||||
RU_PlanesClientSet = {}
|
||||
RU_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Anapa AB")
|
||||
RU_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Beslan AB")
|
||||
RU_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Gelendzhik AB")
|
||||
RU_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Center AB")
|
||||
RU_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Pashkovsky AB")
|
||||
RU_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krymsk AB")
|
||||
RU_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Maykop AB")
|
||||
RU_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mineralnye Vody AB")
|
||||
RU_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mozdok AB")
|
||||
RU_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Nalchik AB")
|
||||
RU_PlanesClientSet[11] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Novorossiysk AB")
|
||||
|
||||
-- We setup an array to store all the AI_BALANCERS that are going to be created. Basically one
|
||||
-- per airbase. We loop through and create an AI_BALANCER as well as a separate OnAfterSpawned
|
||||
-- function for each. The Patrol Zone is randomized in the first parameter to AI_PATROL_ZONE:New()
|
||||
-- call. This is done for each of the AI_BALANCERS. To add more patrol zones, just define them in
|
||||
-- the mission editor and add into the array above. Code here does not need to be changed. The
|
||||
-- table.getn(RedPatrolZone) gets the number of elements in the RedPatrolZone array so that all
|
||||
-- of them are included to pick randomly.
|
||||
|
||||
|
||||
RU_AI_Balancer = {}
|
||||
for i=1, 11 do
|
||||
RU_AI_Balancer[i] = AI_BALANCER:New(RU_PlanesClientSet[i], RU_PlanesSpawn[i])
|
||||
|
||||
-- We set a local variable within the for loop to the AI_BALANCER that was just created.
|
||||
-- I couldn't get RU_AI_BALANCER[i]:OnAfterSpawn to be recognized so this is just pointing
|
||||
-- curAIBalancer to the relevant RU_AI_BALANCER array item for each loop.
|
||||
|
||||
-- So in this case there are essentially 11 OnAfterSpawned functions defined and handled.
|
||||
|
||||
local curAIBalancer = RU_AI_Balancer[i]
|
||||
function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
local Patrol = AI_PATROL_ZONE:New( RedPatrolZone[math.random( 1, table.getn(RedPatrolZone))], 1500, 5500, 700, 1400 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:Start()
|
||||
end
|
||||
end
|
||||
|
||||
-- US / Blue side is setup pretty much identically to the RU side above. Same detailed comments
|
||||
-- above apply here. The main difference here is 10 airbases instead of 11.
|
||||
|
||||
-- Another difference is additional client slots at Sochi and a group defined at Batumi with
|
||||
-- more than 1 unit per group (flight of 3 units). This is just to show that you can have more
|
||||
-- client slots per airbase and more units in a single group that the AI will control. I think
|
||||
-- this will also allow you to fly lead with AI on your wing or you can fly wing with an AI
|
||||
-- leader.
|
||||
|
||||
-- Create the Blue Patrol Zone Array
|
||||
BluePatrolZone = {}
|
||||
BluePatrolZone[1] = ZONE:New( "BluePatrolZone1")
|
||||
BluePatrolZone[2] = ZONE:New( "BluePatrolZone2")
|
||||
BluePatrolZone[3] = ZONE:New( "BluePatrolZone3")
|
||||
BluePatrolZone[4] = ZONE:New( "BluePatrolZone4")
|
||||
BluePatrolZone[5] = ZONE:New( "BluePatrolZone5")
|
||||
BluePatrolZone[6] = ZONE:New( "BluePatrolZone6")
|
||||
|
||||
--United States CAP Aircraft (these are used as templates for AI)
|
||||
|
||||
US_PlanesSpawn = {}
|
||||
US_PlanesSpawn[1] = SPAWN:New( "US CAP Batumi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[2] = SPAWN:New( "US CAP Gudauta AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[3] = SPAWN:New( "US CAP Kobuleti AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[4] = SPAWN:New( "US CAP Kutaisi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[5] = SPAWN:New( "US CAP Senaki AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[6] = SPAWN:New( "US CAP Sochi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[7] = SPAWN:New( "US CAP Soganlug AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[8] = SPAWN:New( "US CAP Sukhumi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[9] = SPAWN:New( "US CAP Vaziani AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[10] = SPAWN:New( "US CAP Tbilisi AB" ):InitCleanUp( 45 )
|
||||
|
||||
--United States Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot)
|
||||
|
||||
US_PlanesClientSet = {}
|
||||
US_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("US CLIENT Batumi AB")
|
||||
US_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("US CLIENT Gudauta AB")
|
||||
US_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kobuleti AB")
|
||||
US_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kutaisi AB")
|
||||
US_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("US CLIENT Senaki AB")
|
||||
US_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sochi AB")
|
||||
US_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("US CLIENT Soganlug AB")
|
||||
US_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sukhumi AB")
|
||||
US_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("US CLIENT Vaziani AB")
|
||||
US_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("US CLIENT Tbilisi AB")
|
||||
|
||||
US_AI_Balancer = {}
|
||||
for i=1, 10 do
|
||||
US_AI_Balancer[i] = AI_BALANCER:New( US_PlanesClientSet[i], US_PlanesSpawn[i] )
|
||||
|
||||
local curAIBalancer = US_AI_Balancer[i]
|
||||
function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
local Patrol = AI_PATROL_ZONE:New( BluePatrolZone[math.random( 1, table.getn(BluePatrolZone))], 1500, 5500, 700, 1400 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:Start()
|
||||
end
|
||||
end
|
||||
-- Name: AIB-007 - AI Balancers For all airports and both coalitions
|
||||
-- Author: Delta99
|
||||
-- Date Created: 11 Feb 2017
|
||||
--
|
||||
-- Originally created to solve issues jg7xman (from Moose Slack group) was having in creating
|
||||
-- AI_BALANCER across multiple airbases.
|
||||
|
||||
-- # Situation:
|
||||
--
|
||||
-- AI_BALANCERS created per airbase for both coalitions. Mutiple patrol zones are created
|
||||
-- for each side. Each flight that is created by AI_BALANCER will pick a random patrol zone
|
||||
-- to patrol.
|
||||
|
||||
-- # Test Cases
|
||||
--
|
||||
-- 1. Observe at least 1 flight spawning and taking off from each airbase.
|
||||
-- 2. Each flight patrols randomly in one of its sides zones.
|
||||
-- 3. AI will respawn after killed.
|
||||
-- 4. Additional client slots are available at Sochi. If players don't take a slot there
|
||||
-- will be more than one AI taking off from Sochi.
|
||||
-- 5. Batumi contains a flight of 3 units rather than just 1 like most of the rest of the airbases.
|
||||
-- 6. Watch the coalition AI clash and kill each other.
|
||||
|
||||
-- Create the Red Patrol Zone Array
|
||||
|
||||
-- This zone array will be used in the AI_BALANCER to randomize the patrol
|
||||
-- zone that each spawned group will patrol
|
||||
|
||||
RedPatrolZone = {}
|
||||
RedPatrolZone[1] = ZONE:New( "RedPatrolZone1" )
|
||||
RedPatrolZone[2] = ZONE:New( "RedPatrolZone2" )
|
||||
RedPatrolZone[3] = ZONE:New( "RedPatrolZone3" )
|
||||
RedPatrolZone[4] = ZONE:New( "RedPatrolZone4" )
|
||||
RedPatrolZone[5] = ZONE:New( "RedPatrolZone5" )
|
||||
RedPatrolZone[6] = ZONE:New( "RedPatrolZone6" )
|
||||
|
||||
-- Russian CAP Aircraft
|
||||
|
||||
-- These are the aircraft created in the mission editor that the AI will spawn
|
||||
-- with replacing any CLIENT created aircraft in the mission that a human
|
||||
-- player does not take.
|
||||
|
||||
RU_PlanesSpawn = {}
|
||||
RU_PlanesSpawn[1] = SPAWN:New( "RU CAP Anapa AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[2] = SPAWN:New( "RU CAP Beslan AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[3] = SPAWN:New( "RU CAP Gelendzhik AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[4] = SPAWN:New( "RU CAP Krasnodar Center AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[5] = SPAWN:New( "RU CAP Krasnodar Pashkovsky AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[6] = SPAWN:New( "RU CAP Krymsk AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[7] = SPAWN:New( "RU CAP Maykop AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[8] = SPAWN:New( "RU CAP Mineralnye Vody AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[9] = SPAWN:New( "RU CAP Mozdok AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[10] = SPAWN:New( "RU CAP Nalchik AB" ):InitCleanUp( 45 )
|
||||
RU_PlanesSpawn[11] = SPAWN:New( "RU CAP Novorossiysk AB" ):InitCleanUp( 45 )
|
||||
|
||||
-- Russian Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot)
|
||||
|
||||
-- If you want more client slots per airbase that you want AI to be able to take control of then
|
||||
-- name them with the prefixes below and they will be picked up automatically by FilterPrevixes.
|
||||
--
|
||||
-- For example, if you want another Client slot available at Anapa name it "RU CLIENT Anapa AB 2".
|
||||
-- The code here does not need to be changed. Only an addition in the mission editor. An example
|
||||
-- of this can be found on the USA side at Sochi AB.
|
||||
|
||||
RU_PlanesClientSet = {}
|
||||
RU_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Anapa AB")
|
||||
RU_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Beslan AB")
|
||||
RU_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Gelendzhik AB")
|
||||
RU_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Center AB")
|
||||
RU_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krasnodar Pashkovsky AB")
|
||||
RU_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Krymsk AB")
|
||||
RU_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Maykop AB")
|
||||
RU_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mineralnye Vody AB")
|
||||
RU_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Mozdok AB")
|
||||
RU_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Nalchik AB")
|
||||
RU_PlanesClientSet[11] = SET_CLIENT:New():FilterPrefixes("RU CLIENT Novorossiysk AB")
|
||||
|
||||
-- We setup an array to store all the AI_BALANCERS that are going to be created. Basically one
|
||||
-- per airbase. We loop through and create an AI_BALANCER as well as a separate OnAfterSpawned
|
||||
-- function for each. The Patrol Zone is randomized in the first parameter to AI_PATROL_ZONE:New()
|
||||
-- call. This is done for each of the AI_BALANCERS. To add more patrol zones, just define them in
|
||||
-- the mission editor and add into the array above. Code here does not need to be changed. The
|
||||
-- table.getn(RedPatrolZone) gets the number of elements in the RedPatrolZone array so that all
|
||||
-- of them are included to pick randomly.
|
||||
|
||||
|
||||
RU_AI_Balancer = {}
|
||||
for i=1, 11 do
|
||||
RU_AI_Balancer[i] = AI_BALANCER:New(RU_PlanesClientSet[i], RU_PlanesSpawn[i])
|
||||
|
||||
-- We set a local variable within the for loop to the AI_BALANCER that was just created.
|
||||
-- I couldn't get RU_AI_BALANCER[i]:OnAfterSpawn to be recognized so this is just pointing
|
||||
-- curAIBalancer to the relevant RU_AI_BALANCER array item for each loop.
|
||||
|
||||
-- So in this case there are essentially 11 OnAfterSpawned functions defined and handled.
|
||||
|
||||
local curAIBalancer = RU_AI_Balancer[i]
|
||||
function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
local Patrol = AI_PATROL_ZONE:New( RedPatrolZone[math.random( 1, table.getn(RedPatrolZone))], 1500, 5500, 700, 1400 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:Start()
|
||||
end
|
||||
end
|
||||
|
||||
-- US / Blue side is setup pretty much identically to the RU side above. Same detailed comments
|
||||
-- above apply here. The main difference here is 10 airbases instead of 11.
|
||||
|
||||
-- Another difference is additional client slots at Sochi and a group defined at Batumi with
|
||||
-- more than 1 unit per group (flight of 3 units). This is just to show that you can have more
|
||||
-- client slots per airbase and more units in a single group that the AI will control. I think
|
||||
-- this will also allow you to fly lead with AI on your wing or you can fly wing with an AI
|
||||
-- leader.
|
||||
|
||||
-- Create the Blue Patrol Zone Array
|
||||
BluePatrolZone = {}
|
||||
BluePatrolZone[1] = ZONE:New( "BluePatrolZone1")
|
||||
BluePatrolZone[2] = ZONE:New( "BluePatrolZone2")
|
||||
BluePatrolZone[3] = ZONE:New( "BluePatrolZone3")
|
||||
BluePatrolZone[4] = ZONE:New( "BluePatrolZone4")
|
||||
BluePatrolZone[5] = ZONE:New( "BluePatrolZone5")
|
||||
BluePatrolZone[6] = ZONE:New( "BluePatrolZone6")
|
||||
|
||||
--United States CAP Aircraft (these are used as templates for AI)
|
||||
|
||||
US_PlanesSpawn = {}
|
||||
US_PlanesSpawn[1] = SPAWN:New( "US CAP Batumi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[2] = SPAWN:New( "US CAP Gudauta AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[3] = SPAWN:New( "US CAP Kobuleti AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[4] = SPAWN:New( "US CAP Kutaisi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[5] = SPAWN:New( "US CAP Senaki AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[6] = SPAWN:New( "US CAP Sochi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[7] = SPAWN:New( "US CAP Soganlug AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[8] = SPAWN:New( "US CAP Sukhumi AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[9] = SPAWN:New( "US CAP Vaziani AB" ):InitCleanUp( 45 )
|
||||
US_PlanesSpawn[10] = SPAWN:New( "US CAP Tbilisi AB" ):InitCleanUp( 45 )
|
||||
|
||||
--United States Client Aircraft (via AI_BALANCER, AI will replace these if no human players are in the slot)
|
||||
|
||||
US_PlanesClientSet = {}
|
||||
US_PlanesClientSet[1] = SET_CLIENT:New():FilterPrefixes("US CLIENT Batumi AB")
|
||||
US_PlanesClientSet[2] = SET_CLIENT:New():FilterPrefixes("US CLIENT Gudauta AB")
|
||||
US_PlanesClientSet[3] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kobuleti AB")
|
||||
US_PlanesClientSet[4] = SET_CLIENT:New():FilterPrefixes("US CLIENT Kutaisi AB")
|
||||
US_PlanesClientSet[5] = SET_CLIENT:New():FilterPrefixes("US CLIENT Senaki AB")
|
||||
US_PlanesClientSet[6] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sochi AB")
|
||||
US_PlanesClientSet[7] = SET_CLIENT:New():FilterPrefixes("US CLIENT Soganlug AB")
|
||||
US_PlanesClientSet[8] = SET_CLIENT:New():FilterPrefixes("US CLIENT Sukhumi AB")
|
||||
US_PlanesClientSet[9] = SET_CLIENT:New():FilterPrefixes("US CLIENT Vaziani AB")
|
||||
US_PlanesClientSet[10] = SET_CLIENT:New():FilterPrefixes("US CLIENT Tbilisi AB")
|
||||
|
||||
US_AI_Balancer = {}
|
||||
for i=1, 10 do
|
||||
US_AI_Balancer[i] = AI_BALANCER:New( US_PlanesClientSet[i], US_PlanesSpawn[i] )
|
||||
|
||||
local curAIBalancer = US_AI_Balancer[i]
|
||||
function curAIBalancer:OnAfterSpawned( SetGroup, From, Event, To, AIGroup )
|
||||
local Patrol = AI_PATROL_ZONE:New( BluePatrolZone[math.random( 1, table.getn(BluePatrolZone))], 1500, 5500, 700, 1400 )
|
||||
Patrol:ManageFuel( 0.2, 60 )
|
||||
Patrol:SetControllable( AIGroup )
|
||||
Patrol:Start()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user