Progress on AI_CAS_ZONE and AI_PATROL_ZONE rework.

This commit is contained in:
FlightControl
2017-01-15 11:11:58 +01:00
parent e552e70e2a
commit 6d5655e56a
19 changed files with 536 additions and 61600 deletions

View File

@@ -13,25 +13,36 @@ local CASPlane = GROUP:FindByName( "Plane" )
local PatrolZone = ZONE:New( "Patrol Zone" )
local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 350, 600, CASEngagementZone )
local AICasZone = AI_CAS_ZONE:New( PatrolZone, 500, 1000, 500, 600, CASEngagementZone )
local Targets = GROUP:FindByName("Targets")
AICasZone:SetControllable(CASPlane)
AICasZone:__Start(1)
AICasZone:__Engage(10)
AICasZone:__Start( 1 ) -- They should statup, and start patrolling in the PatrolZone.
-- After 5 minutes, engage
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 = SCHEDULER:New(nil,
Check, CheckScheduleID = SCHEDULER:New(nil,
function()
BASE:E( { "In Scheduler: ", Targets:GetSize() } )
if Targets:IsAlive() and Targets:GetSize() ~= 0 then
if Targets:IsAlive() and Targets:GetSize() > 5 then
BASE:E("Still alive")
else
BASE:E("Destroyed")
AICasZone:__Completed(1)
AICasZone:__Accomplish( 1 ) -- Now they should fly back to teh patrolzone and patrol.
Check:Stop(CheckScheduleID)
end
end, {}, 20, 60, 0.2 )
-- When the targets in the zone are destroyed, (see scheduled function), the planes will return homs...
function AICasZone:OnAfterAccomplish( Controllable, From, Event, To )
AICasZone:__RTB( 1 )
end