experimental strategic missile defense system idea
-
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? -
Use Unit:AlterArmor to change the damage amount.
Hook theOnGotTarget, andOnLostTargetfunctions of the unit weapon to adjust the damage resistance when needed. Janus example -
@Nomander Thanks, I'll try))
-
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?
-
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 }, }, }, } -
Unfortunately, it doesn't work. It's quite possible that this is because I'm testing everything on the vanilla version of the game. Perhaps something has already been changed in FAF, and that's why it doesn't work for me.
The code I have written in both files is in the attached file.
For testing, I created a nuclear mother missile that disintegrates into 10 fragments. When it disintegrates, the strategic missile defense system fires all 24 missiles, although 10 would have been sufficient. How can I solve this problem?
GEB4403.txt
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