Space Engineers

Space Engineers

29 ratings
Advanced Combat Drone Script (800m target acquisition range)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
2.429 KB
18 Oct, 2017 @ 5:59pm
1 Change Note ( view )

Subscribe to download
Advanced Combat Drone Script (800m target acquisition range)

Description
Introduction

This script allows you to create drones which will travel until coming unto 800 meters from an enemy grid, at which time the drone will engage and pursue the enemy. This drone system uses turret targeting in order to lock onto enemies. In other words, the drone will know where the enemy is by looking at the angling of the turret. Additionally, this script also comes with a few other extra features.

For an example build, check here: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1173590242

Instructions

NOTE: Do not attempt to use this script in small ships, the variables needed to make this work are only available in large ship turrets.

1. Firstly, add a remote control to your craft. Simply name this, "Remote Control". Make sure it's facing forward correctly.
2. Now, add a merge block. Name this, "DroneMerge 1".
3. Add all the forward thrusters you wish to have. Make sure that each one of these contains in their name "ForwardThruster"
4. Add 3 gyroscopes. Make sure they are facing forward in accordance to your remote control. Name one of these, "GyroAzimuth", another one "GyroElevation", and finally the last one's name does not matter.
5. Add a turret, making sure that when you place it, it is facing in the forward direction. Name it "GuideGun". The range of this gun determines the range of your drone, so it is good idea to set it to 800m.
6. Now, add a programming block, and import this script. In the Programming's block terminal, there is a space labelled Argument. You may add the arguments denoted below here.
7. Add a timer block. Now, click "Setup actions" in it. Add to the toolbar below, firstly the programming block, with the "Run with Default Parameters" command. Secondly, to the toolbar you must add the timer itself, with the "Trigger Now" command.
8. (OPTIONAL) Add a sensor block, named "Sensor". Whenever this activates, the drone will stop itself, in order to avoid collisions.
9. (OPTIONAL) Add one or more fixed weapons, for example a fixed rocket launcher. Name them "AssaultGun". Whenever the drone has the enemy in it's sights, it will unleash the fury of these weapons. Make sure they are facing forward, in accordance to the GuideGun turret.
10. Now your drone is complete! To deploy it, you can either do it from the drone itself or from another ship. If you wish to launch it from another ship, simply attach it via the merge block. However, beware, if you wish to launch multiple drones from a single ship, check the FAQ below. To launch the drone, simply go to the Timer, and hit "Trigger Now". The drone will travel forwards, and when in range of an enemy, it will pursue and attack.

Components of the Drone

Component
Naming
Notes
Gyroscope (1)
GyroAzimuth
This gyroscope will be overriden and used for yaw. Make sure it is facing in the same direction as the remote control.
Gyroscope (2)
GyroElevation
This gyroscope will be overriden and used for pitch. Make sure it is facing in the same direction as the remote control.
Gyroscope (3)
This gyroscope will be used for correctional purposes. The name can be whatever you want.
Thruster(s)
ForwardThrust
All forward thrusters must contain this in their name.
(OPTIONAL)FixedWeapon(Ex. Rocket Launcher)
AssaultGun
If set, all of the fixed weapons with this name will fire whenever the vehicle is locked on a target.
Turret
GuideGun
This will be the turret used for target acquisition. Make sure it is facing forward when you place it.
Remote Control
Remote Control
Make sure it is facing forward
(OPTIONAL)Sensor
Sensor
If included, the drone will stop whenever this sensoris activated, as to avoid collisions.
Merge Block
DroneMerge 1
This merge block will detach upon activation of the drone. The number depends on the dronenumber argument.

Arguments

To input arguments, you must separate each argument with a semicolon(;). You must refrain from adding additional spaces, as if you do, the program will fail while attempting to read your argument.

Argument
Definition
Explanation
gyrospeed [number]
The speed at which the drone will turn at.
Default is 5
maxspeed [number]
The maximum speed the drone will travel at.
Useful to avoid collisions. -1 disables. Default is -1
dronenumber [number]
Identifier for the drone's merge block.
If you wish to deploy multiple drones from a single ship, you must change this as well as the number after the merge block name to a unique number. Default is 1
maxdist [number]
Maximum distance a drone will travel before returning to deployment location.
If a drone travels this distance away from their location of deployment, they will travel back to their original location. -1 disables. Default is -1.

Examples of Correct Arguments

Arguments
Explanation
maxspeed 10;dronenumber 2
This drone will travel at a maximum speed of 10m/s, as well as have the unique identifier of 2.
maxdist 10000
When this drone moves ten thousand meters away from its deployment location, it will go back to its deployment location.
gyrospeed 2;maxspeed 50.1;dronenumber 13;maxdist 5000
This drone will turn at a speed of 2, will not travel at more than 50.1m/s, will be identified by the number 13, and upon reaching 5000 meters from its initial location, will turn back.

FAQ

Q: How do I launch launch multiple drones from a single ship?
A: Every drone connected to the ship must have a unique identifier. To set this identifier run the argument "dronenumber" with the desired identifier. As well, you must change the merge block name of this drone to match up with this identifier. For example, if I wanted to add a second drone, I would run the argument "dronenumber 2" and rename my merge block to "DroneMerge 2". For a third drone, I would do the same but with a 3 instead of a 2, etc.

Feedback

If you have any suggestions, ideas, or questions, don't hesitate to contact me.
12 Comments
Ace 27 Jan, 2020 @ 3:58pm 
So this no longer works? Because that kind of blows if so. I was about to try slapping a 5000m range turret on one of these to see what happens.
Witch ~ 22 May, 2019 @ 4:05am 
I tested it with your example drone. Does it work on planets? Because the drone isnt really flying around and doesnt target
jackleyakul 6 Apr, 2019 @ 9:29am 
hello! i have built a small large ship drone to test this script out on. and it my be my very little experience(basically none) with drones in SE. but i cannot get it to aquire a target or even move.. it basically is unresponsive to any threat
Aggelus 19 Dec, 2018 @ 5:18am 
Thanks I'll take a look at this script, I was looking for one for missiles.
:)
NoQuiche  [author] 18 Dec, 2018 @ 6:52pm 
Hello, I wrote this scripts a long time ago. Something must have changed in the scripting language that broke it. Nonetheless, there are better alternatives nowadays.

For example, this is the script I have used in the past, which I believe can be configured to behave just like mine:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1464234667
Aggelus 12 Dec, 2018 @ 12:37pm 
Does this script still work?
The drone does not travel at high speeds and does not even target the target.
I tried to use it in a ship, but I only received error messages, even after the instructions.
SuspiciousCheese 1 Oct, 2018 @ 7:34pm 
Would it be possible to configure this to use a connector instead of a merge block?
TheDrunkenGod 11 Mar, 2018 @ 11:23am 
Why does it need a merge block?
Th98ioozuopos 26 Feb, 2018 @ 3:48pm 
Plz get back to me when u get this

Th98ioozuopos 26 Feb, 2018 @ 3:48pm 
And the drones can hunt for u across the universe
And they get updates or commands from a bigger ship or something so when the bigger ship controlling the drones gets destroyed the drones deactivate and the “Command Ship”for the drones has to be in a 15km radius from other drones to work and other drones that had a command ship that got destroyed and a new one comes in the drones will take orders from the new command ship
The drones have one direct command/ goal to destroy other ships and technology that’s not there own