diff --git a/Moose Development/Moose/Functional/AIBalancer.lua b/Moose Development/Moose/Functional/AIBalancer.lua index 8d6e4b47e..4cd5f6e21 100644 --- a/Moose Development/Moose/Functional/AIBalancer.lua +++ b/Moose Development/Moose/Functional/AIBalancer.lua @@ -97,6 +97,7 @@ function AIBALANCER:New( SetClient, SpawnAI ) self:AddTransition( "*", "Start", "Monitoring" ) self:AddTransition( "*", "Monitor", "Monitoring" ) self:AddTransition( "*", "Spawn", "Spawning" ) + self:AddTransition( "Spawning", "Spawned", "Spawned" ) self:AddTransition( "*", "Destroy", "Destroying" ) self:AddTransition( "*", "Return", "Returning" ) self:AddTransition( "*", "End", "End" ) @@ -146,6 +147,10 @@ function AIBALANCER:onenterSpawning( SetGroup, Event, From, To, ClientName ) --TODO: need to rework UnitName thing ... SetGroup:Add( ClientName, AIGroup ) + + -- Fire the Spawned event. The first parameter is the AIGroup just Spawned. + -- Mission designers can catch this event to bind further actions to the AIGroup. + self:Spawned( AIGroup ) end --- @param #AIBALANCER self diff --git a/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua b/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua index 7adb52067..dcffa7a2e 100644 --- a/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua +++ b/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.lua @@ -35,4 +35,15 @@ local RU_PlanesSpawn = SPAWN:New( "AI RU" ):InitCleanUp( 20 ) -- Start the AIBALANCER, using the SET of red CLIENTs, and the SPAWN object as a parameter. local RU_AIBalancer = AIBALANCER:New( RU_PlanesClientSet, RU_PlanesSpawn ) -function RU_AIBalancer:OnAfterSpawn() \ No newline at end of file +function RU_AIBalancer:OnAfterSpawned( SetGroup, Event, From, To, AIGroup ) + + local PatrolZoneGroup = GROUP:FindByName( "PatrolZone" ) + local PatrolZone = ZONE_POLYGON:New( "PatrolZone", PatrolZoneGroup ) + + + local Patrol = PATROLZONE:New( PatrolZone, 3000, 6000, 400, 600 ) + Patrol:ManageFuel( 0.2, 60 ) + Patrol:SetControllable( AIGroup ) + Patrol:__Start( 5 ) + +end \ No newline at end of file diff --git a/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz b/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz index b0fc85ea2..ee7062214 100644 Binary files a/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz and b/Moose Test Missions/AIB - AI Balancer/AIB-002 - Patrol AI/AIB-002 - Patrol AI.miz differ