Space Engineers

Space Engineers

Pirate Drone - Basic
51 Comments
Nitrogameace 5 May, 2023 @ 12:10pm 
is there any script that can?
Nitrogameace 5 May, 2023 @ 12:10pm 
Does this script not know how to use wheels?
Captain Durall 16 May, 2022 @ 10:24pm 
Did this stop working with thrusters? Ive tried modded unmodded thrust override everything
Daniel L Parry 9 Feb, 2022 @ 9:41am 
great to know, with the new guns I'm looking to make my own targets that shoot back
Meridius_IX / Lucas  [author] 8 Feb, 2022 @ 1:55pm 
Probably, it's super simple/basic. I cannot imagine that anything that changed in the recent update would have broken it
Daniel L Parry 8 Feb, 2022 @ 1:47pm 
Out of curiosity, does this still function in a post Warfare 2 update version of the game?
ARK7 26 Aug, 2020 @ 12:52pm 
Ok
Meridius_IX / Lucas  [author] 26 Aug, 2020 @ 11:36am 
no, this will only pursue player entities.
ARK7 26 Aug, 2020 @ 11:24am 
will this go after NPC ships that are at war with the drone's faction. (will a SPRT drone go after a Reaver)
jackleyakul 19 Apr, 2020 @ 1:00pm 
ok. I figured that is the case.. that is how most of the pirate scripts are.. i was just hoping you "maybe" had modified it... it such a sad thing that there isnt a decent drone script out here.. there is so much potential for it, but no one has tackled it. every script i have tried has not worked well.
I appreciate your quick response!!

there are some scripts with limited or situational function, but nothing with true utility unless you know C# and make it yourself... i started dabling in coding specifically for this lack in the mod community, but im extremely unlearned and it will be awhile before i can make a functioning script.
Meridius_IX / Lucas  [author] 19 Apr, 2020 @ 11:18am 
It will not function. The script only works if it is owned by an NPC identity, and it will then hunt the nearest player. Most of that target logic is hard-coded in the game
jackleyakul 19 Apr, 2020 @ 9:11am 
so question.. if i build the drone and get the code to work, and i own it and its a part of my faction will it hunt hostile npc's? or hostile players?
Niceguygamer 11 Oct, 2019 @ 9:54pm 
sorry it does work i just have to repeat it and it work

Niceguygamer 6 Oct, 2019 @ 3:24pm 
i think this script doesn't work anymore because i followed everything in the video and it's still doesn't work is it ok if you make a new or the script that your using for your npcs
Meridius_IX / Lucas  [author] 4 Sep, 2019 @ 7:32pm 
Ahh ok, well glad it works for ya then! I figured it would be about a 50/50 at this point considering how old it is :P
KnitePrince 4 Sep, 2019 @ 6:02pm 
I didn't pull the timer block down into its own slot, I didn't understand the "loop" Just needed someone to explain that to me in laymans (idiot) terminology.
Meridius_IX / Lucas  [author] 2 Sep, 2019 @ 9:12am 
If you follow the steps in the video on the mod page, it should work. Other steps to try could be ensuring the ship had thrust in all 6 directions and a gyro. Hydrogen only ships also play poorly with the RC for some reason.

Beyond that, if it still doesn't work, then the script could be toast. Check to see if it encounters an error after running (should show in terminal details)
KnitePrince 2 Sep, 2019 @ 8:26am 
Yeah.. tried it with a tiny ship, two guns, does the exact same thing. I hit start, all the engines fire momentarily.. then it just stops. Off to find another script.
KnitePrince 1 Sep, 2019 @ 9:04pm 
"Start" the same timer block (so it loops)

