Space Engineers

Space Engineers

295 ratings
[Archive] Rdav's Turret-Tracking-Script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
3.969 KB
4 Mar, 2016 @ 3:10pm
22 Sep, 2016 @ 10:55am
9 Change Notes ( view )

Subscribe to download
[Archive] Rdav's Turret-Tracking-Script

Description
Hi There!

NOTE: this version has been superseded by my EZ turret AI, and is held for archive purposes only, please see my workshop for the latest version!

The arms race continues! This time with a new script that will give AI to any player made turrets on your ship. 100% Vanilla, no mods required!
The script will both automatically track, and shoot, any targets that are within range of a single Director turret located somewhere on your ship, coordinating every turret to fire at the same location, all this will be done completely autonomously; you don’t even need to pull the trigger manually.
Like my previous scripts I have once again maintained my 'AK47' principals and tried to make a script that is: easy to use, cheap to build, and quick to set up even for people with no programming experience, (less than 2 minutes setup time), but that that is also both fun and effective to use in both Single player and DS (yes I’ve tested it! provided sim speed is above 0.2 It works fine in DS!).


*****Example Blueprint For the Tutorial*****

**Remember to check out the bottom of the post for an advanced section with some useful diagrams and a troubleshooting guide**


Again big thanks to whiplash, xmuni, and some other scripters out there of whom without their work this would never have been accomplished.
As always, any questions, potential improvements, bug reports or general questions I’ll be happy to answer in the comments below.

Latest News:
26/03/2016 [UPDATE RELEASED]

-Fixed issue where idle rotation would be out-of-sync in multiplayer causing the turret to shoot in random places.

As above, this was very annoyying in multiplayer battles,

========================================================================

Setting up the script takes about 1-2 minutes, here is a short guide on the basics, if anything is unclear let me know and I'll fix it!
------------------------------------------------------------

Step 1: Shipside Components
Firstly place down a programmable block, a timer, and an interior turret (although any turret will work), rename the turret 'DIRECTOR'.
Insert the script into the programmable block, and press, "remember and exit".

-------------------------------------------------------------

Step 2: Setting Up The Timer Loop
To set up a timer loop that will trigger the script, get the timer block to:
"run with default argument" the script,
and then "trigger now" itself, (it's important to use 'trigger now' here!)
Then start the timer.
*(optional) after 'trigger now' add 'start timer' this will automatically restart the timer loop when you reload a world*



---------------------------------------------------------------

Step 3: Creating The Turrets
Next thing is to create your turrets.
Place down two rotors, (can use advanced-rotors too) to control azimuth and elevation of the turret. Then place a sensor block connected to the elevation rotor, pointing the way in which you want your turret to fire, check the video for the correct orientation.
**both rotors should be of the same type!**




Rename the azimuth rotor; "AZ", and the elevation rotor; "EL", Then put all three components into a group in the terminal.
(the sensor should be called 'Sensor' (only first letter caps))
The script will run through each group and find two rotors a sensor and any guns, and then coordinate them accordingly.
The turret should now spark into life, pointing in the direction of the 'Director' turret, once it has settled you can add weaponry.
I advise you get the turret running prior to adding weaponry and armor, although it’s not strictly necessary, this is because the script might decide a strange orientation is forward.


-------------------------------------------------------------

Step 4: Adding Weaponry
Add as many weapons blocks as you want, and add them to the turret group. They will now be active, when the turret is pointing any direction apart from the default, and if the turret is close to pointing to the target it will automatically fire all the weapons in the turret group.
Adding extra turrets is just as simple, just repeat the exact process you did to make the first turret, and create a new group. eg turret 1=*turret 1* and the second turret is: *turret 2*.

======================================================================


Setting Up Multiple Arms:
The script will treat a new arm like a new turret,
So simply create a new group, containing the new arms components. and the AZ rotor they both share.



-----------------------------------------------------------------

Setting Up Multiple Turrets:
The script will automatically detect a new turret if it's in a new group, one programmable block will manage all the turrets, so all you need to do is create a new group for each turret.



-----------------------------------------------------------------

Adjusting The Script:
Most useful changes in the script are simply changing names and changing numbers, both of which are done in this area of the script.
Convergence will change at what average distance gun fire will converge to, I recommend you leave this at 800m:
Rotational speed manages how slowly the guns will rotate, with 100 being AA gun fast, and 10 being Heavy turret speed.



-----------------------------------------------------------------

Using The Script To Direct Vanilla And Modded Turret Blocks
Directing any vanilla or modded turret blocks is easy, simply change the names of any turrets you want to direct 'DIRECTED_TURRETS' and the script will aim them and fire them automatically

========================================================================


If you are having issues there is a guide in the script itself with more information, but here is a quick flowchart to help you get to the root of your problem quickly:



If you are still having problems, download my tutorial platform in the link at the top of the page, and compare between to see where the differences are, If it's still playing up and you can't find the issue don't hesitate to contact me in the chat below, We've all been there at some-point, and I know how frustrating it can be.

=====================================================================
Summary

I’ve built in a troubleshooting guide into the script so most common issues are dealt with there. The
advanced section is still a WIP, I’m waiting for what people ask for/request before I finalize this part but the script itself is fairly intuitive, so a committed person will probably manage to find what they are looking for just by trial and error.
Any questions, potential improvements, ideas for new scripts, bug reports or general questions I’ll be more than happy to answer in the comments below, I have plenty more PMW sripts in the pipeline so don't to forget to like, subscribe and stay tuned for more!
Popular Discussions View All (1)
15
6 Nov, 2016 @ 7:54am
Update 1.02 Discussion [Post Suggestions/Requests Here]
Rdav
280 Comments
Darkness Overlord 28 Oct, 2018 @ 9:46am 
Why rotor with sensor, armor block and gun reverce on 360X[unlimited]? He crash weapon =/
Avelius 25 Apr, 2018 @ 7:50am 
The script doesn't seem to work on small grids.
Avelius 25 Apr, 2018 @ 7:17am 
Ok turret moves now (had called the gat turret "Designator" instead of "Director". But turret still spins wrong and seems reversed.
Avelius 25 Apr, 2018 @ 5:18am 
Script set-up was successful but the turret does not move at all, I've set everything up correctly, checked everything 3 times. Could you please help me?
Avelius 27 Dec, 2017 @ 1:45pm 
@Hellfire Yes I know ;) I was just looking for a script, which would make rotor based turrets completely to AI turrets without any director turret to rely on. But thanks for the help man ;D I appreciate it.
Saticron 27 Dec, 2017 @ 12:16pm 
@[A.G.I.] ◥ ARSTALUS ◤ there is also the MART script if you wont want the turret director

(it helps greatly with tanks)
Rdav  [author] 27 Dec, 2017 @ 9:36am 
yup
Avelius 27 Dec, 2017 @ 7:16am 
Do you need that Turret Director at ALL times?
Saticron 2 Dec, 2017 @ 1:41pm 
does it just fire when you aim at something or does it shoot when the turret shoots?
JudgeHenryAllenLaidermilk 16 Sep, 2017 @ 12:07pm 
Hey Rdav love all your stuff man, have a question about alternate usage for this. Instead of having this script fire a gun, is there a way to have it trigger another specific timer block instead? would love to use this for long range detection and triggering of other defences. thanks.