Merge pull request #316 from FlightControl-Master/FlightControl

Fixed weaponexpend problem for gunterlund in AI_CAS
-- The attack sequence was commented out. Put it back in.
-- Fixed documentation order glitch.
-- Documented the usage of AI.Task.WeaponExpend
-- Deleted weaponType from Controller Task
This commit is contained in:
Sven Van de Velde 2017-03-18 07:44:17 +01:00 committed by GitHub
commit 71374f0ce1
18 changed files with 191 additions and 97 deletions

View File

@ -176,8 +176,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @function [parent=#AI_CAS_ZONE] Engage -- @function [parent=#AI_CAS_ZONE] Engage
-- @param #AI_CAS_ZONE self -- @param #AI_CAS_ZONE self
-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone. -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement. -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack.
-- If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- Use the structure @{DCSTypes#AI.Task.WeaponExpend} to define the amount of weapons to be release at each attack.
-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
@ -186,8 +188,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #AI_CAS_ZONE self -- @param #AI_CAS_ZONE self
-- @param #number Delay The delay in seconds. -- @param #number Delay The delay in seconds.
-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone. -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement. -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack.
-- If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- Use the structure @{DCSTypes#AI.Task.WeaponExpend} to define the amount of weapons to be release at each attack.
-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
@ -518,22 +522,27 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
Controllable:OptionROEOpenFire() Controllable:OptionROEOpenFire()
Controllable:OptionROTVertical() Controllable:OptionROTVertical()
-- local AttackTasks = {} local AttackTasks = {}
--
-- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
-- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
-- self:T( DetectedUnit ) self:T( DetectedUnit )
-- if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
-- if DetectedUnit:IsInZone( self.EngageZone ) then if DetectedUnit:IsInZone( self.EngageZone ) then
-- self:E( {"Engaging ", DetectedUnit } ) self:E( {"Engaging ", DetectedUnit } )
-- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit,
-- end true,
-- else EngageWeaponExpend,
-- self.DetectedUnits[DetectedUnit] = nil EngageAttackQty,
-- end EngageDirection
-- end )
-- end
-- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) else
self.DetectedUnits[DetectedUnit] = nil
end
end
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute ) self.Controllable:WayPointInitialize( EngageRoute )

View File

@ -563,7 +563,6 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att
altitude = Altitude or 30, altitude = Altitude or 30,
attackQtyLimit = AttackQty and true or false, attackQtyLimit = AttackQty and true or false,
attackQty = AttackQty, attackQty = AttackQty,
weaponType = 1073741822,
}, },
} }

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170317_2147' ) env.info( 'Moose Generation Timestamp: 20170318_0737' )
local base = _G local base = _G
Include = {} Include = {}
@ -13951,7 +13951,6 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att
altitude = Altitude or 30, altitude = Altitude or 30,
attackQtyLimit = AttackQty and true or false, attackQtyLimit = AttackQty and true or false,
attackQty = AttackQty, attackQty = AttackQty,
weaponType = 1073741822,
}, },
} }
@ -28979,8 +28978,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @function [parent=#AI_CAS_ZONE] Engage -- @function [parent=#AI_CAS_ZONE] Engage
-- @param #AI_CAS_ZONE self -- @param #AI_CAS_ZONE self
-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone. -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement. -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack.
-- If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- Use the structure @{DCSTypes#AI.Task.WeaponExpend} to define the amount of weapons to be release at each attack.
-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
@ -28989,8 +28990,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #AI_CAS_ZONE self -- @param #AI_CAS_ZONE self
-- @param #number Delay The delay in seconds. -- @param #number Delay The delay in seconds.
-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone. -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement. -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack.
-- If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- Use the structure @{DCSTypes#AI.Task.WeaponExpend} to define the amount of weapons to be release at each attack.
-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
@ -29321,22 +29324,27 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
Controllable:OptionROEOpenFire() Controllable:OptionROEOpenFire()
Controllable:OptionROTVertical() Controllable:OptionROTVertical()
-- local AttackTasks = {} local AttackTasks = {}
--
-- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
-- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
-- self:T( DetectedUnit ) self:T( DetectedUnit )
-- if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
-- if DetectedUnit:IsInZone( self.EngageZone ) then if DetectedUnit:IsInZone( self.EngageZone ) then
-- self:E( {"Engaging ", DetectedUnit } ) self:E( {"Engaging ", DetectedUnit } )
-- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit,
-- end true,
-- else EngageWeaponExpend,
-- self.DetectedUnits[DetectedUnit] = nil EngageAttackQty,
-- end EngageDirection
-- end )
-- end
-- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) else
self.DetectedUnits[DetectedUnit] = nil
end
end
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute ) self.Controllable:WayPointInitialize( EngageRoute )

