diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua index e20b2ca8f..7f1fcd618 100644 --- a/Moose Development/Moose/AI/AI_CAS.lua +++ b/Moose Development/Moose/AI/AI_CAS.lua @@ -176,8 +176,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude -- @function [parent=#AI_CAS_ZONE] Engage -- @param #AI_CAS_ZONE self -- @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#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 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 #number Delay The delay in seconds. -- @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#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 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:OptionROTVertical() --- local AttackTasks = {} --- --- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do --- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT --- self:T( DetectedUnit ) --- if DetectedUnit:IsAlive() then --- if DetectedUnit:IsInZone( self.EngageZone ) then --- self:E( {"Engaging ", DetectedUnit } ) --- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) --- end --- else --- self.DetectedUnits[DetectedUnit] = nil --- end --- end --- --- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit, + true, + EngageWeaponExpend, + EngageAttackQty, + EngageDirection + ) + end + 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... self.Controllable:WayPointInitialize( EngageRoute ) diff --git a/Moose Development/Moose/Wrapper/Controllable.lua b/Moose Development/Moose/Wrapper/Controllable.lua index 85e152ed4..c4263c1f2 100644 --- a/Moose Development/Moose/Wrapper/Controllable.lua +++ b/Moose Development/Moose/Wrapper/Controllable.lua @@ -563,7 +563,6 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att altitude = Altitude or 30, attackQtyLimit = AttackQty and true or false, attackQty = AttackQty, - weaponType = 1073741822, }, } diff --git a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua index 91fd7f218..d1fd0db90 100644 --- a/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua +++ b/Moose Mission Setup/Moose Mission Update/l10n/DEFAULT/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170317_2147' ) +env.info( 'Moose Generation Timestamp: 20170318_0737' ) local base = _G Include = {} @@ -13951,7 +13951,6 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att altitude = Altitude or 30, attackQtyLimit = AttackQty and true or false, attackQty = AttackQty, - weaponType = 1073741822, }, } @@ -28979,8 +28978,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude -- @function [parent=#AI_CAS_ZONE] Engage -- @param #AI_CAS_ZONE self -- @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#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 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 #number Delay The delay in seconds. -- @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#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 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:OptionROTVertical() --- local AttackTasks = {} --- --- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do --- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT --- self:T( DetectedUnit ) --- if DetectedUnit:IsAlive() then --- if DetectedUnit:IsInZone( self.EngageZone ) then --- self:E( {"Engaging ", DetectedUnit } ) --- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) --- end --- else --- self.DetectedUnits[DetectedUnit] = nil --- end --- end --- --- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit, + true, + EngageWeaponExpend, + EngageAttackQty, + EngageDirection + ) + end + 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... self.Controllable:WayPointInitialize( EngageRoute ) diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index 91fd7f218..d1fd0db90 100644 --- a/Moose Mission Setup/Moose.lua +++ b/Moose Mission Setup/Moose.lua @@ -1,5 +1,5 @@ env.info( '*** MOOSE STATIC INCLUDE START *** ' ) -env.info( 'Moose Generation Timestamp: 20170317_2147' ) +env.info( 'Moose Generation Timestamp: 20170318_0737' ) local base = _G Include = {} @@ -13951,7 +13951,6 @@ function CONTROLLABLE:TaskAttackUnit( AttackUnit, GroupAttack, WeaponExpend, Att altitude = Altitude or 30, attackQtyLimit = AttackQty and true or false, attackQty = AttackQty, - weaponType = 1073741822, }, } @@ -28979,8 +28978,10 @@ function AI_CAS_ZONE:New( PatrolZone, PatrolFloorAltitude, PatrolCeilingAltitude -- @function [parent=#AI_CAS_ZONE] Engage -- @param #AI_CAS_ZONE self -- @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#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 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 #number Delay The delay in seconds. -- @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#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 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:OptionROTVertical() --- local AttackTasks = {} --- --- for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do --- local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT --- self:T( DetectedUnit ) --- if DetectedUnit:IsAlive() then --- if DetectedUnit:IsInZone( self.EngageZone ) then --- self:E( {"Engaging ", DetectedUnit } ) --- AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit ) --- end --- else --- self.DetectedUnits[DetectedUnit] = nil --- end --- end --- --- EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + local AttackTasks = {} + + for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do + local DetectedUnit = DetectedUnit -- Wrapper.Unit#UNIT + self:T( DetectedUnit ) + if DetectedUnit:IsAlive() then + if DetectedUnit:IsInZone( self.EngageZone ) then + self:E( {"Engaging ", DetectedUnit } ) + AttackTasks[#AttackTasks+1] = Controllable:TaskAttackUnit( DetectedUnit, + true, + EngageWeaponExpend, + EngageAttackQty, + EngageDirection + ) + end + 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... self.Controllable:WayPointInitialize( EngageRoute ) diff --git a/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 b/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 index e23c8e5b7..82537fb9c 100644 Binary files a/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 and b/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 differ diff --git a/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 b/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 index 473daba0f..9d1b5a62e 100644 Binary files a/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 and b/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 differ diff --git a/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 b/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 index 6f0c4904e..17df3af84 100644 Binary files a/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 and b/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 differ diff --git a/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 b/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 index 2ee20a52b..16eb092a6 100644 Binary files a/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 and b/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 differ diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-004 - CAS in a Zone by Airplane Group - Test Abort/CAS-004 - CAS in a Zone by Airplane Group - Test Abort.miz b/Moose Test Missions/CAS - Close Air Support/CAS-004 - CAS in a Zone by Airplane Group - Test Abort/CAS-004 - CAS in a Zone by Airplane Group - Test Abort.miz index 3f111689d..3d399843d 100644 Binary files a/Moose Test Missions/CAS - Close Air Support/CAS-004 - CAS in a Zone by Airplane Group - Test Abort/CAS-004 - CAS in a Zone by Airplane Group - Test Abort.miz and b/Moose Test Missions/CAS - Close Air Support/CAS-004 - CAS in a Zone by Airplane Group - Test Abort/CAS-004 - CAS in a Zone by Airplane Group - Test Abort.miz differ diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend.lua b/Moose Test Missions/CAS - Close Air Support/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend.lua new file mode 100644 index 000000000..449981132 --- /dev/null +++ b/Moose Test Missions/CAS - Close Air Support/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend.lua @@ -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 diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend.miz b/Moose Test Missions/CAS - Close Air Support/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend.miz new file mode 100644 index 000000000..f255700f0 Binary files /dev/null and b/Moose Test Missions/CAS - Close Air Support/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend/CAS-005 - CAS in a Zone by Airplane Group - Engage with WeaponExpend.miz differ diff --git a/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz b/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz index 07b2793b5..f6856829f 100644 Binary files a/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz and b/Moose Test Missions/CAS - Close Air Support/CAS-010 - CAS in a Zone by Helicopter/CAS-010 - CAS in a Zone by Helicopter.miz differ diff --git a/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 b/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 index 64c1b1c2e..81bb15638 100644 Binary files a/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 and b/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 differ diff --git a/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 b/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 index 5d00e5e0c..d6e033c95 100644 Binary files a/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 and b/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 differ diff --git a/docs/Documentation/AI_Cas.html b/docs/Documentation/AI_Cas.html index 9ec5cfd1d..77d7da786 100644 --- a/docs/Documentation/AI_Cas.html +++ b/docs/Documentation/AI_Cas.html @@ -263,7 +263,7 @@ It can be notified to go RTB through the RTB event.
Synchronous Event Trigger for Event Engage.
Asynchronous Event Trigger for Event Engage.
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.
Dcs.DCSTypes#Distance EngageAltitude :
+(optional) Desired altitude to perform the unit engagement.
Dcs.DCSTypes#Distance EngageAltitude :
-(optional) Desired altitude to perform the unit engagement.
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.
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.
Dcs.DCSTypes#Distance EngageAltitude :
+(optional) Desired altitude to perform the unit engagement.
Dcs.DCSTypes#Distance EngageAltitude :
-(optional) Desired altitude to perform the unit engagement.
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.
This table contains the targets detected during patrol.
+Don't repeat the group from Take-Off till Landing and back Take-Off by ReSpawning.
+By default, no InitLimit
+When the first Spawn executes, all the Groups need to be made visible before start.
+Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.