Space Engineers
2,213 оценки
MART | Whip's Mouse Aimed Rotor Turret Script
5
10
6
6
2
2
   
Награда
Добавяне към любими
В любими
Премахване от любими
Тагове: other_script
Размер на файла
Публикуван на
Обновен на
687.539 KB
11 юни 2017 в 14:36
7 февр. 2022 в 10:32
36 бележки за промени ( преглед )

Абониране, за да се свали
MART | Whip's Mouse Aimed Rotor Turret Script

В 1 колекция от Whiplash141
Whip's Scripts
22 артикула
Описание
Yes, this works with hinges.

ATTENTION
As of game version 1.200, the game now properly synchronizes player inputs in seats. This means that you can finally use MART with multiple people simultaneously on the same ship!

Also update 1.200 introduced the Custom Turret Controller (CTC) which allows users to create custom turrets that can be either manually controlled or AI controlled without the use of scripts. CTCs can not control multiple elevation rotors or stabilize your aim, but my new Turret Controller Enhancement Script extends all of the features of MART to CTCs. I would highly consider trying TCES as a MART replacement as it is more capable and feature rich.


You can get the tank shown above HERE!


  • Added optional gyro assistance. Simply place a gyro on the azimuth or elevation grid and group it to use it.
  • Added main elevation rotor specification. Add the word "Main" to the name of the rotor you want to be considered the parent elevation rotor that all other rotors mimic.
  • Added independent stabilization terms for azimuth and elevation.
  • Turrets return to rest position when not being controlled
  • Automatic turret stabilization feature :D

  • This code can now support unlimited elevation rotors per turret group!

Howdy!

This script allows the user to control player made rotor using direct mouse inputs from a cockpit or control seat. No gyroscope or remote control is needed to do this since the code reads the user's mouse movement and directly converts it to rotor velocity. Rotor turrets using this code will emulate the movement of a manually controlled AI turret :)

Mouse aimed rotor turrets (MARTs) can have one or more Elevation rotors per turret group and the angles of each elevation rotor will be synced; however, only one Azimuth rotor can be used per MART group. You can fire the weapons in a turret group by pressing the default button for "crouch" [C].

Since the program can read mouse inputs directly from a cockpit or control seat, you are able to make land-based tanks using MARTs that can be fully crewed by just one person! You can also control multiple MARTs with only one code!


Watch the Setup Video for a visual walkthrough!
It is recommended that you read all the instructions before attempting
to use this code! This will make troubleshooting any issues much easier <3

Script Setup
  1. Place this script in a program block
  2. Set up mouse aimed rotor turret groups (see below sections)
  3. Set ownership on EVERYTHING to yourself
  4. DON'T FORGET TO SET YOUR ROTOR LIMITS!

Turret Group Setup


Mouse aimed rotor turret groups must be named like the following:
"MART <ID Tag>"
Where <ID Tag> is the unique identification tag of the rotor turret.

Example Turret Group Names:
  • MART 1
  • MART WhiplashIsAwesome
  • MART Tank Turret

Turret Group Components
EACH turret group must have:
  • One cockpit, control seat, or remote control (passenger seats wont work!)
  • One azimuth (horizontal) rotor/hinge with "Azimuth" in its name
  • One or more elevation (vertical) rotor(s)/hinge(s) with "Elevation" in its name
    • Place the word "Main" in the name of the elevation rotor that you want to be used as the parent rotor that all other elevation rotors follow. The code will pick this automatically if you do not specify :)
  • One or more weapons or tools on* each elevation rotor
    (rocket launchers, gatling guns, welders, grinders, drills, cameras, and spotlights supported)
    * "On" means on the same grid as the elevation rotor head
Optional components:
  • Gyros for rotor movement assistance: Gyros placed on elevation and azimuth grids will be used to help turn the turret if they are in the MART group.

Names of blocks don't matter beyond what is required.
Example: "Advanced Rotor - Azimuth"