View File

@ -1,5 +1,5 @@
env.info( '*** MOOSE STATIC INCLUDE START *** ' ) env.info( '*** MOOSE STATIC INCLUDE START *** ' )
env.info( 'Moose Generation Timestamp: 20170317_2147' ) env.info( 'Moose Generation Timestamp: 20170318_0737' )
local base = _G local base = _G
Include = {} Include = {}
@ -13951,7 +13951,6 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att
altitude = Altitude or 30, altitude = Altitude or 30,
attackQtyLimit = AttackQty and true or false, attackQtyLimit = AttackQty and true or false,
attackQty = AttackQty, attackQty = AttackQty,
weaponType = 1073741822,
}, },
} }
@ -28979,8 +28978,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @function [parent=#AI_CAS_ZONE] Engage -- @function [parent=#AI_CAS_ZONE] Engage
-- @param #AI_CAS_ZONE self -- @param #AI_CAS_ZONE self
-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone. -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement. -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack.
-- If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- Use the structure @{DCSTypes#AI.Task.WeaponExpend} to define the amount of weapons to be release at each attack.
-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
@ -28989,8 +28990,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude
-- @param #AI_CAS_ZONE self -- @param #AI_CAS_ZONE self
-- @param #number Delay The delay in seconds. -- @param #number Delay The delay in seconds.
-- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone. -- @param #number EngageSpeed (optional) The speed the Group will hold when engaging to the target zone.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement. -- @param Dcs.DCSTypes#Distance EngageAltitude (optional) Desired altitude to perform the unit engagement.
-- @param Dcs.DCSTypes#AI.Task.WeaponExpend EngageWeaponExpend (optional) Determines how much weapon will be released at each attack.
-- If parameter is not defined the unit / controllable will choose expend on its own discretion.
-- Use the structure @{DCSTypes#AI.Task.WeaponExpend} to define the amount of weapons to be release at each attack.
-- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo. -- @param #number EngageAttackQty (optional) This parameter limits maximal quantity of attack. The aicraft/controllable will not make more attack than allowed even if the target controllable not destroyed and the aicraft/controllable still have ammo. If not defined the aircraft/controllable will attack target until it will be destroyed or until the aircraft/controllable will run out of ammo.
-- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction. -- @param Dcs.DCSTypes#Azimuth EngageDirection (optional) Desired ingress direction from the target to the attacking aircraft. Controllable/aircraft will make its attacks from the direction. Of course if there is no way to attack from the direction due the terrain controllable/aircraft will choose another direction.
@ -29321,22 +29324,27 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To,
Controllable:OptionROEOpenFire() Controllable:OptionROEOpenFire()
Controllable:OptionROTVertical() Controllable:OptionROTVertical()
-- local AttackTasks = {} local AttackTasks = {}
--
-- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do
-- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT
-- self:T( DetectedUnit ) self:T( DetectedUnit )
-- if DetectedUnit:IsAlive() then if DetectedUnit:IsAlive() then
-- if DetectedUnit:IsInZone( self.EngageZone ) then if DetectedUnit:IsInZone( self.EngageZone ) then
-- self:E( {"Engaging ", DetectedUnit } ) self:E( {"Engaging ", DetectedUnit } )
-- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit,
-- end true,
-- else EngageWeaponExpend,
-- self.DetectedUnits[DetectedUnit] = nil EngageAttackQty,
-- end EngageDirection
-- end )
-- end
-- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) else
self.DetectedUnits[DetectedUnit] = nil
end
end
EngageRoute[1].task = Controllable:TaskCombo( AttackTasks )
--- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable... --- Now we're going to do something special, we're going to call a function from a waypoint action at the AIControllable...
self.Controllable:WayPointInitialize( EngageRoute ) self.Controllable:WayPointInitialize( EngageRoute )

View File

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

@ -263,7 +263,7 @@ It can be notified to go RTB through the <strong>RTB</strong> event.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap="nowrap"><a href="##(AI_CAS_ZONE).Engage">AI_CAS_ZONE:Engage(EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)</a></td> <td class="name" nowrap="nowrap"><a href="##(AI_CAS_ZONE).Engage">AI_CAS_ZONE:Engage(EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection)</a></td>
<td class="summary"> <td class="summary">
<p>Synchronous Event Trigger for Event Engage.</p> <p>Synchronous Event Trigger for Event Engage.</p>
</td> </td>
@ -425,7 +425,7 @@ It can be notified to go RTB through the <strong>RTB</strong> event.</p>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap="nowrap"><a href="##(AI_CAS_ZONE).__Engage">AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)</a></td> <td class="name" nowrap="nowrap"><a href="##(AI_CAS_ZONE).__Engage">AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection)</a></td>
<td class="summary"> <td class="summary">
<p>Asynchronous Event Trigger for Event Engage.</p> <p>Asynchronous Event Trigger for Event Engage.</p>
</td> </td>
@ -608,7 +608,7 @@ It can be notified to go RTB through the <strong>RTB</strong> event.</p>
<dt> <dt>
<a id="#(AI_CAS_ZONE).Engage" > <a id="#(AI_CAS_ZONE).Engage" >
<strong>AI_CAS_ZONE:Engage(EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)</strong> <strong>AI_CAS_ZONE:Engage(EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection)</strong>
</a> </a>
</dt> </dt>
<dd> <dd>
@ -625,14 +625,16 @@ It can be notified to go RTB through the <strong>RTB</strong> event.</p>
</li> </li>
<li> <li>
<p><code><em><a href="Dcs.DCSTypes.html##(AI.Task.WeaponExpend)">Dcs.DCSTypes#AI.Task.WeaponExpend</a> EngageWeaponExpend </em></code>: <p><code><em><a href="Dcs.DCSTypes.html##(Distance)">Dcs.DCSTypes#Distance</a> EngageAltitude </em></code>:
(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.</p> (optional) Desired altitude to perform the unit engagement.</p>
</li> </li>
<li> <li>
<p><code><em><a href="Dcs.DCSTypes.html##(Distance)">Dcs.DCSTypes#Distance</a> EngageAltitude </em></code>: <p><code><em><a href="Dcs.DCSTypes.html##(AI.Task.WeaponExpend)">Dcs.DCSTypes#AI.Task.WeaponExpend</a> EngageWeaponExpend </em></code>:
(optional) Desired altitude to perform the unit engagement.</p> (optional) Determines how much weapon will be released at each attack.
If parameter is not defined the unit / controllable will choose expend on its own discretion.
Use the structure <a href="DCSTypes.html##(AI.Task).WeaponExpend">DCSTypes#AI.Task.WeaponExpend</a> to define the amount of weapons to be release at each attack.</p>
</li> </li>
<li> <li>
@ -1448,7 +1450,7 @@ The delay in seconds.</p>
<dt> <dt>
<a id="#(AI_CAS_ZONE).__Engage" > <a id="#(AI_CAS_ZONE).__Engage" >
<strong>AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageWeaponExpend, EngageAltitude, EngageAttackQty, EngageDirection)</strong> <strong>AI_CAS_ZONE:__Engage(Delay, EngageSpeed, EngageAltitude, EngageWeaponExpend, EngageAttackQty, EngageDirection)</strong>
</a> </a>
</dt> </dt>
<dd> <dd>
@ -1471,14 +1473,16 @@ The delay in seconds.</p>
</li> </li>
<li> <li>
<p><code><em><a href="Dcs.DCSTypes.html##(AI.Task.WeaponExpend)">Dcs.DCSTypes#AI.Task.WeaponExpend</a> EngageWeaponExpend </em></code>: <p><code><em><a href="Dcs.DCSTypes.html##(Distance)">Dcs.DCSTypes#Distance</a> EngageAltitude </em></code>:
(optional) Determines how much weapon will be released at each attack. If parameter is not defined the unit / controllable will choose expend on its own discretion.</p> (optional) Desired altitude to perform the unit engagement.</p>
</li> </li>
<li> <li>
<p><code><em><a href="Dcs.DCSTypes.html##(Distance)">Dcs.DCSTypes#Distance</a> EngageAltitude </em></code>: <p><code><em><a href="Dcs.DCSTypes.html##(AI.Task.WeaponExpend)">Dcs.DCSTypes#AI.Task.WeaponExpend</a> EngageWeaponExpend </em></code>:
(optional) Desired altitude to perform the unit engagement.</p> (optional) Determines how much weapon will be released at each attack.
If parameter is not defined the unit / controllable will choose expend on its own discretion.
Use the structure <a href="DCSTypes.html##(AI.Task).WeaponExpend">DCSTypes#AI.Task.WeaponExpend</a> to define the amount of weapons to be release at each attack.</p>
</li> </li>
<li> <li>

