Space Engineers

Space Engineers

Whip's Turret AI Slaving Script
2,481 Comments
Whiplash141  [author] 12 hours ago 
Without any details I cant help you.
Cmdr. Chicken 15 hours ago 
on this since literally 5h now its 4am i cant get a single turret to work...
Whiplash141  [author] 18 May @ 5:57am 
no it will not
KAD65 7 May @ 11:19pm 
will this help ai turrets aiming leading and tracking without setting up a designator ?
LeoBlackburne 29 Jan @ 12:22pm 
Gotcha, thank you!
Whiplash141  [author] 29 Jan @ 12:04pm 
it needs to be in the group.
LeoBlackburne 29 Jan @ 11:02am 
It isn't in the group and I am using the Assault Weapons Pack without Weaponcore
Whiplash141  [author] 27 Jan @ 3:07pm 
(1) Is it in the turret group and (2) are you using weapon core?
LeoBlackburne 27 Jan @ 1:36pm 
I'm having issues with the script acknowledging a designator turret. I've added Designator to the name of one, but it continues to not see it
Whiplash141  [author] 13 Jan @ 12:23pm 
Yes it still works.
Jon Kirk 12 Jan @ 8:43pm 
Does this scrip still work?
I've never been able to get it to work, it sees custom turrets fine but it never finds the Designators.
Lathy...or is it 17 Nov, 2024 @ 2:34am 
Is there a guide that explains the settings in Custom Data? I don't understand what they do ^^;
~Ari~ 12 Nov, 2024 @ 9:11pm 
I don't know if it would be ideal to add as a feature for this script or to make it its own independent script but I currently have a ship that doesn't have a need for turret slaving but I would like this script simply for the purpose of making turrets avoid shooting through the ship and its subgrids. Is there a way to make this work without needing a slaved vanilla turret?
bucket 7 Nov, 2024 @ 10:07pm 
The programmable block is spitting out an error for both turret groups where it isn't recognizing the traverse or elevator and saying,
"Unsorted rotor(s) found:
"2 traverse"
"2 elevator"
Checked ownership as per brought up by the other comment on this issue, it's all mine. How do i fix this?
Whiplash141  [author] 17 Oct, 2024 @ 9:28am 
if said camera is controlled by a CTC that is marked as a designator, yes
e_sd 17 Oct, 2024 @ 9:24am 
Does this script work with a camera designator instead of a turret designator?
HS_DRAGON ✞ 30 Sep, 2024 @ 10:29am 
Hello. I didn't quite understand how this Script works; For this script to work, do you need to put guns on rotors/hinges?
I just want my guns to stop shooting at my own buildings, what do I need to do?
jperk354 12 Sep, 2024 @ 7:10pm 
OK, testing on both ship and static grid, when controlling the designator, it seems to lose gravity calculations. When the designator is using its AI, it seems to have gravity calculations
Whiplash141  [author] 12 Sep, 2024 @ 2:18am 
It is a multiplier of whatever the current gravity value is. The script attempts to find a ship controller somewhere on your ship to use to read the gravity value.
jperk354 11 Sep, 2024 @ 7:54pm 
Yep, standard earthlike. Is the gravity mod function a multiplier of "1" gravity, m/s, or something else
Whiplash141  [author] 10 Sep, 2024 @ 10:46pm 
Dumb question: are you in natural gravity?
jperk354 10 Sep, 2024 @ 9:35pm 
Edit: when manually controlling the director
jperk354 10 Sep, 2024 @ 9:25pm 
Hey Whip, it's looking like the gravity mod option in the custom data isn't doing anything right now. I've set it from -10 to 5000, and all the shots are dropping the same
phoenix 4 Sep, 2024 @ 1:18pm 
@Whiplash141 I've tried several different setups but yet whenever I see if the friendly fire is working it always shoots through my ships and never registers any friendly at all maybe one tower of six will recognize a friendly but they're all set up the same way
Whiplash141  [author] 27 Aug, 2024 @ 6:05pm 
You are adding the weapon to the toolbar right? If so, the only workaround is to hold the crouch key (C by default) to fire, or have a manual toggle on the toolbar for a group of guns that only includes what you want.

Alternatively, you can use TCES in conjunction with custom turret controllers to control your turrets. That way you get the turret stabilization and rest angle behavior of MART with the AI targeting potential provided by the turret controller itself. Also turret controllers have special code to only fire the turret you are actively controlling that MART simply doesn't have access to.
MARHWIN 27 Aug, 2024 @ 11:01am 
@Whiplash141 Okay, I've changed it to "false". Thanks
And about the second thing. When I fire MART (rear) turret, the other (underbelly) fires aswell. Could this be helped?
Whiplash141  [author] 24 Aug, 2024 @ 1:12pm 
It does shoot, it is just the friendly fire avoidance is stopping it from firing in many instances because of the turret being recessed into the surrounding blocks. You can disable friendly fire avoidance in the custom data of the turret slaving programmable block:

Change "- Avoid friendly fire (own ship)" to false.

