Hover bomber fix (Completed) w/ download v0.5

Moderator: keyser

Hover bomber fix (Completed) w/ download v0.5

Postby Resin_Smoker » 26 Feb 2014, 19:56

Best way I can think of to fix this is to disable all weapons when < cruising speed.
This would prevent the release of bombs and thus the exploitation of this bug.

See last page of this thread for download links.

Resin
Last edited by Resin_Smoker on 03 Apr 2014, 20:07, edited 5 times in total.
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Hover bomber fix (Completed) w/ download

Postby Resin_Smoker » 01 Mar 2014, 07:47

Here is the fix and as far as i could tell it works as advertised...

Code: Select all
------------------------------------------------------------------------------------------
--   File     :  /mods/hover_bomber_fix/hook/lua/defaultunits.lua
--   Author(s):  Resin_Smoker
--   Summary  :  Prevents bomber from firing if they're not moving at least cruising speed
--   Copyright © 2014 All rights reserved.
------------------------------------------------------------------------------------------

do

--> Triggers all logs to report if flag set true, otherwise use the local flags within each function for specific outputs
local masterDebug = false

------------------------------------------------------------------------------------------
-- Air Units
------------------------------------------------------------------------------------------

local oldAirUnit = AirUnit
AirUnit = Class( oldAirUnit ) {

   OnStopBeingBuilt = function( self, builder, layer )
      local myDebug = false
      if myDebug or masterDebug then
         LOG('*** hover_bomber_fix defaultunits.lua, OnStopBeingBuilt ***')
         LOG('   Projectile ID: ', self:GetEntityId() )         
         LOG('   Game time is: ', GetGameTimeSeconds() )
         LOG('*************************************')                  
      end            
      oldAirUnit.OnStopBeingBuilt( self, builder, layer )
      local bp = self:GetBlueprint()
      if bp.Air.Winged and EntityCategoryContains(categories.BOMBER, self) then
         if myDebug or masterDebug then
            LOG('   Airunit is bomber')
         end
         self.IsBomber = true
         self.MyWepEnabled = true
      else
         if myDebug or masterDebug then
            LOG('   Airunit is NOT a bomber')
         end      
         self.IsBomber = false       
      end
   end,
   
   OnMotionHorzEventChange = function(self, new, old)
      local myDebug = true   
      oldAirUnit.OnMotionHorzEventChange(self, new, old) 
      if self and not self:IsDead() then
         if self.IsBomber and new != old and not self.WeapWaitState then              
            if ( new == 'Cruise' or new == 'TopSpeed' ) and ( old == 'Stopping' or old == 'Stopped' ) and not self.MyWepEnabled then
               self.MyWepEnabled = true
               for i = 1, self:GetWeaponCount() do                                         
                  self:GetWeapon(i):SetEnabled(true)
               end
               if myDebug or masterDebug then
                  LOG('   Bomber is at: ', new, ' from:', old,' ENABLING weapons')
               end            
            elseif ( old == 'Cruise' or old == 'TopSpeed' ) and ( new == 'Stopping' or new == 'Stopped' ) and self.MyWepEnabled then      
               self.MyWepEnabled = false               
               for i = 1, self:GetWeaponCount() do                                         
                  self:GetWeapon(i):SetEnabled(false)
               end
               if myDebug or masterDebug then
                  LOG('   Bomber is at: ', new, ' from:', old,' DISABLING weapons')
               end                              
            end
         end   
      end             
   end,   
   
}
end


Download link: http://www.mediafire.com/download/0nm6p28gp65rt3l/hover_bomber_fix.rar
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Hover bomber fix (Completed) w/ download

Postby Resin_Smoker » 01 Mar 2014, 22:48

V0.21 available: http://www.mediafire.com/download/con03j8298o6q85/hover_bomber_fix_v021.rar

Code: Select all
------------------------------------------------------------------------------------------
--   File     :  /mods/hover_bomber_fix/hook/lua/defaultunits.lua
--   Author(s):  Resin_Smoker
--   Summary  :  Prevents bomber from firing if they're not moving at least cruising speed
--   Copyright © 2014 All rights reserved.
------------------------------------------------------------------------------------------

do

--> Triggers all logs to report if flag set true, otherwise use the local flags within each function for specific outputs
local masterDebug = false

------------------------------------------------------------------------------------------
-- Air Units
------------------------------------------------------------------------------------------

