Space Engineers

Space Engineers

Not enough ratings
Scan and Fly To Target - Updated Nov 2019
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
16.151 KB
18 Dec, 2016 @ 9:01am
1 Nov, 2019 @ 4:45pm
3 Change Notes ( view )

Subscribe to download
Scan and Fly To Target - Updated Nov 2019

Description
Script has been updated Nov 2019 and is working again.

You're flying along and you see an asteroid off in the distance. Is it a tiny asteroid really close or a huge asteroid at the edge of viewing distance?

On a pvp server you spot a moving object. It has no antennas or beacons. Is it an enemy ship or is it your friend coming back from mining?

Wonder no more! With this script you can scan distant objects and get a readout of all available information on the target as well as being able to fly to it safely using the ship's autopilot. No more stopping too soon or too late!

Requirements:
- At least One Camera mounted on the front of the ship with (scanner) in the name.
- One Remote Control
- Programming Block loaded with this script.

Optional:
- LCD or Corner LCD with (scan) in the name to display scan readout
- LCD or Corner LCD with (target) in the name to display objects targetted with autopilot

Usage:
To scan an object, with the script running on loop, point your camera at the object and hold in position until the scan is completed. If you are using the (scan) tag on an LCD, Wide LCD, or Text Panel, it will display the time in milliseconds until the scan is complete next to the "Scanning: text". Scan time is determined by the scan distance with 32 meters taking 1 game tick or 16ms. You can adjust your scan range by changing the SCAN_DISTANCE variable below.

You can also setup multiple cameras with difference scanning ranges to optimize scanning speeds. To do this, add multiple cameras with (scanner) in the name and then put the range in meters that you would like it to scan in the Custom Data field. All cameras should be facing the same direction and located close to each other for the best results. All of the cameras will scan together and the first one to detect a valid target will report back. This allows short range cameras to report back multiple times in the time it takes for one long range scan.

To automatically fly to the scanned object, on your ship's toolbar add the programming block running this script and add "FlyTo" as the run argument. Then simply scan an object and when the scan is complete activate the programming block on your toolbar. A waypoint to the target will then be added into your Remote Control and autopilot will turn on. If you have an LCD with the (target) tag it will display information about your current target. You can adjust how close your ship gets to the target by adjusting the PARKING_DISTANCE variable below.

LCDs can also include color coded text based on your relationship to the target. By default it is enabled on Corner LCDs only, but you can enable it on both or neither by changing the COLOR_CORNER_LCDS and COLOR_BIG_LCDS settings below. You can adjust the color of enemy, friendly and neutral targets below.
16 Comments
. 27 Nov, 2019 @ 9:48am 
love the script sadly for me it crashes every time I run FlyTo
delizin  [author] 1 Nov, 2019 @ 4:50pm 
It has been a long time since I last played Space Engineers, but I hopped back on to check out some of the new features. I've gone ahead and updated this script so that it is working again and added support for multiple cameras and removed the requirement for a timer block.
Solo 13 Oct, 2019 @ 11:43am 
is it possible to get this script updated to work with the latest game changes?
remethep 4 Apr, 2018 @ 1:43am 
Thank you for a wonderful script! This is really awesome! I did a spotlight on this, since I felt it deserved it. :)
https://www.youtube.com/watch?v=YiYRm3CY740
kaylo7 15 Mar, 2017 @ 12:52am 
Wonderful, thanks! Could also see uses for this on detachable subgrids, adding the waypoint to a patrol and using it in combat for say, decoys or turret platforms. You could even throw in a gyro override set to a timer and the single waypoint with the decoy on an arm so it spins in place. A few of those set to timers in combat and you'd have a bunch of hard-to-hit decoys launched automatically without additional keypresses, as all you'd have to do is face your target for a second or so. mmmm, yes.
delizin  [author] 15 Mar, 2017 @ 12:40am 
I've been away from Space Engineers for a little bit and will probably won't be back for some time so I haven't had time to actively update all of my scripts. When I get back, I'll see about updating this script with some options to better handle this use case as well as adding in some new features I had been toying with earlier.
delizin  [author] 15 Mar, 2017 @ 12:40am 
It is specifically set to ignore to subgrids to avoid issues where you might have multiple ships running the script docked on the same ship all trying to execute commands. If this situation doesn't apply to you, you can manually remove this safety check by editting the code and removing "&& Me.CubeGrid == x.CubeGrid" from lines 103, 108, and 113.

Those lines numbers might not match up exactly in game, but it should be right after public void main in the script.

You may also want to adjust the name of the camera and lcds as well. This will allow the script to be displayed on subgrids while still being compatible with multiple docked ships running the script. To do that, on the same lines you editted above change:

.IndexOf("(scanner)") to .IndexOf("(scanner1)")

Then just be sure to rename your camera for the corresponding ship to scanner1, etc.

kaylo7 14 Mar, 2017 @ 10:08pm 
Does it not work with programmable blocks, timers or screens on subgrids? Tried a combination of all, and couldn't use programmable blocks, timers or screens on a small grid connected to a large grid ship, in any combination. Makes use of small block screen setups on bridges a little harder to squeeze in.
rottielover 14 Feb, 2017 @ 9:18pm 
Just wanted to say WELL DONE! Simple to use, works wonderfully, couldn't ask for anything more. I'm finally able to look at my phone while my ship takes me to the next mining target.
Enigmus 11 Jan, 2017 @ 10:38am 
I would like to use this for probe based asteroid ore hunting (Via Laser antenna). Could we get an arguement or variable inserted for having the remote block activate an item or timing block. That way once it arrives it can perform an operation?