View File

@ -920,6 +920,9 @@ Use the method <a href="##(AI_PATROL_ZONE).ManageDamage">AI<em>PATROL</em>ZONE.M
<p> This table contains the targets detected during patrol.</p>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">

View File

@ -2130,7 +2130,6 @@ self</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em>#number</em>
<a id="#(DETECTION_BASE).DetectedItemMax" > <a id="#(DETECTION_BASE).DetectedItemMax" >
<strong>DETECTION_BASE.DetectedItemMax</strong> <strong>DETECTION_BASE.DetectedItemMax</strong>
</a> </a>
@ -2244,7 +2243,7 @@ self</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#number</em>
<a id="#(DETECTION_BASE).DetectionInterval" > <a id="#(DETECTION_BASE).DetectionInterval" >
<strong>DETECTION_BASE.DetectionInterval</strong> <strong>DETECTION_BASE.DetectionInterval</strong>
</a> </a>

View File

@ -883,12 +883,6 @@ and any spaces before and after the resulting name are removed.</p>
<td class="name" nowrap="nowrap"><a href="##(SPAWN)._TranslateRotate">SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)</a></td> <td class="name" nowrap="nowrap"><a href="##(SPAWN)._TranslateRotate">SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle)</a></td>
<td class="summary"> <td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SPAWN).uncontrolled">SPAWN.uncontrolled</a></td>
<td class="summary">
</td> </td>
</tr> </tr>
</table> </table>
@ -1876,6 +1870,9 @@ The group that was spawned. You can use this group for further actions.</p>
<p> Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.</p>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">
@ -2346,6 +2343,9 @@ when nothing was spawned.</p>
<p> By default, no InitLimit</p>
</dd> </dd>
</dl> </dl>
<dl class="function"> <dl class="function">
@ -2381,7 +2381,7 @@ when nothing was spawned.</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#number</em>
<a id="#(SPAWN).SpawnMaxGroups" > <a id="#(SPAWN).SpawnMaxGroups" >
<strong>SPAWN.SpawnMaxGroups</strong> <strong>SPAWN.SpawnMaxGroups</strong>
</a> </a>
@ -2398,7 +2398,7 @@ when nothing was spawned.</p>
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#number</em>
<a id="#(SPAWN).SpawnMaxUnitsAlive" > <a id="#(SPAWN).SpawnMaxUnitsAlive" >
<strong>SPAWN.SpawnMaxUnitsAlive</strong> <strong>SPAWN.SpawnMaxUnitsAlive</strong>
</a> </a>
@ -2716,7 +2716,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<dl class="function"> <dl class="function">
<dt> <dt>
<em></em> <em>#boolean</em>
<a id="#(SPAWN).SpawnUnControlled" > <a id="#(SPAWN).SpawnUnControlled" >
<strong>SPAWN.SpawnUnControlled</strong> <strong>SPAWN.SpawnUnControlled</strong>
</a> </a>
@ -2740,7 +2740,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
<p> When the first Spawn executes, all the Groups need to be made visible before start.</p> <p> Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.</p>
</dd> </dd>
</dl> </dl>
@ -3379,20 +3379,6 @@ True = Continue Scheduler</p>
</li> </li>
</ul> </ul>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SPAWN).uncontrolled" >
<strong>SPAWN.uncontrolled</strong>
</a>
</dt>
<dd>
</dd> </dd>
</dl> </dl>