Changing Variable Values
Open the programmable block's Custom Data to change variables without needing to mess with the code!
  1. Open the program's Custom Data
  2. Change the variables you want
  3. Run the script with the argument "setup"


Setting Turret Rest Position
By default, turrets will return to rest position when not being controlled. To set your own rest angle for a specified MART rotor, simply type the desire rest angle (in degrees) inside the rotor's custom data.
Example:
30
This would set the rest angle for the rotor to be 30 degrees

Arguments
Argument
Description
rest
Sends all MART turrets to their rest angles. This will lock you out of mouse control until the turret has reached its rest angles.
setup
Immediately runs the block setup and processes custom data and block changes. Can be used if you don't want to wait for the 10 second refresh interval.



I had initially envisioned this code to make multi crewed vessels possible, but bugs have smashed that dream. If they ever fix the bug where multiple seats can't be controlled, this code will still work without modification. Here's hoping! This was finally fixed!

Post any questions, suggestions, or issues you have in the comments! <3
Also, I'd love to see what y'all make with my scripts so feel free to post your turret creations in the discussions section!

Turret design in the picture was based off a design by 5URG3 :)

As always, I will be continuing to improve and support this code as time goes on :). My next plan long term stretch goal is to make this code interface with my Turret Slaving Script to allow a MART to control other rotor turret's angles. This; however, is near the back of my current priority list.

Weapon Core guns do not show up as "guns" to the script API, so they will not register as valid weapons or tools.

This should also go without saying, but do not reupload without explicit permission from me, not even to mod.io.

- Whiplash141

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

Yes, this works with hinges.
Популярни дискусии Всички (7)
321
17 окт. 2024 в 11:35
ЗАКАЧЕНА: Questions and Suggestions (MART)
Whiplash141
224
24 юли 2023 в 17:37
ЗАКАЧЕНА: Bug Reports
Whiplash141
19
5 септ. 2024 в 10:59
ЗАКАЧЕНА: Community Creations
Whiplash141
1 873 коментара
Whiplash141  [автор] 31 дек. 2024 в 9:15 
Look at the release year of this script @caliko. also the emphasized text in the description directly answers that
✪caliko 31 дек. 2024 в 6:50 
Doesnt the turret controller do this? i am confused, I love your scripts tho. Would love to know what this ones task is ^^
Shroomteller 26 дек. 2024 в 10:59 
Excellent work, thanks so much! Easy configuration and use.
Ricky David 5 ноем. 2024 в 9:41 
Hello! If I wanted to use the stabilization feature of the scripts and make a self balancing grid that ignored mouse inputs, how would or could I do that?
Comet 28 септ. 2024 в 10:55 
@Into you could probably build that out with a couple of event controllers. One to detect if the controller in use is no longer occupied and one to detect the rest angle being reached
Into 5 септ. 2024 в 9:14 
can you add a timerblock trigger if rest position is reached and mous-control on/off switch?
I use pistons and hinges to retract the camera after use and a timerblock to disable MART, but there is always a short timespan between MART turning off and end of rest position, inwhich any mouse movement can mess up the retraction and cause clang.
Whiplash141  [автор] 29 авг. 2024 в 19:33 
Select the weapons on your toolbar. This will fire all weapons of that type though, so if you have multiple turrets, that can be an issue. Alternatively, TCES also gets around this by using the custom turret controllers which segregate your fire command to the turret you are controlling. (MART can not do this because the hooks aren't there for scripts)
ButtSnorklr 29 авг. 2024 в 18:58 
Is there any way to make it fire on LMB or shoot rather than crouch?
Whiplash141  [автор] 24 авг. 2024 в 12:51 
Nope, but if you aren't opposed to custom turret controllers, you can omit the azimuth and my script TCES will extend all of the rest of the functionality that MART provides (like turret stabilization and rest angles) to that custom turret :)
GazatronPrim 24 авг. 2024 в 8:04 
is there a way of using this without the Azimuth?