Space Engineers

Space Engineers

WHAM | Whip's Homing Advanced Missile Script
706 Comments
TheGuyKnightly Jan 19 @ 9:45pm 
Is it possible to make this fire and forget? (I did NOT understand a single word in here)
Whiplash141  [author] Jan 13 @ 12:24pm 
That is not an error associated with this script or any script for that matter. Sounds like you have mods or plugins installed.
Drunken Operator Jan 12 @ 7:51pm 
it did not
Drunken Operator Jan 12 @ 7:44pm 
I fire 1 missile and everything works correctly, but upon the launch of the second missile i get the error "Error: Cannot Find the Blueprint File" spammed over and over again and have to restart my game, i am in a testing world so i removed the old target and made a new one, but it isnt working correctly, going to test again and see if re targeting after a game restart fixes my issue
Yoghurt Dec 18, 2024 @ 12:07pm 
I see! Thanks. The remote control I was just wondering about because it would be cool to be able to sometimes control it and for example escort some other ship with torpedoes, or to launch and print a bunch of them before sending them to a target to get a more overwhelming amount at once. But I get stuff like that wouldn't fit in the script.
Whiplash141  [author] Dec 18, 2024 @ 11:27am 
"Sometimes it seems the missile switches target when I just switch lock."

That indicates that the missile does not have its own lock on your target. If a missile has no target of its own, it flies in semi-active guidance mode and attempts to track whatever LAMP is actively painting. Once it has a lock of its own, it only listens to LAMP updates associated with its actively guided target.

You can set "Antenna name mode" to "MissileStatus" to troubleshoot the homing status of each missile through its antenna name.

"Another question, is there a way to take over control of the missile manually through the remote block?"

I mean you can try, but the script will actively fight you as that is not intended functionality. You can always manually launch via RC and steer it in yourself.
Yoghurt Dec 18, 2024 @ 11:22am 
I feel like I'm getting mixed behaviour. Does a launched missile switch target itself if you switch your lock to a different target mid-flight? I assumed that was what the retask command is for. Sometimes it seems the missile switches target when I just switch lock. Sometimes it works as I intend where I launch 1 missile at one target and another at a different target before the first has hit. How does it work?

Another question, is there a way to take over control of the missile manually through the remote block?
Whiplash141  [author] Dec 4, 2024 @ 11:04am 
Performance and the fact that almost every server uses only 3km sync distance anyways
nanuzacih Dec 4, 2024 @ 6:41am 
And why is the range only 5km?
Whiplash141  [author] Oct 21, 2024 @ 9:48am 
That is a your game problem, not the script. Submit a big report to KSWH.
Mischief_Master Oct 20, 2024 @ 6:17pm 
Missles work great, exept for the fact that IT CORRUPTS THE GAME FOR THE HOST the second i launch it....sooo its worhless
Mo Oct 2, 2024 @ 7:02pm 
Thanks a lot!
Whiplash141  [author] Oct 2, 2024 @ 3:06pm 
"Is there any where to read about the available guidance algorithms?"
Uhhhhh... I keep forgetting to finish the writeup lol
Whiplash141  [author] Oct 2, 2024 @ 3:05pm 
"Does script works well with top mounted cameras from automaton update?"
Yep

"Does spinning (miscellaneous parameter of WHAM) affect effectiveness of missile?"
Yep. Higher spin makes it more difficult for the missile to track a maneuvering target

"What spin rate is safe?"
Honestly depends on the missile itself. The heavier/less maneuverable the missile, the worse the effect spinning has on responsiveness

"Can I compensate for the lack of side cameras on two out of four sides with spinning of missile?"
Yes. WHAM will use whatever cameras are facing the target that it can find.
Mo Oct 2, 2024 @ 12:29pm 
Hello. Thanks again for your great script!
Does script works well with top mounted cameras from automaton update? (Nothing obscures the view)
Does spinning (miscellaneous parameter of WHAM) affect effectiveness of missile? What spin rate is safe?
Can I compensate for the lack of side cameras on two out of four sides with spinning of missile?
Based_Stickman Oct 1, 2024 @ 3:27pm 
Is there any where to read about the available guidance algorithms?
Whiplash141  [author] Sep 1, 2024 @ 1:44pm 
Guidance delay only delays activation of steering. The rest of the launch staging is entirely unaffected.

If you have no thrusters name tagged with "Detach", set the "Detach duration" to 0.
Grimir Sep 1, 2024 @ 1:02pm 
Sadly changing the Guidance Delay will only Delay. for the Rocket to do anything at all.

I am not using any Mods. And i am using both the latest version of WHAM and LAMP.
Whiplash141  [author] Aug 31, 2024 @ 11:56am 
Have you tried longer guidance delays? That below configuration only gives the missile 0.5 seconds to get out of the tube.
Grimir Aug 31, 2024 @ 10:37am 
Pardon my intrusion.
As of late, my Missiles start turning while within the Welding Chamber.

Whereas before, the would leave the Chamber/Bay/Silo - whatever you might call it.
And then start turning.

I have medled with the Settings;
[Delays]
Guidance delay (s)=1.5
Stage 1: Disconnect delay (s)=1
Stage 2: Detach duration (s)=2
Stage 3: Main ignition delay (s)=0

To try and adjust this issue.
I even tried using Missiles from your Viper Demonstration BP.
but they do the same, on all of my Grids.

Even ones i build arround your Viper showcase.
The pasted Viper on its own, works just like a charm.

Thank you very much for all the neat Creations you share with the community.
Whiplash141  [author] Aug 25, 2024 @ 12:27am 
Not for super precise things, no
Redstar Aug 24, 2024 @ 11:24pm 
Yes, I require a specific sequence of events before detonation, so I use a timer. I assume it's not viable?
Whiplash141  [author] Aug 24, 2024 @ 9:03pm 
Correction: range times attempt to estimate the radius of the target and account for that. Again, it is no where near as precise as camera based detonation. Are you using timers for detonation instead of the built in detonation range?
Redstar Aug 24, 2024 @ 2:17pm 
That is rather odd. Because, for example, when I set the range of a timer at 5 meters, if the structure (either ship or station) is large enough, there is a high chance it will explode extremely prematurely. Like, even 100 meters before reaching the target. Whereas against a fighter it will explode at the assigned distance without issue. Any idea what might be causing this and how to fix it? Perhaps some weird center of mass glitch with specific ship shapes?
Whiplash141  [author] Aug 24, 2024 @ 1:00pm 
"Is the distance for the timer triggers calculated in the same way as the distance for the warheads?"

No, the distance for timers is a lot more simple than the distance for warheads. For timers, distance is simply the distance from the center of the target.

The distance for warheads is calculated in several different ways depending on what you have attached to your missile. If you have cameras on your missile, WHAM uses them to do close range proximity scans for very accurate detonations.
Redstar Aug 24, 2024 @ 8:03am 
Hello! A bit of a question! Is the distance for the timer triggers calculated in the same way as the distance for the warheads? Because I've noticed that depending on the target size, I get lots of premature timer activations.
Whiplash141  [author] Jul 15, 2024 @ 10:08am 
I'm certain, and it sounds like you are running out of power or fuel.

Too down height is configurable in custom data. Please see the full guide for descriptions of all the custom data settings.
ZeroOnii-Chan Jul 15, 2024 @ 7:40am 
i did the thing and you sure its 18km ? it gets to 250m/s but after like 5km or so its just poof gone
crashed into the gound even with the top down mode does it have ground avoidance ?
or is there wway to increase the altitude it goes to when launched ?
ZeroOnii-Chan Jul 15, 2024 @ 12:32am 
oki thanky you will try that the speed limit is taht the setting in the fuel conservation section ?
does taht mean i need to turn that on ? or if i leave that off will that impact accuratie ?
Whiplash141  [author] Jul 14, 2024 @ 2:46pm 
There is a kill switch built in after around 3 minutes of continuous flight with no intercept. That translates to roughly 18000 meters of flight at max vanilla speeds.

Speed limiting is disable by default, but you can enable it in custom data.

I'd recommend running the stealth_off argument in LAMP so that you can visually track the missiles through the antenna signal.
ZeroOnii-Chan Jul 14, 2024 @ 1:08pm 
so i setup a silo that fires simple atmo missile but it only seem to hit tarrgets close to silo not the designator ship when i target a structure 7km of the silo in my small ship thats 4km off target it fires and goes towards it but somehow it never gets to it
now i am no genie with this toke me 7h to figure out how it works XD any guidance on it ? is there range killswitch ? does it manage its own speed ? i use mod that allows relative speeds based on mass/thrust ratio is there a way yo limit its speed ?
Whiplash141  [author] Jun 16, 2024 @ 10:12am 
Reduce the detonation range?
Enderman22224 Jun 16, 2024 @ 6:24am 
hey,
I have problems with the missile fusing to early to do damage to a fighter( the fighter is positioned in an 90° up position)
HARM Jun 9, 2024 @ 3:12am 
Hello again Whiplash.

Just got a question for you in regards to missiles successfully intercepting targets, My world sim max speed is 350ms, and the missiles I use are 2600 kgs. I only have forward thrust (4x small hydro thrusters, they fly at about 120ms).


When I'm fighting an enemy ship and I fire my missiles, they tend to either undershoot and have to double back. Or they do a huge, wide loop and try to intercept using the chase approach (I think its called chase).

Now I aint no rocket scientist, but If I change the navigational constant to a higher number (lets say from 3 to 20). Would that improve the chances of my missiles hitting the target dead on instead of having to double back?
Whiplash141  [author] May 14, 2024 @ 9:03pm 
Planet to planet? Not currently because there is a timed kill in the missiles for server performance after 3 minutes of flight. I have plans to make remote-fired missiles increase their kill time, I just haven't gotten around to it because its a relatively niche use case.
ghost-gas May 14, 2024 @ 8:31pm 
is it possible to remote fire a missile from one planet to another with laser antenna relays in-between?
Whiplash141  [author] May 14, 2024 @ 11:37am 
Just checked and all my scripts still work as of game version 1.204.015. Check block ownership.
Enigma_bg May 14, 2024 @ 9:39am 
hi whiplash141 can you cheek lamp and whan scripts after signal update wham look like broken when group is made and run argment setup script say is failed and cant find any of components in missile --- before signal update wham was working but now is broken
commie._.tears May 11, 2024 @ 9:11am 
Hey, I don't know if there's a way to fix this, but I was testing some really long-range missiles that were fired via targeting satellite in orbit. Target was about 40km out. After about 15-20km, the missiles just killed themselves. The programmable block was still working, and still in guidance mode, but everything had just been switched off. I think its intentional, and I was wondering if there was a way to shut it off.
Whiplash141  [author] Apr 26, 2024 @ 9:40am 
Yeah, though you can try using the "Randomized raycast scan spread (m)" parameter in custom data to make the raycasts randomize into a cone and maybe improve hit probability? Chances are still pretty low though.
A_Superior_DuDe Apr 26, 2024 @ 8:45am 
Ah okay, so even if the seeker head with the cameras are pointing directly (though kinda unstable) at the target, there is very little chance of lock?

Guess i will have to shelf the idea for now..

Thank you for the super quick replies though, and for the game-changing and awesome script!
Whiplash141  [author] Apr 25, 2024 @ 5:22pm 
if you are blind scanning, you are more likely to win the lottery than manage to hit something with camera raycast. That is the primary reason these scripts require lock before firing. I will eventually expose the max raycast range for advanced users.
A_Superior_DuDe Apr 25, 2024 @ 2:26pm 
Hey, i have been looking at ways to bypass the 5km range barrier. Hoping to be able to engage targets at 10km+.

How i want it to work is that i start by guiding the missile using BeamRide, then when within 5km, the missile will lock on and guide itself using cameras.

The missile is actually two missiles baked into one, where missile 1 has a LAMP script on it aswell. Upon launch the LAMP script is activated and starts searching for a target. (using a moving targeting head on the front of the missile using a custom turret). Once lock is achieved, Missile 1 and 2 will separate + the homing head (since it creates instability) then auxiliary cameras maintain lock for missile 2.

I cannot for the life of me get the missiles to lock on when the missile is far away from me for some reason... Its like the script or camera mechanic in space engineers stops working.

Do you know of any successful ways of guiding a missile beyond the 5km limit?
Whiplash141  [author] Apr 21, 2024 @ 6:46pm 
GetRotationAnglesSimultaneous/GetRotationVector gets the rotation vector between your current reference block orientation and your desired orientation.

ApplyGyroOverride applies the rotation command in your reference block frame and applies it into the gyro frame. This makes it so that the gyros can be in any orientation relative to your reference block without any control issues.
Whiplash141  [author] Apr 21, 2024 @ 6:43pm 
In terms of how to do it in your own script?

To get rotation angles:
https://github.com/Whiplash141/SpaceEngineersScripts/blob/master/Unpolished/GetRotationAnglesSimultaneous.cs

To apply rotation commands:
https://github.com/Whiplash141/SpaceEngineersScripts/blob/master/Unpolished/ApplyGyroOverride.cs

You can see how these are used in WHAM:
https://github.com/Whiplash141/SpaceEngineersScripts/blob/master/Released/WHAM.cs#L1997-L2025

GetRotationVector and ApplyGyroOverride in WHAM are newer versions of the two above methods.
Da_MLG_man Apr 21, 2024 @ 2:38pm 
Sooooo I'm currently working on a missile of my own and can not for the life of me figure out how to get block orientations and then translate pitch/yaw/roll motion according to that. If you could offer any help, that would be amazing.
Whiplash141  [author] Apr 4, 2024 @ 5:13pm 
They should not be able to even fire missiles without a target lock using my scripts. What is the issue, that your friend can't establish a target lock?
Celestial_Luna Apr 4, 2024 @ 3:46pm 
Hey Whip!
Quick question.
I spawn a ship using your script, shoot the rockets, they lock and everything works.
but when I spawn it again and my friend enters it, shoots the rockets, they don't lock a target.
any Idea why that happens?
thanks in regard
Whiplash141  [author] Mar 2, 2024 @ 11:55am 
Check ownership of all blocks, that is the most likely culprit
Miracler Mar 2, 2024 @ 9:09am 
So I have a missile that already works just fine, tough now I want to add a connector to it (small grid small connector), its in the group and the script should rename it by itself, tough it wont, I updated the script to the newest version still wont rename/accept the connector, did I miss smth?