Is there something I am missing here? Timer set to 1 second, but I have no idea how to set it to "loop"
KnitePrince 1 Sep, 2019 @ 8:58pm 
Meridius... I am struggling to get this to work in a scenario I am setting up... I have no issue with the drone being hostile to me, but I cant seem to get it to do anything once I hit the "start" button... I am attempting to create a hostile faction to the players on my server, a base, a few ships.. mission to destroy the base, the ships and the stations AI... it should be HARD to accomplish.. but I need ships that will go after the players..... Tips? Advice? Instructions for an idiot? I hit start, and the ship "moves" stops and then does nothing, even when I pop out of GM mode..
Hage Maoh 27 Mar, 2019 @ 9:50am 
What changes would I have to make in order to trigger a timer block when a player is detected?
DogwaterGaming69 25 Jan, 2019 @ 2:24pm 
theres a way to make it work without it being to be an hostile?
Blue 16 Sep, 2018 @ 12:41am 
Lunacity use turrets not normal weapons
Anubis 30 Jul, 2018 @ 8:37am 
any way you could make this spawn allies to protect from incessant pirate raids?
Lunacity 20 May, 2018 @ 12:35pm 
I tried to use this script but the drones wont shoot they do follow after the target tough
Meridius_IX / Lucas  [author] 1 Jan, 2018 @ 6:38am 
They only work when owned by a hostile NPC, the player tracking function doesn't work if owned by players.
gatecrasher 31 Dec, 2017 @ 6:58am 
do these types of drone scripts work in multiplayer if owned by a player faction? will they only follow hostile players or?
Skallabjorn 6 Jul, 2017 @ 11:31am 
@Meridius_IX Sweet, thanks
Meridius_IX / Lucas  [author] 6 Jul, 2017 @ 10:17am 
@Skallabjorn - Yep. Look for the following:

player_distance_origin < 10000

...and change 10000 to whatever value you want.

If you decide to push the distance to further than 15000, you'll also need to change:

ship_distance_origin > 15000

...to a higher value as well.
Skallabjorn 6 Jul, 2017 @ 9:06am 
can the detection distance be changed from 10 km to a different distance?
[ASTT] Sean 19 Apr, 2017 @ 3:28pm 
@Meridius_IX Not at all, thanks for the modified script and your help
Meridius_IX / Lucas  [author] 19 Apr, 2017 @ 3:07pm 
@[ASTT] Sean - I see what you're saying now. I've seen behavior like that a little in some other drones I've been working on recently, but not quite as severe as that. I'm thinking it might be something wrong with the Remote Control block itself, since I don't recall that behavior being very normal a while back. If I submit a bug report to the devs, do you mind if I use that footage you captured?