Also I noticed that you changed the nametags for both MART and the turret slaving script to be the exact names of their respective turrets. Just be aware that if you want to have more turrets controlled by MART or the turret slaving script, all additional turrets will require that full name tag in their names to be registered by either script (which could end up clunky)
MARHWIN 24 Aug, 2024 @ 3:28am 
@Whiplash141 No, they're grouped separately.
I've post the skeletized debug version of the problematic build:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3315988361
Whiplash141  [author] 23 Aug, 2024 @ 1:02pm 
Did you group a MART turret with a rotor turret controlled via this script?
MARHWIN 22 Aug, 2024 @ 7:51am 
Must have messed something, I have two gatling turrets but they behave oddly:

1st is on this script [Gun, 2 Rotors, Designator];
When I'm in direct control it fires only rounds for the designator.
Designator mod: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2325483917

2nd is on MART [Gun, 2 Rotors, Camera, Seat];
For it to fire i need to drag gatling gun to shortcut bar, when I fire, both turrets fire.
Acherion 17 Aug, 2024 @ 6:33am 
Thank you so much, now I can pretend I am in outlands :)
KraziYeti 22 Jul, 2024 @ 10:25pm 
I knew it was right in front of me! LOL! IMy brain just kept looking in the custom data of the Programmable Block. Great mod and thank you for the quick reply.
Whiplash141  [author] 22 Jul, 2024 @ 6:48pm 
check the custom data of the rotors themselves
KraziYeti 22 Jul, 2024 @ 12:46pm 
Hi Whiplash, apologies if this is right in front of me but I can't see it. I'm using custom turrets and i've got it all working with turret groups and designators etc. But I want to set the rest angle and I spotted your comment "You can set rotor/hinge rest positions in the custom data of the rotors/hinges once the code has finished registering your turrets." So I've run the setup argument and recompile multiple times but the Custom Data is not showing any parameters that look like I can set rest angle etc. There's two about rest but they are rest speed and rest delay. Any help is really appreciated.
Black_Overlord 19 Jul, 2024 @ 7:07am 
Thank you, thats all i wanted to know
Whiplash141  [author] 18 Jul, 2024 @ 7:44pm 
Yes. Add "Designator" to the name of the custom turret controller and add it to the Turret Group as if it were an AI turret. It should work the same. You will not; however, be able to manually fire the slaved turrets with that CTC since there are no weapons to read the status of.
Black_Overlord 18 Jul, 2024 @ 1:00pm 
Can i (if yes - how?) use custom turret with just camera (with a vanilla custom turret controller) as a designator?
Whiplash141  [author] 8 Jun, 2024 @ 9:07pm 
Default meaning unowned or owned by you? If unowned, make sure everything is owned by you
aBunningssnagwithonionsplease 8 Jun, 2024 @ 8:27pm 
Ownership is default, at the moment I'm building the turret as a separate grid so the only rotors and hinges should be on the turret I'm trying to script.
Whiplash141  [author] 8 Jun, 2024 @ 7:31am 
are you using the rotors from the correct turret and is ownership correct?
aBunningssnagwithonionsplease 8 Jun, 2024 @ 5:07am 
Hey! I swear you've helped me with this issue before, and I've even got my other turret next to my current build at the moment pulling my hair out trying to replicate it. Really sorry to bother you again.

Can't seem to get the script to recognise the left right rotor, up down hinge, or the weapons

Turret Summary:
1 rotor turret group(s) found

Error 1:
No weapons, tools, lights or
cameras found

Error 2:
No base rotor found

Error 3:
No secondary rotor(s) found

Warning 1:
Unsorted rotor(s) found:
- "Turret Pan"
- "Turret Tilt"

I have weapons, a rotor and a hinge in this turret group.
Whiplash141  [author] 9 May, 2024 @ 11:54am 
It does still work, yes :)
Cthulhu 9 May, 2024 @ 11:30am 
Hello there,
quick Question, does die AI turret slaving Part still work? I need it so the turrets stop blasting my plane wings. Thx
Whiplash141  [author] 4 May, 2024 @ 8:30pm 
No, I kind of retired this script with the advent of the custom turret controller and my subsequent script TCES
Layzanya 4 May, 2024 @ 6:27am 
Since I haven't seen any posts or comments about it, is there a way to make this communicate with MART?
Whiplash141  [author] 25 Apr, 2024 @ 11:11pm 
That indicates that the script does not see a rotor base on the same grid as the rotor head of another.

Have a screenshot or blueprint of your turret? Your turret should look like one of the example turrets as pictured in "Rotor Turret Group Setup"
25iceking20020 25 Apr, 2024 @ 10:42pm 
So im building a ship that has some guns underneath. the guns are connected by conveyor to a hinge then rotor but it says no guns are available and no secondary rotor. Any idea why?
Whiplash141  [author] 16 Apr, 2024 @ 8:17am 
no
Manshima 16 Apr, 2024 @ 5:05am 
This is the behavior I would like: Reaver spawns in at 5km away and moves toward my station. I take control of a search light to find it and 'paint' the target. All of my station turrets (vanilla turrets, not custom) aim at the reaver that I have in my sights and fire as soon as the ship gets into range.

Currently my turrets won't fire until they have turned towards the ship, and they won't start moving until the ship gets into range. Will this script allow them to be slaved to my searchlight?
Whiplash141  [author] 7 Mar, 2024 @ 11:20am 
This script has an collision detection algorithm that attempts to check if there is any grid based occlusion. It is not perfect, but it should be a bit more conservative than the CTC checks.