local oldAirUnit = AirUnit
AirUnit = Class( oldAirUnit ) {

   OnStopBeingBuilt = function( self, builder, layer )
      --> Run old OnStopBeingBuilt first            
      oldAirUnit.OnStopBeingBuilt( self, builder, layer )
      --> Get units BP
      local bp = self:GetBlueprint()
      local myDebug = false
      if myDebug or masterDebug then
         LOG('*** hover_bomber_fix defaultunits.lua, OnStopBeingBuilt ***')
         LOG('   Projectile ID: ', self:GetEntityId() )         
         LOG('   Game time is: ', GetGameTimeSeconds() )
         LOG('   Name: ', bp.General.UnitName )
         LOG('*************************************')                  
      end      
      --> Ensure that unit is winged, has the category "Bomber" and is not the Mercy suicide missile
      if bp.Air.Winged and EntityCategoryContains(categories.BOMBER, self) and bp.General.UnitName != '<LOC daa0206_name>Mercy' then
         if myDebug or masterDebug then
            LOG('   Airunit is a BOMBER')
            LOG('   ')
         end
         --> Setup global flags
         self.IsBomber = true
         self.MyWepEnabled = true
      else
         if myDebug or masterDebug then
            LOG('   Airunit is NOT a bomber')
            LOG('   ')            
         end     
      end
   end,
   
   OnMotionHorzEventChange = function(self, new, old)
      local myDebug = true
      --> Run old OnMotionHorzEventChange first   
      oldAirUnit.OnMotionHorzEventChange(self, new, old)
      --> Does unit still exist 
      if self and not self:IsDead() then
         --> Is unit a bomber, is motion type different from last one reported
         if self.IsBomber and new != old then
            --> Did our bomber start moving again and are the weapons disabled              
            if ( new == 'Cruise' or new == 'TopSpeed' ) and ( old == 'Stopping' or old == 'Stopped' ) and not self.MyWepEnabled then
               --> Set flag to true
               self.MyWepEnabled = true
               --> Loop though all weapons
               for i = 1, self:GetWeaponCount() do
                  local wep = self:GetWeapon(i)
                  local wepBP = wep:GetBlueprint()
                  --> Only enable if weapon is not anti-air                  
                  if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then   
                     wep:SetEnabled(true)
                     if myDebug or masterDebug then
                        LOG('   Bomber is at: ', new, ' from:', old,' ENABLING weapons')
                     end
                  end                  
               end
            --> Did our bomber stop moving again and are the weapons enabled               
            elseif ( old == 'Cruise' or old == 'TopSpeed' ) and ( new == 'Stopping' or new == 'Stopped' ) and self.MyWepEnabled then
               --> Set flag to false      
               self.MyWepEnabled = false
               --> Loop though all weapons                              
               for i = 1, self:GetWeaponCount() do                                         
                  local wep = self:GetWeapon(i)
                  local wepBP = wep:GetBlueprint()                  
                  --> Only disable if weapon is not anti-air
                  if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then                 
                     wep:SetEnabled(false)
                     if myDebug or masterDebug then
                        LOG('   Bomber is at: ', new, ' from:', old,' DISABLING weapons')
                     end
                  end   
               end                           
            end
         end   
      end             
   end,   
   
}
end   


Note: Added support for bombers with anti-air weapons and something to omit the Mercy missile from being disabled as technically it's a bomber.

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Hover bomber fix (Completed) w/ download

Postby Lame » 02 Mar 2014, 01:10

what if i try to make a narrow turn and as a result cannot drop a bomb?
this will make bombers a shitload harder to micro in all situations not just effect double bombing

imo it wouldnt make sense that bombs cannot get dropped no matter the speed.
Lame
Banned
 
Posts: 189
Joined: 05 Jul 2013, 21:38
Has liked: 13 times
Been liked: 10 times
FAF User Name: Lame

Re: Hover bomber fix (Completed) w/ download

Postby Resin_Smoker » 02 Mar 2014, 01:33

Lame wrote:what if i try to make a narrow turn and as a result cannot drop a bomb?
this will make bombers a shitload harder to micro in all situations not just effect double bombing

imo it wouldnt make sense that bombs cannot get dropped no matter the speed.


Would not be the case as I've scripted in a few checks to help limit when this is called.

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Hover bomber fix (Completed) w/ download

Postby Resin_Smoker » 06 Mar 2014, 06:34

Already had the script made a few days back so i might as well post the script with the delay function added. Notice how i forked this and how i can kill the fork at will.

Download Link: http://www.mediafire.com/download/e3uip7tdu571f9r/hover_bomber_fix_v0.3.rar

Code: Select all
------------------------------------------------------------------------------------------
--   File     :  /mods/hover_bomber_fix/hook/lua/defaultunits.lua
--   Author(s):  Resin_Smoker
--   Summary  :  Prevents bomber from firing if they're not moving at least cruising speed
--   Copyright © 2014 All rights reserved.
------------------------------------------------------------------------------------------

do

--> Triggers all logs to report if flag set true, otherwise use the local flags within each function for specific outputs
local masterDebug = true

------------------------------------------------------------------------------------------
-- Air Units
------------------------------------------------------------------------------------------

