BulletMagnet wrote:
It would be best done with two different weapons, each firing a different missile.
The Sky Slammer is a really good example of this.
So a toggle button might be in order for firing selection? Similarly, would an altitude toggle button work well for things like Aeon Guided Missile?
BulletMagnet wrote:
As far as I know, the only thing that can hug terrain is an aircraft. If you were up to the challenge, you could create a temporary, invisible, aircraft, and glue the missile to it (perfectly possible, to my knowledge). Then instruct the aircraft to fly to the destination, and detach the missile at the point you want it to stop terrain hugging.
Yeah, I figured I'd have to do some invisible aircraft mojo unless I could somehow import kamikaze aircraft behavior like from the mercy into a regular missile.
BulletMagnet wrote:
Nope, because tracking always tries to home in on the target (or the ground beneath the target). If the target moves, the missile will correct its trajectory. There's no academic difference between homing inaccuracy and the target moving.
At the very best, you could adjust the turn speed way, way, down and fire it like artillery.[/quote]
So there is no "fly at elevation X"? It's all just controlled by the script? The documentation and projectile.bp and .script (and .script in general, if you know where I could find a list of functions and definitions for the various .scripts like the supcom wiki explains how weapon.bp works that would be great). Any chance you could take a look at the relevant parts of this Tac missile and roughly explain how it works? Mainly the turn at 90 degrees and seek.
Code:
Physics = {
Acceleration = 3,
DestroyOnWater = true,
InitialSpeed = 3,
LifeTime = 30,
MaxSpeed = 12,
MaxZigZag = 5,
RotationalVelocity = 0,
RotationalVelocityRange = 0,
TrackTarget = true,
TrackTargetGround = true,
TurnRate = 0,
UseGravity = false,
VelocityAlign = true,
ZigZagFrequency = 0.2,
},
Script:
Code:
AIFMissileTactical01 = Class(AMissileSerpentineProjectile) {
OnCreate = function(self)
AMissileSerpentineProjectile.OnCreate(self)
self:SetCollisionShape('Sphere', 0, 0, 0, 2.0)
self:ForkThread( self.MovementThread )
end,
MovementThread = function(self)
self.WaitTime = 0.1
self:SetTurnRate(8)
WaitSeconds(0.3)
while not self:BeenDestroyed() do
self:SetTurnRateByDist()
WaitSeconds(self.WaitTime)
end
end,
SetTurnRateByDist = function(self)
local dist = self:GetDistanceToTarget()
#Get the nuke as close to 90 deg as possible
if dist > 50 then
#Freeze the turn rate as to prevent steep angles at long distance targets
WaitSeconds(2)
self:SetTurnRate(20)
elseif dist > 128 and dist <= 213 then
# Increase check intervals
self:SetTurnRate(30)
WaitSeconds(1.5)
self:SetTurnRate(30)
elseif dist > 43 and dist <= 107 then
# Further increase check intervals
WaitSeconds(0.3)
self:SetTurnRate(50)
elseif dist > 0 and dist <= 43 then
# Further increase check intervals
self:SetTurnRate(100)
KillThread(self.MoveThread)
end
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