Space Engineers

Space Engineers

1,515 평점
Whip's Turret AI Slaving Script
3
3
2
14
2
6
2
2
2
2
   
어워드
즐겨찾기
즐겨찾기됨
즐겨찾기 해제
태그: other_script
파일 크기
게시일
업데이트일
609.088 KB
2016년 4월 25일 오전 12시 39분
2024년 10월 11일 오전 11시 02분
업데이트 노트 96개 (보기)

다운로드 위해 구독하기
Whip's Turret AI Slaving Script

Whiplash141님의 1 모음집
Whip's Scripts
아이템 22개
설명
(Previously titled: "Whip's AI Rotor Turret Control Script")

Note
In the documentation below, "rotor" refers to both rotors and hinges! This is because the game considers hinges to be just fancy sideways rotors.


  Features
  • Slaves targeting of AI turrets, player-made rotor turrets, and rotor gimbals to other AI turrets.
  • Designators can be manually controlled to fire slaved turrets
  • Each turret group can be individually configured
  • Accurate target leading: slaved rocket turrets will actually hit their targets.
  • Turrets will avoid shooting through their own ship & subgrids.
  • Turrets will also avoid shooting through friendly ships with Turret Based Radar or this Turret Slaving script installed.



  Description
Howdy!

This script aims player made rotor or hinge based turrets at an AI turret's target. This script also allows you to slave control of other AI turrets to other AI turrets.

Now for some terminology:
  • Designator turret: An AI turret (vanilla or modded) that will be used to give targets to our custom turrets. They must have the word Designator added to their name.
  • Rotor turret: One rotor/hinge and one (or more) secondary rotors/hinges with weapons or tools on them slaved to one (or more) designator turrets (2DOF)
  • Rotor gimbal: One rotor/hinge with weapons or tools on it slaved to one (or more) designator turrets (1DOF)
  • Slaved AI group: One (or more) AI turrets slaved to one (or more) designator turrets

Additionally, you can manually control turret groups by manually controlling the designator.

You can have multiple turret groups controlled by this script simultaneously. You do not need a script for each custom turret group you wish to create.


  Script Setup
  1. Place this script in a programmable block.
  2. Setup rotor turret, rotor gimbal, and slaved AI turret groups (See below sections for more detail).
  3. You must run the script with the argument setup to process any new blocks, groups, or custom data changes!

You can heavily customize each turret's behavior in the custom data of the programmable block tha this script runs from (See "Custom Data" section below).


  Rotor Turret Group Setup
Required Steps
Create a block group with the following constraints:
  • Rotor turret groups must be named like the following: "Turret Group <TAG>" where <TAG> is a unique tag for your turret.
    Examples:
    • Turret Group 1
    • Turret Group Tomato
    • Turret Group iLikeTurtles420
  • Each turret group must have the following required blocks:
    • One base rotor/hinge. Each rotor turret only supports one base rotor/hinge. (Name does not mater)
    • One or more secondary rotors/hinges mounted sideways on top of the base rotor/hinge. (Names do not matter)
    • At least one weapon or tool atop each secondary rotor/hinge head (Names do not matter). Accepted blocks include:
      • Any fixed weapon
      • Cameras
      • Ship tools
      • Any light block
    • One or more AI turrets with the name tag "Designator". The type of the turret does not matter, but in survival, it must have ammo to work as a designator.
Optional Steps
  • Add any desired optional blocks to the group:
    • Timers: Can be configured to trigger on shoot or on targeting in the timer's custom data
    • Lights: Can be configured to blink or change color when turret is targeting or idle in the light's custom data
  • You can set rotor/hinge rest positions in the custom data of the rotors/hinges once the code has finished registering your turrets.

Examples



  Rotor Gimbal Group Setup
Required Steps
Create a block group with the following constraints:
  • Rotor gimbal groups must be named like the following: "Gimbal Group <TAG>" where <TAG> is a unique tag for your gimbal.
  • Each gimbal group must have the following required blocks:
    • A rotor/hinge. Each gimbal group only supports one rotor/hinge. (Name does not mater)
    • At least one weapon or tool atop the rotor/hinge head(Names do not matter). Accepted blocks include:
      • Any fixed weapon
      • Cameras
      • Ship tools
      • Any light block
    • One or more AI turrets with the name tag "Designator". The type of the turret does not matter, but in survival, it must have ammo to work as a designator.
