diff --git a/Moose Development/Moose/AI/AI_CAS.lua b/Moose Development/Moose/AI/AI_CAS.lua index 7f1fcd618..149fc4a8e 100644 --- a/Moose Development/Moose/AI/AI_CAS.lua +++ b/Moose Development/Moose/AI/AI_CAS.lua @@ -452,7 +452,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, self.EngageDirection = EngageDirection if Controllable:IsAlive() then - local EngageRoute = {} @@ -473,55 +472,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageRoute[#EngageRoute+1] = CurrentRoutePoint - --- if self.Controllable:IsNotInZone( self.EngageZone ) then --- --- -- Find a random 2D point in EngageZone. --- local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2() --- self:T2( ToEngageZoneVec2 ) --- --- -- Obtain a 3D @{Point} from the 2D point + altitude. --- local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, self.EngageAltitude, ToEngageZoneVec2.y ) --- --- -- Create a route point of type air. --- local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir( --- self.PatrolAltType, --- POINT_VEC3.RoutePointType.TurningPoint, --- POINT_VEC3.RoutePointAction.TurningPoint, --- self.EngageSpeed, --- true --- ) --- --- EngageRoute[#EngageRoute+1] = ToEngageZoneRoutePoint --- --- end --- - --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. - - --- Find a random 2D point in EngageZone. - local ToTargetVec2 = self.EngageZone:GetRandomVec2() - self:T2( ToTargetVec2 ) - - --- Obtain a 3D @{Point} from the 2D point + altitude. - local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y ) - - --- Create a route point of type air. - local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( - self.PatrolAltType, - POINT_VEC3.RoutePointType.TurningPoint, - POINT_VEC3.RoutePointAction.TurningPoint, - self.EngageSpeed, - true - ) - - --ToTargetPointVec3:SmokeBlue() - - EngageRoute[#EngageRoute+1] = ToTargetRoutePoint - - - Controllable:OptionROEOpenFire() - Controllable:OptionROTVertical() - local AttackTasks = {} for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do @@ -544,16 +494,39 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. + + --- Find a random 2D point in EngageZone. + local ToTargetVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( + self.PatrolAltType, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + self.EngageSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToTargetRoutePoint + --- 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 ) + Controllable:WayPointInitialize( EngageRoute ) --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... - self.Controllable:SetState( self.Controllable, "EngageZone", self ) + Controllable:SetState( Controllable, "EngageZone", self ) - self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) + Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) --- NOW ROUTE THE GROUP! - self.Controllable:WayPointExecute( 1 ) + Controllable:WayPointExecute( 1 ) + + Controllable:OptionROEOpenFire() + Controllable:OptionROTVertical() self:SetDetectionInterval( 2 ) self:SetDetectionActivated() 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 adbe1c47e..e0e8f6129 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: 20170319_0533' ) +env.info( 'Moose Generation Timestamp: 20170319_0550' ) local base = _G Include = {} @@ -29254,7 +29254,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, self.EngageDirection = EngageDirection if Controllable:IsAlive() then - local EngageRoute = {} @@ -29275,55 +29274,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageRoute[#EngageRoute+1] = CurrentRoutePoint - --- if self.Controllable:IsNotInZone( self.EngageZone ) then --- --- -- Find a random 2D point in EngageZone. --- local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2() --- self:T2( ToEngageZoneVec2 ) --- --- -- Obtain a 3D @{Point} from the 2D point + altitude. --- local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, self.EngageAltitude, ToEngageZoneVec2.y ) --- --- -- Create a route point of type air. --- local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir( --- self.PatrolAltType, --- POINT_VEC3.RoutePointType.TurningPoint, --- POINT_VEC3.RoutePointAction.TurningPoint, --- self.EngageSpeed, --- true --- ) --- --- EngageRoute[#EngageRoute+1] = ToEngageZoneRoutePoint --- --- end --- - --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. - - --- Find a random 2D point in EngageZone. - local ToTargetVec2 = self.EngageZone:GetRandomVec2() - self:T2( ToTargetVec2 ) - - --- Obtain a 3D @{Point} from the 2D point + altitude. - local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y ) - - --- Create a route point of type air. - local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( - self.PatrolAltType, - POINT_VEC3.RoutePointType.TurningPoint, - POINT_VEC3.RoutePointAction.TurningPoint, - self.EngageSpeed, - true - ) - - --ToTargetPointVec3:SmokeBlue() - - EngageRoute[#EngageRoute+1] = ToTargetRoutePoint - - - Controllable:OptionROEOpenFire() - Controllable:OptionROTVertical() - local AttackTasks = {} for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do @@ -29346,16 +29296,39 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. + + --- Find a random 2D point in EngageZone. + local ToTargetVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( + self.PatrolAltType, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + self.EngageSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToTargetRoutePoint + --- 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 ) + Controllable:WayPointInitialize( EngageRoute ) --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... - self.Controllable:SetState( self.Controllable, "EngageZone", self ) + Controllable:SetState( Controllable, "EngageZone", self ) - self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) + Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) --- NOW ROUTE THE GROUP! - self.Controllable:WayPointExecute( 1 ) + Controllable:WayPointExecute( 1 ) + + Controllable:OptionROEOpenFire() + Controllable:OptionROTVertical() self:SetDetectionInterval( 2 ) self:SetDetectionActivated() diff --git a/Moose Mission Setup/Moose.lua b/Moose Mission Setup/Moose.lua index adbe1c47e..e0e8f6129 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: 20170319_0533' ) +env.info( 'Moose Generation Timestamp: 20170319_0550' ) local base = _G Include = {} @@ -29254,7 +29254,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, self.EngageDirection = EngageDirection if Controllable:IsAlive() then - local EngageRoute = {} @@ -29275,55 +29274,6 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageRoute[#EngageRoute+1] = CurrentRoutePoint - --- if self.Controllable:IsNotInZone( self.EngageZone ) then --- --- -- Find a random 2D point in EngageZone. --- local ToEngageZoneVec2 = self.EngageZone:GetRandomVec2() --- self:T2( ToEngageZoneVec2 ) --- --- -- Obtain a 3D @{Point} from the 2D point + altitude. --- local ToEngageZonePointVec3 = POINT_VEC3:New( ToEngageZoneVec2.x, self.EngageAltitude, ToEngageZoneVec2.y ) --- --- -- Create a route point of type air. --- local ToEngageZoneRoutePoint = ToEngageZonePointVec3:RoutePointAir( --- self.PatrolAltType, --- POINT_VEC3.RoutePointType.TurningPoint, --- POINT_VEC3.RoutePointAction.TurningPoint, --- self.EngageSpeed, --- true --- ) --- --- EngageRoute[#EngageRoute+1] = ToEngageZoneRoutePoint --- --- end --- - --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. - - --- Find a random 2D point in EngageZone. - local ToTargetVec2 = self.EngageZone:GetRandomVec2() - self:T2( ToTargetVec2 ) - - --- Obtain a 3D @{Point} from the 2D point + altitude. - local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y ) - - --- Create a route point of type air. - local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( - self.PatrolAltType, - POINT_VEC3.RoutePointType.TurningPoint, - POINT_VEC3.RoutePointAction.TurningPoint, - self.EngageSpeed, - true - ) - - --ToTargetPointVec3:SmokeBlue() - - EngageRoute[#EngageRoute+1] = ToTargetRoutePoint - - - Controllable:OptionROEOpenFire() - Controllable:OptionROTVertical() - local AttackTasks = {} for DetectedUnitID, DetectedUnit in pairs( self.DetectedUnits ) do @@ -29346,16 +29296,39 @@ function AI_CAS_ZONE:onafterEngage( Controllable, From, Event, To, EngageRoute[1].task = Controllable:TaskCombo( AttackTasks ) + --- Define a random point in the @{Zone}. The AI will fly to that point within the zone. + + --- Find a random 2D point in EngageZone. + local ToTargetVec2 = self.EngageZone:GetRandomVec2() + self:T2( ToTargetVec2 ) + + --- Obtain a 3D @{Point} from the 2D point + altitude. + local ToTargetPointVec3 = POINT_VEC3:New( ToTargetVec2.x, self.EngageAltitude, ToTargetVec2.y ) + + --- Create a route point of type air. + local ToTargetRoutePoint = ToTargetPointVec3:RoutePointAir( + self.PatrolAltType, + POINT_VEC3.RoutePointType.TurningPoint, + POINT_VEC3.RoutePointAction.TurningPoint, + self.EngageSpeed, + true + ) + + EngageRoute[#EngageRoute+1] = ToTargetRoutePoint + --- 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 ) + Controllable:WayPointInitialize( EngageRoute ) --- Do a trick, link the NewEngageRoute function of the object to the AIControllable in a temporary variable ... - self.Controllable:SetState( self.Controllable, "EngageZone", self ) + Controllable:SetState( Controllable, "EngageZone", self ) - self.Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) + Controllable:WayPointFunction( #EngageRoute, 1, "_NewEngageRoute" ) --- NOW ROUTE THE GROUP! - self.Controllable:WayPointExecute( 1 ) + Controllable:WayPointExecute( 1 ) + + Controllable:OptionROEOpenFire() + Controllable:OptionROTVertical() self:SetDetectionInterval( 2 ) self:SetDetectionActivated() 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 index 837a4b0f0..943e5661f 100644 Binary files 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 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