In the meantime, until we know the exact cause, I created a modified version of the script you can use. It will use collision avoidance until it hits 5m/s (or any value you'd like, can be set in the scripts header), then it'll switch off after the drone has some momentum - hopefully it'll work as a temp fix for ya.

https://pastebin.com/MHKPabn9
[ASTT] Sean 19 Apr, 2017 @ 2:41pm 
@Meridius_IX Thanks for taking the time to help me. With respect to the player tracking I apologize for not being clear, while the drone is capable of tracking without collision avoidance, it does not track with the same responsiveness as a drone with collision avoidance. I was wondering if there was a way to improve it.

A video that hopefully shows what I mean:
https://youtu.be/sN9K6JBgZXw
Meridius_IX / Lucas  [author] 19 Apr, 2017 @ 12:32pm 
@[ASTT] Sean - Sorry for the slow reply, last couple days have been busy...

It should track the player regardless of whether or not collision avoidance is activated. I recorded this footage of setting it up without it turned on and it seems to work fine.

https://youtu.be/4KszcYEVFXg
[ASTT] Sean 17 Apr, 2017 @ 8:02am 
@Meridius_IX After playing around a bit more, the drone does work without collision avoidance enabled, I just needed to be a bit more patient with it. In addition the speed limit was also magically lifted. Now my only remaining request is that the drone be capable of tracking moving targets without collision avoidance on, it is capable of tracking with avoidance on though.
Meridius_IX / Lucas  [author] 17 Apr, 2017 @ 7:46am 
@[ASTT] Sean - Activating collision avoidance is more of a recommendation, so the drone doesn't actively try to bash into the player, I don't believe I put a requirement in the script that it needs to be on.

Coming back to speed, do you have precision mode enabled on the remote control block? That could possibly limit the speed.

I haven't been at my computer for a couple days, but I should be able to review the script later today for any issues.
[ASTT] Sean 16 Apr, 2017 @ 2:50pm 
@Meridius_IX Unfortunately the drone doesn't move if collision avoidance is turned off (as the video made it very clear that it must be turned on for the drone to function), and the slider built into the remote control has no bearing on the drone's speed limit; I can have it set to 100m/s yet the drone never goes past 10m/s for me.
Meridius_IX / Lucas  [author] 16 Apr, 2017 @ 10:13am 
@[ASTT] Sean - You should be able to turn off collision avoidance from the drone remote control options before setting it as a pirate.

In regards to speed limits, the remote control block has a slider that lets you set the speed limit. The only thing I'm not sure of is if the slider dynamically changes if you're using a speed mod - I've never tested this myself.
[ASTT] Sean 16 Apr, 2017 @ 4:04am 
Is there a way/line of code that disables the collision avoidance and speed limit of the drones?
Joaco545 11 Jan, 2017 @ 3:24pm 
Ok, thx
Meridius_IX / Lucas  [author] 9 Jan, 2017 @ 5:02pm 
@joacoplac - Unfortunately not. The part of the script that tracks the player will only work if the drone is a hostile NPC.
Joaco545 9 Jan, 2017 @ 3:17pm 
It is posible to use it like a patrol drone for your own fac to defend yourself from other enemies (other enemy fac players)?
Meridius_IX / Lucas  [author] 4 Jan, 2017 @ 6:16am 
@E-Man720 - You can load it into any ship of any size. Here's a vid of when I loaded it into one of my large atmo ships:

https://www.youtube.com/watch?v=t_AnGh5w07E
E-Man720 4 Jan, 2017 @ 5:05am 
So theoretically there's nothing stopping me from loading this into a cruiser right?
Meridius_IX / Lucas  [author] 31 Dec, 2016 @ 4:49pm 
@Thanatoast - I attached a short video to this workshop page showing the steps to setup the script / blocks. Hopefully that'll help you isolate any issues you're having. Let me know if you have any other issues!
Thanatoast 31 Dec, 2016 @ 9:11am 
Checked both. There are two things i found out. for one, it seems like you cannot claim a thruster for a faction. Apart from that the script i copied ot of a vanilla drone doesn't work either.
Meridius_IX / Lucas  [author] 31 Dec, 2016 @ 8:46am 
@Thanatoast - Is the remote control flight mode set to One Way? That's the one that usually catches me off guard. Also, check to see if ownership is set to SPRT for all blocks on the drone. I'll hop on this evening after work to make sure nothing broke on the script end of things
Thanatoast 31 Dec, 2016 @ 12:47am 
After some experimentation it seems like this doesn't work for me. Mostly the drones equipped with the script are just floating idle and in some cases they turn their behinds towards me, seemingly tracking. Any ideas what's causing this?
Ninth Prophet 18 Dec, 2016 @ 6:02pm 
Aaaaah, gotcha, wasn't aware there were methods with restrictions quite like that.
Meridius_IX / Lucas  [author] 18 Dec, 2016 @ 5:00pm 
@Ninth Prophet - The reason this only works with hostiles is because it uses a method called GetNearestPlayer(). This method will magically get the coords of the closest player near that ship - with no other input required. Since that method could be heavily abused in the PVP world, the devs made it only accessible to hostile NPCs.

This particular script wouldn't be of too much value in a PVP environment in it's current state. Maybe if it used the new raycasting feature of the camera it could be adapted, but I haven't learned how to use that yet.