FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login
    The current pre-release of the client ("pioneer" in the version) is only compatible to itself. So you can only play with other testers. Please be aware!

    experimental strategic missile defense system idea

    Scheduled Pinned Locked Moved Modding & Tools
    5 Posts 2 Posters 85 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      Mavr390
      last edited by

      Hello!!!
      I've come up with the idea of ​​creating an experimental missile defense system. It will be the only one available for construction (how to do this isn't a problem) and will have a large protection radius. I want its main feature to be 99 percent damage absorption when it's not in fire mode. I know how to do this for it in any state, but I need it to take +300 percent damage when in fire mode. How do I implement this?

      1 Reply Last reply Reply Quote 0
      • N Offline
        Nomander Balance Team
        last edited by

        Use Unit:AlterArmor to change the damage amount.
        Hook the OnGotTarget, and OnLostTarget functions of the unit weapon to adjust the damage resistance when needed. Janus example

        M 1 Reply Last reply Reply Quote 2
        • M Offline
          Mavr390 @Nomander
          last edited by

          @Nomander Thanks, I'll try))

          1 Reply Last reply Reply Quote 0
          • M Offline
            Mavr390
            last edited by Mavr390

            Some time ago, I decided to build an experimental defense system for the AEON based on a Colossus magnetic cannon with two barrels (as it later turned out, they interfered with each other), and someone gave me a piece of code that solved this problem. I applied it to my experimental missile defense system. Each barrel is a separate weapon in *script.lua . The missile defense system has 12 barrels, and they can all launch 12 missiles simultaneously with this code. But the problem is that any massive launch of more than four nuclear missiles will empty the silo's entire supply instantly. To test it, I loaded the silo with 24 missiles. Here's the code:

            IsTargetAlreadyUsed = function( self, target )
            local wep
            for i = 1, self.unit:GetWeaponCount() do
                wep = self.unit:GetWeapon( i )
                if ( wep != self ) then
            	if self:GetRealTarget( wep:GetCurrentTarget(), wep ) == target then
                             self:ResetTarget()
                             self.AimControl:SetResetPoseTime(2)
            	     return true
            	end
                end
            end
            return false
            end,
            

            How can I make each barrel use only one missile at one target, taking into account the rate of fire?

            1 Reply Last reply Reply Quote 0
            • N Offline
              Nomander Balance Team
              last edited by

              Here's a prototype script for aeon smd I made where each projectile gets assigned to the shooter cap. A weapon won't target something if its shooter cap is reached, but it will shoot continuously once it has targeted. Adding the projectile to the cap instead of the weapon basically keeps track of how many projectiles are in the air instead of how many shooters there are. This works better than normal but it still fails for nukes that take more than 1 shot to kill like Yolona since the projectile is removed as a shooter once it impacts. I suppose you could work around that by spawning dummy entities taking up the shooter cap every time the high HP nuke projectile takes damage. That workaround would also work for non-projectile weapons in general.

              ---@class UAB4302 : AStructureUnit
              UAB4302 = ClassUnit(AStructureUnit) {
                  Weapons = {
                      ---@class UAB4302_MissileRack : AAMSaintWeapon
                      ---@field unit UAB4302
                      MissileRack = ClassWeapon(AAMSaintWeapon) {
                          ---@param self UAB4302_MissileRack
                          ---@param muzzle Bone
                          ---@return Projectile
                          CreateProjectileAtMuzzle = function(self, muzzle)
                              local proj = AAMSaintWeapon.CreateProjectileAtMuzzle(self, muzzle)
                              LOG('self target', self:GetCurrentTarget())
                              local target = self:GetCurrentTarget()
                              if target then
                                  target:AddShooter(proj)
                                  LOG('target shooters:', target:ReachedMaxShooters())
                              end
              
                              return proj
                          end,
                          RackSalvoFiringState = State(AAMSaintWeapon.RackSalvoFiringState) {
                              Main = function(self)
                                  local target = self:GetCurrentTarget()
                                  if target then
                                      target:RemoveShooter(self.unit)
                                      LOG('maxed?', target:ReachedMaxShooters())
                                      if target:ReachedMaxShooters() then self:ResetTarget() ChangeState(self, self.RackSalvoFireReadyState) return end
                                  end
              
                                  AAMSaintWeapon.RackSalvoFiringState.Main(self)
                              end
                          },
                      },
                  },
              }
              
              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post