ModNUKEs - MIRVs
-
Hi everybody! Appreciate the assistance to fix my intention for create a new projectile - UEF MIRV Nuke, any guideline is welcome, thank you very much.
The idea is to launch a nuke that splits into several MIRVs before impact, by a circular radius pattern (and not a fan radius pattern).
So far, despite various attempts I encountered some difficulties with correct script - latest template below.
local TIFMissileNuke = import('/lua/terranprojectiles.lua').TIFMissileNuke
local EffectTemplate = import('/lua/EffectTemplates.lua')
local RandomFloat = import('/lua/utilities.lua').GetRandomFloat
local VizMarker = import('/lua/sim/VizMarker.lua').VizMarker---@ UEF Main MIRV Missile
TIFMissileNuke25 = Class(TIFMissileNuke) {InitialEffects = {'/effects/emitters/nuke_munition_launch_trail_02_emit.bp',}, LaunchEffects = { '/effects/emitters/nuke_munition_launch_trail_03_emit.bp', '/effects/emitters/nuke_munition_launch_trail_05_emit.bp', '/effects/emitters/nuke_munition_launch_trail_07_emit.bp', }, ThrustEffects = {'/effects/emitters/nuke_munition_launch_trail_04_emit.bp', '/effects/emitters/nuke_munition_launch_trail_06_emit.bp', }, OnCreate = function(self) TIFMissileNuke.OnCreate(self) self:SetCollisionShape('Sphere', 0, 0, 0, 2.0) self:LauncherCallbacks() self.MoveThread = self:ForkThread(self.MovementThread) end, CreateEffects = function( self, EffectTable, army, scale) for k, v in EffectTable do self.Trash:Add(CreateAttachedEmitter(self, -1, army, v):ScaleEmitter(scale)) end end, MovementThread = function(self) local army = self:GetArmy() local launcher = self:GetLauncher() self.CreateEffects( self, self.InitialEffects, army, 1 ) self:TrackTarget(false) WaitTicks(8) -- Height self:SetCollision(true) self.CreateEffects( self, self.LaunchEffects, army, 1 ) WaitTicks(20) self.CreateEffects( self, self.ThrustEffects, army, 1 ) self:TrackTarget(true) -- Turn ~90 degrees towards target self:SetDestroyOnWater(true) self:SetTurnRate(47.36) WaitTicks(20) -- Now set turn rate to zero so nuke flies straight self:SetTurnRate(0) self:SetAcceleration(0.001) self.WaitTime = 5 while not self:BeenDestroyed() do self:SetTurnRateByDist() WaitTicks(self.WaitTime) end end, SetTurnRateByDist = function(self) local dist = self:GetDistanceToTarget() -- Get the nuke as close to 90 deg as possible if dist > 150 then -- Freeze the turn rate as to prevent steep angles at long distance targets self:SetTurnRate(0) elseif dist > 75 and dist <= 150 then self.WaitTime = 3 elseif dist > 32 and dist <= 75 then self.WaitTime = 1 elseif dist < 15 then self:SetTurnRate(95) end end, OnImpact = function(self, TargetType, TargetEntity) local FxFragEffect = EffectTemplate.TFragmentationSensorShellFrag local ChildProjectileBP = '/mods/Antares Unit Pack/projectiles/TIFMissileNuke12/TIFMissileNuke12_proj.bp' # Split effects for k, v in FxFragEffect do CreateEmitterAtEntity( self, self:GetArmy(), v ) end local vx, vy, vz = self:GetVelocity() local velocity = 6 # One initial projectile following same directional path as the original self:CreateChildProjectile(ChildProjectileBP):SetVelocity(vx, vy, vz):SetVelocity(velocity):PassDamageData(self.DamageData) # Create several other projectiles in a dispersal pattern local numProjectiles = 6 local angle = (2*math.pi) / numProjectiles local angleInitial = RandomFloat( 0, angle ) # Randomization of the spread local angleVariation = angle * 0.35 # Adjusts angle variance spread local spreadMul = 2.5 # Adjusts the width of the dispersal local xVec = 0 local yVec = vy local zVec = 0 # Launch projectiles at semi-random angles away from split location for i = 0, (numProjectiles -1) do xVec = vx + (math.sin(angleInitial + (i*angle) + RandomFloat(-angleVariation, angleVariation))) * spreadMul zVec = vz + (math.cos(angleInitial + (i*angle) + RandomFloat(-angleVariation, angleVariation))) * spreadMul local proj = self:CreateChildProjectile(ChildProjectileBP) proj:SetVelocity(xVec,yVec,zVec) proj:SetVelocity(velocity) proj:PassDamageData(self.DamageData) end self:Destroy() TIFMissileNuke.OnImpact(self, TargetType, TargetEntity) end, PassDamageData = function(self, damageData) TIFMissileNuke.PassDamageData(self,damageData) local launcherbp = self:GetLauncher():GetBlueprint() self.ChildDamageData = table.copy(self.DamageData) end, GetDistanceToTarget = function(self) local tpos = self:GetCurrentTargetPosition() local mpos = self:GetPosition() local dist = VDist2(mpos[1], mpos[3], tpos[1], tpos[3]) return dist end,}
TypeClass = TIFMissileNuke25
-
Splitting a single projectile - into multiple 'child' projectiles, is currently done in a couple of already existing weapons. The Cybran T2 Mobile Tactical Missile launcher unit, and the AEON T3/T4 Artillery Experimental.
You should look at how those scripts deal with creating new projectiles, based on the trajectory of the old one - while in flight.
-
@Sprouto Thank you very much, I solve the issue and presently for all factions Nukes with MIRVs are running fine. FYKI, due to ballistic trajectory the ICBMs are slightly different to make them split by compare with classic missiles or artillery projects. AGW the revised Antares Unit Pack mode shall be available this spring ...
-
Antares preservation pack on moddb and Annihilation New Supcom has this.
-
Antares 2.5
https://www.moddb.com/mods/antares-unit-pack-v25/downloads
and
Antares Unit pack (preservation)This particular version has the GOOD version of Orbital Wars with spaceships that arent massive suckitude for no reason.
IIRC there is also another mod out there that has MIRV nukes. This one has Antares units and SEVERAL others, including an arty variant called the Omatham which rapidly fires energy beings as artillery, hits and shield and falls down immediately. devastating.
We really need to change some rules regarding uploading things to the vault regarding the authors, especially since several have been gone for years. The only reason I managed to get these mods originally was the auto download function when you clicked into a modded game. They were autoshared. I had forgotten about moddb and most others forgot about it too.
EDIT: DERP
@AntaresOneHoly crap you LIVE. And i already replied to this thread. whoops.
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