local oldAirUnit = AirUnit
AirUnit = Class( oldAirUnit ) {

   OnStopBeingBuilt = function( self, builder, layer )
      --> Run old OnStopBeingBuilt first            
      oldAirUnit.OnStopBeingBuilt( self, builder, layer )
      --> Get units BP
      local bp = self:GetBlueprint()
      local myDebug = false
      if myDebug and masterDebug then
         LOG('*** hover_bomber_fix defaultunits.lua, OnStopBeingBuilt ***')
         LOG('   Projectile ID: ', self:GetEntityId() )         
         LOG('   Game time is: ', GetGameTimeSeconds() )
         LOG('   Name: ', bp.General.UnitName )
         LOG('*************************************')                  
      end      
      --> Ensure that unit is winged, has the category "Bomber" and is not the Mercy suicide missile
      if bp.Air.Winged and EntityCategoryContains(categories.BOMBER, self) and bp.General.UnitName != '<LOC daa0206_name>Mercy' then
         if myDebug and masterDebug then
            LOG('   Airunit is a BOMBER')
            LOG('   ')
         end
         --> Setup global flags
         self.IsBomber = true
         self.MyWepEnabled = true
      else
         if myDebug and masterDebug then
            LOG('   Airunit is NOT a bomber')
            LOG('   ')            
         end     
      end
   end,
   
   OnMotionHorzEventChange = function(self, new, old)
      local myDebug = true
      --> Run old OnMotionHorzEventChange first   
      oldAirUnit.OnMotionHorzEventChange(self, new, old)
      --> Does unit still exist 
      if self and not self:IsDead() then
         --> Is unit a bomber, is motion type different from last one reported
         if self.IsBomber and new != old then
            --> Did our bomber start moving again and are the weapons disabled              
            if ( new == 'Cruise' or new == 'TopSpeed' ) and ( old == 'Stopping' or old == 'Stopped' ) and not self.MyWepEnabled and not self.WeaponReactivationFork then
               --> Kick off delay fork
               self.WeaponReactivationFork = ForkThread(self.WeaponReactivationDelay, self, new, old)            
            --> Did our bomber stop moving again and are the weapons enabled               
            elseif ( old == 'Cruise' or old == 'TopSpeed' ) and ( new == 'Stopping' or new == 'Stopped' ) and self.MyWepEnabled then
               --> Kill fork if active
               if self.WeaponReactivationFork then
                  if myDebug and masterDebug then
                     LOG('   Killing WeaponReactivationFork')
                  end                  
                  KillThread(self.WeaponReactivationFork)
                  --> Clear off the global so the event can be used again
                  self.WeaponReactivationFork = nil
               end
               --> Set flag to false      
               self.MyWepEnabled = false
               --> Loop though all weapons                              
               for i = 1, self:GetWeaponCount() do                                         
                  local wep = self:GetWeapon(i)
                  local wepBP = wep:GetBlueprint()                  
                  --> Only disable if weapon is not anti-air
                  if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then                 
                     wep:SetEnabled(false)
                     if myDebug and masterDebug then
                        LOG('   Bomber is at: ', new, ' from:', old,' DISABLING weapons')
                     end
                  end   
               end                           
            end
         end   
      end             
   end,
   
   WeaponReactivationDelay = function( self, new, old )
      local myDebug = true
      if myDebug and masterDebug then
         LOG('WeaponReactivationDelay')
      end         
      --> Time delay in "ticks" before weapons are set active again. 10 ticks = 1 second. Please do not use setting lower than 5 ticks to help keep the game sync'd during multiplayer
      --> Remember the default ping for all players is at least 500ms or 0.5 seconds or 5 ticks.
      WaitTicks(10)
      if myDebug and masterDebug then
         LOG('   Delay complete...')
      end         
      --> Does unit still exist 
      if self and not self:IsDead() then      
         --> Set flag to true
         self.MyWepEnabled = true
         --> Loop though all weapons
         for i = 1, self:GetWeaponCount() do
            local wep = self:GetWeapon(i)
            local wepBP = wep:GetBlueprint()
            --> Only enable if weapon is not anti-air                  
            if wepBP.WeaponCategory != 'Anti Air' and wepBP.RangeCategory != 'UWRC_AntiAir' then   
               wep:SetEnabled(true)
               if myDebug and masterDebug then
                  LOG('   Bomber is at: ', new, ' from:', old,' ENABLING weapons')
               end
            end                  
         end
      end                        
   end,
   
}
end   


Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Hover bomber fix (Completed) w/ download v0.3

Postby Krapougnak » 06 Mar 2014, 10:27

Shouldn't this go into "useful tools and mods" forum ? (so I could remember to download it this week end when I'm not tired from work :mrgreen: )

edited: just found out it is also already in the "useful tools & mods" forum - irrelevant post
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak

Re: Hover bomber fix (Completed) w/ download v0.3

Postby Resin_Smoker » 06 Mar 2014, 23:09

So far the feedback I've received on this confirms that it's working.
Anyone else have feedback to report?

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Hover bomber fix (Completed) w/ download v0.3

Postby Resin_Smoker » 10 Mar 2014, 21:20

V0.4 !

http://www.mediafire.com/download/kpqqw ... x_v0.4.rar

    *Addressed bomber random break off screwing up how well bomber performs in certain situations. (Should see a 20-40% improvement in attack rate)
    *Added an enhanced priority list to each T1 Bombers targeting.

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Hover bomber fix (Completed) w/ download v0.5

Postby Resin_Smoker » 03 Apr 2014, 20:09

V0.5 !!!

    Made it all but impossible to hover bomb now.
    Bombs show range rings.
    Added the Janus fix.
    Tweaked a few Hit-boxes so they fix the units models.

http://www.mediafire.com/download/c3ybp ... x_v0.5.rar

Enjoy!

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Next

Return to FAF Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest