Space Engineers

Space Engineers

574 ratings
[RETIRED] Whip's Optical Missile Guidance Script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
43.447 KB
Nov 1, 2015 @ 5:26pm
May 18, 2020 @ 8:47am
35 Change Notes ( view )

Subscribe to download
[RETIRED] Whip's Optical Missile Guidance Script

In 1 collection by Whiplash141
Whip's Script Archive
5 items
Description
This code is no-longer supported! New version can be found here:
https://steamcommunity.com/sharedfiles/filedetails/?id=2108743626


REMINDER: Do not edit the code to change variables, you need to use the custom data field. Ignore that part of the video.

PSA: My Block Renamer Code may help you out a TON with naming and prefixing blocks with the missile tag!


Version 62-13
You can now set variables by using the program block's Custom Data!



Howdy!

This script allows you to make optically guided missiles much like those used on my Komodo Guided Missile Destroyer! Missiles (or torpedoes) using this script will follow wherever the firing vessel aims, much like a TOW missile. All block name tags are customizable inside the code; I have added plenty of comments to aid anyone who wishes to tinker with it :)

Features
  • Configurable spiral trajectory to avoid turrets! (can be turned off)
  • Configurable detach sequence parameters!
  • Automatic thruster orientation detection! No more pesky directional naming needed :D
  • Works in atmosphere!
  • Runs at 20 Hz (old was 60 Hz) so it is much less laggy! Three new missiles lag less than one of my old ones!
  • Compensates for unwanted drift!
  • Automatically shuts off and goes ballistic if vital components are damaged
  • Safety mechanisms to stop the missile from flying up your tailpipe!
  • Built in support for using AI Turrets as a Shooter Reference
  • Impact point can be offset vertically and horizontally!


The missile must be attached to the same grid as your firing platform via merge block and the reference remote can be attached statically or through rotors (yes rotor-based turrets work).

Missile Setup
    ALL BLOCKS on the missile should have the name tag "Missile 1" added in their names.
    REQUIRED BLOCKS
    • A Remote Control pointing FORWARD
    • A program block with this code
    • A battery or reactor (for power)
    • A merge, connector, or rotor (for attachment points)
    • A gyroscope
    • Some forward thrusters
    OPTIONAL BLOCKS
    • Artificial mass block(s)
    • A beacon (Highly recommended)
    • Antenna(s)
    • Timer(s)
    • Sensors
    • Warheads
    • Side thrusters
    You can now turn off anything but the timer and program if you so desire.

Shooter Ship Setup
    Make a remote or a turret with name "Shooter Reference" facing forward. (Remotes will be prioritized before turrets!)

Firing Instructions
    Attach the missile to your shooter ship and use my Missile Fire Script to fire them :)You can also manually fire by running the argument fire

Error Checking
    As seen in the video, you can use the code to error check your missile setup.
    1. Open up the ship terminal and find the programmable block
    2. In the argument field type "setup"
    3. Run the program once
    The code will then display any critical errors that it detects and will automatically prevent you from firing a missile off without the correct components.

Setting Up Multiple Missiles
    To make additional missiles change the missileTag in the CUSTOM DATA of the missile's programmable block. Now repeat the missile setup, replacing the number 1 with the new number. Names for missiles must be unique to avoid issues. Example: If you have 10 or more missiles, your tags will have to be like "Missile 01" for single digit numbers

Using Missiles on Planets
    To use missiles on planets there is no additional setup required. Make sure that the down direction of the missile's remote control is pointed downwards as well. The code will attempt to orient the down direction to the ground allowing you to use nothing but upwards thrust and forward thrust :)


I hope y'all enjoy using this script! If you have any questions feel free to leave a comment here :)

- Whiplash141
1,046 Comments
Whiplash141  [author] Nov 18, 2021 @ 1:00pm 
See the comment below yours
Ted Nov 18, 2021 @ 9:48am 
No main thruster found. It works randomly
Whiplash141  [author] May 25, 2020 @ 11:27am 
This code has officially been retired and replaced by WHAM: https://steamcommunity.com/sharedfiles/filedetails/?id=2108743626
Readtext May 20, 2020 @ 7:21pm 
Oh) Everything works) Why it didn’t work before) Magic)
Whiplash141  [author] May 20, 2020 @ 7:42am 
missileSpinRPM or something similar in the custom data
Readtext May 20, 2020 @ 7:18am 
I checked this and everything works)) We need rotation along the axis, without displacement of the rocket. It is necessary for super heavy missiles with baits removed on 5-6 blocks
https://wiki.freecadweb.org/File:Tache_Placement_Roulis_fr_Mini.gif
Whiplash141  [author] May 19, 2020 @ 9:50pm 
"How to add torpedo rotation?"

enableSpiralTrajectory
spiralDegrees
timeMaxSpiral

in the custom data
Readtext May 19, 2020 @ 6:15pm 
How to add torpedo rotation? Lures on long beams die from turrets in direct flight. Rotors are not built by projection ((
Jaeger May 1, 2020 @ 8:10pm 
might just be the script is disabled or something on the server. tho it loads fine
Jaeger Apr 29, 2020 @ 7:40pm 
the same blueprint works fine in singleplayer. https://youtu.be/mUaYfFdyJQQ but in multiplayer they just twist around in the same spot in space kind of erratic jerking aruond