Optional Steps
  • Add any desired optional blocks to the group:
    • Timers: Can be configured to trigger on shoot or on targeting in the timer's custom data
    • Lights: Can be configured to blink or change color when turret is targeting or idle in the light's custom data
  • You can set rotor/hinge rest positions in the custom data of the rotors/hinges once the code has finished registering your turrets.

Examples



  Slaved AI Turret Group Setup
Required Steps
Create a block group with the following constraints:
  • Slaved AI groups groups must be named like the following: "Slaved Group <TAG>" where <TAG> is a unique identifier for your slaved AI group.
  • Each slaved AI group must have the following required blocks:
    • One or more AI turrets with the name tag "Designator". The type of the turret does not matter, but in survival, it must have ammo to work as a designator.
    • One or more AI turrets without the name tag "Designator".
Optional Steps
  • Add any desired optional blocks to the group:
    • Timers: Can be configured to trigger on shoot or on targeting in the timer's custom data
    • Lights: Can be configured to blink or change color when turret is targeting or idle in the light's custom data

Example



  Custom Data Config
After your turret groups are all setup, you can customize the behavior of each one in the custom data of the programmable block.
  1. Open the custom data of the programmable block
  2. Edit the variables you desire
  3. Click "Ok"
The script will process the changes once you run the argument "setup".




  Author's Notes
I went through great pains to simplify the setup of this script to reduce confusion. The script is smarter now and will try to auto detect your turrets.

Also, Weapon Core guns/turrets do not appear as weapons to the in-game API, and I have no plans to write mod specific code to support them. You can use timers to fire them.

(Do not reupload without permission, not even to mod.io)

- Whiplash141
인기 토론 모두 보기(3)
359
2023년 6월 7일 오후 7시 45분
고정됨: Bug Reports
Whiplash141
94
2024년 2월 28일 오전 4시 13분
고정됨: Feature Suggestions
Whiplash141
37
2021년 6월 6일 오후 7시 13분
고정됨: Player Made Turrets!
Whiplash141
댓글 2,487
Whiplash141  [작성자] 2025년 8월 4일 오전 7시 47분 
Possible? Yes. Sensible? No.
Based_Stickman 2025년 8월 3일 오후 10시 36분 
Is it possible to have these be able to slave to a target given by ai block kind of like the way rdav did his missiles
Whiplash141  [작성자] 2025년 7월 30일 오후 10시 26분 
"will they still shoot?"

Yes.

"i notice it seems u use interior turrets as designators"

I made a lot of the documentation and examples above years before when interior turrets had 800m range. It is just a regular (albeit subpar) turret now.

"detects enemies / allies"

For clarity, turrets only detect what they shoot at. If you want to detect allies, you should use a custom turret controller as a designator.

"can i use the custom turret as the designator"

As in a custom turret controller? Yes, that will work with this script.
Cpt.KrinkleFry 2025년 7월 30일 오후 10시 22분 
if the designator cannot see the target but my slaved AI turrets can, will they still shoot?

i notice it seems u use interior turrets as designators, does the interior turrets range effect how it detects enemies / allies for the slaved turrets?

also does this stop ur turrets from shooting ur own ship or only ally ships?

i have a strange multi turret set up on top of my ship. (big grid) 1 assault cannon, 2 chain guns, 2 missile turrets, 1 custom turret. can i use the custom turret as the designator or would it be more viable to use an interior turret for each of my AI guns and for the custom
Whiplash141  [작성자] 2025년 7월 26일 오후 10시 04분 
each turret group can share the same designator without issue, yes.

what issue are you having?
Slatex 2025년 7월 24일 오전 11시 05분 
hey man nice script! sorry to bother but i cant find the answer, each rotor turret group need to have their own designator? im trying to make several customs turrets using 1 designator but i cant manage to make it work
Whiplash141  [작성자] 2025년 7월 15일 오후 9시 01분 
Without any details I cant help you.
Cmdr. Chicken 2025년 7월 15일 오후 5시 39분 
on this since literally 5h now its 4am i cant get a single turret to work...
Whiplash141  [작성자] 2025년 5월 18일 오전 5시 57분 
no it will not
KAD65 2025년 5월 7일 오후 11시 19분 
will this help ai turrets aiming leading and tracking without setting up a designator ?