Space Engineers

Space Engineers

Not enough ratings
Self Guided Missile MK2 - Script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
10.210 KB
16 May, 2020 @ 7:35am
1 Change Note ( view )

Subscribe to download
Self Guided Missile MK2 - Script

In 1 collection by puipuix
PP - Guided Missile MK2
8 items
Description
Improved version of my old script, now it's easier to use:
- No need to recompile
- No need of missile group
- Just add 'Missile Safety' somewhere in one of your ship's block's data and all configuration will be ready !

It's better to launch them at more than 300m

(Sometime the missile will have weird movement, it's possible that the gyroscope is not correctly oriented (sometime it is correct so IDK))

Contents
- How to build a missile
- How to use
- How it work



How to build a missile:
- Build it like you want, this just have to have 1 remote control, 1 gyroscope and 1 turret.
You can use any thruster type, the spawn aim direction of the turret will be the forward direction
of the missile.
- Turn off thrusters and enable stockpile on tanks.
- Configure the turret targets to make the missile target what the turret will target.

You can also download my blueprint (with mod block) that can be found in my PP - Guided Missile MK2 mod collection.


How to use:
- Write the value of the argument 'SAFETY_BLOCK_DATA_KEY' (see below, 'Missile Safety' by default) in one or more of your ship's block's data.
- Attach the missiles with merge blocks.
- Search a target and get in the missile turret range.
- Turn off your ship merge block to launch the missile.
- The missile should aim and go toward the target.


How it work?
- The script default mode is SAFETY
- The script will look for a block's data that contains the value of the argument 'SAFETY_BLOCK_DATA_KEY'
If he find one or more, he will set his mode to READY.
- If he's on mode READY and he don't find a block's data that contains the value of the argument
'SAFETY_BLOCK_DATA_KEY', he will set his mode to LAUNCHING. The missile will turn off stockpile,
turn on thursters and set forward thrusters to full thurst.
- Then it will arm warheads, set his mode to SEARCHING and he will get the turret's targeted entity.
- If the entity is empty, the missile will keep going forward.
- If the entity exist, the missile send the elevation and the azimuth to the gyroscope Yaw and Pitch
(You will maybe have to change that in the code depending on turret / gyro orientation) and set
his mode to TRACKING.
- If the turret is clone enought of the target, the missile will go BOOM (or just hit the target if there are no warhead).
- When the missile miss the target, it will turn around and continue the pursuit or search for an other one
if the turret lose the target.
18 Comments
usmcsavage 2 Jun, 2021 @ 6:23am 
never mind. i'm just an idiot. (things don't work if they are turned off)
usmcsavage 31 May, 2021 @ 1:58am 
i have a missile set up on my ship with a pp merge block on my ship directly connected to the missiles pp merge block. i'm trying to set up a projector on my ship so i can weld directly on the ship but nothing is build-able. its aligned correctly. any thoughts?
Schmetterling 23 Feb, 2021 @ 6:49am 
Да, ракеты полностью заправлены. Но при отсоединении не переходят в иной режим.

Yes, the rockets are fully fueled. But when disconnected, they do not switch to another mode.
puipuix  [author] 23 Feb, 2021 @ 2:22am 
Turn the engines off when building. The script will only turn them on when launching and will set their ThrustOverridePercentage to 1 (for the forward).

After been disconnected from the main vehicle the mode should be LAUNCHING or SEARCHING or TRACKING. If not that mean that the missile still have acces to a block with 'Missile Safety'.

Do your thrusters have fuel ?
Schmetterling 22 Feb, 2021 @ 9:47pm 
Испытания провел. Все сделал как нужно, ракета смогла перейти в режим ГОТОВ, но после разрыва контакта ракета не стартует. Двигатели включены, но не летит.
Нужно ли, как показано в видео, отключать двигатели при постройке или скрипт сам их отключит при переключении в режим ГОТОВ?

Tests conducted. I did everything as needed, the rocket was able to go into READY mode, but after the contact was broken, the rocket did not start. Engines are on, but not flying.
Do I need to turn off the engines when building, as shown in the video, or will the script turn them off when switching to READY mode?
puipuix  [author] 22 Feb, 2021 @ 8:48am 
The warning are not a problem, don't worry
And yes it's inside custom data
Schmetterling 22 Feb, 2021 @ 12:53am 
Сорри за оффтоп. Разобрался куда нужно добавить "Missile Safety". Почитал коментарии к ракетам в вашей мастерской и там сказано, что нужно добавить "Missile Safety" в "Custom Data" любого блока. Уфф...сегодня попробую как сработает. Если я правильно понял это, то стоит добавить это уточнение в описание скрипта, будет меньше вопросов.

Sorry for offtopic. Figured out where to add "Missile Safety". I read the missile comments in your workshop and it says that you need to add "Missile Safety" to the "Custom Data" of any block. Uff ... today I'll try how it works. If I understood this correctly, then it is worth adding this clarification to the description of the script, there will be fewer questions.
Schmetterling 22 Feb, 2021 @ 12:44am 
Возможно я что-то делаю не так. Я просто изменил имя одного из блоков, добавив к нему "Missile Safety" (без кавычек). Нужно делать как-то иначе?

Maybe I'm doing something wrong. I just changed the name of one of the blocks by adding "Missile Safety" (no quotes) to it. Need to do something differently?
(litter for translation, google)
Schmetterling 22 Feb, 2021 @ 12:33am 
Пока использую скрипт от Rdav's, модифицированный пользователем io982. Он решил его проблему с rayscan.

For now I am using a script from Rdav's modified by user io982. He solved his problem with rayscan.
Schmetterling 22 Feb, 2021 @ 12:25am 
After adding the code to the program block, I check the code and it gives the following errors:
Program (108.0): Warning: Unreachable code detected
Program (112,0): Warning: Unreachable code detected

I named one of the blocks "Missile Safety" and recompiled, this is what the script produced:

Missle mode: SAFETY
Update Frequency: Update10

Error: No safety block with data that contains 'Missle Safety' as been found.