Space Engineers

Space Engineers

Not enough ratings
Guide for Advanced Guided Missile Script
By Alysius
Complete Setup and Usage Guide for Advanced Guided Missile Script:
https://steamhost.cn/steamcommunity_com/workshop/filedetails/?id=1734970571
3
2
   
Award
Favorite
Favorited
Unfavorite
How To Setup

Setting up Advanced Guided Missile involves 6 steps with testing:
1 - Building the Missile.
2 - Checking Missile Build.
3 - Save Missile Configuration.
4 - Mounting Missile to Warship.
5 - Checking Missile Separation Block.
6 - Mounting Multiple Missiles to Warship.



1 - Building the Missile

Each missile needs the following blocks:
  1. Programmable Block loaded with this script.
  2. One Remote Control.
  3. One or more Gyroscopes.
  4. One or more Thrusters. No Side Thrusters required. If used on Planets, also have some Downward Facing Thrusters.
  5. One or more Power Source. If SAVEMISSILE feature is used, this block can be turned off. Else it must be turned on.
  6. Exactly one Merge Block for detaching missile from ship. Rotors, Hinges and Connectors can also be used now (after v7.0). See Supported Detach Types Section of the guide.
  7. A few forward facing Cameras.
  8. One or more Antennas. IMPORTANT: Required for initial lock-on communication.
  9. (Optional) Side facing Cameras. Missile drifts and may lose lock due to out of camera 45 degree view range.
  10. (Optional) One to two forward facing Cameras with name tag PROX for Proximity Tripwire.
  11. (Optional) F*** ton of Warheads.


You can also use Rotor, Hinge, Connector and Sprue to detach missile. See Supported Detach Types Section for more details.


2 - Checking Missile Build

Enter CHECKMISSILE into the PB and click Run button.

IMPORTANT: Missile MUST NOT Be Mounted to ship for this test. Running this test with missile mounted means the entire ship is checked as one missile.


The Missile Issues list MUST be empty. Otherwise, resolve all issues listed until it is empty.

Example if issues to be fixed:

The Missile Parameters list will display some of missile information such as which thruster is used for foward (to check missile orientation).


3 - Save Missile Configuration

Optional Feature (skip if you do not intend to save missile layout): This script supports saving missile configuration to Custom Data. This allows launcher script to detect if missile is built completely before launch, plus also allows better performance friendliness during initialization on launch. Downside is that you must re-perform a save operation if any of your missile blocks are changed.

With missile Completely Detached and standing alone, enter SAVEMISSILE into the Arguments and click Run.


A new configuration section titled AGMSAVE will appear under Custom Data of the PB:


Enter CHECKSAVE into the Arguments and click Run to verify that the missile is correctly saved:


Recompile the script. The [NOTREADY] tag will be automatically added to signal to launcher script that a "check save" should be performed before launching the missile to ensure it is fully built:



4 - Mounting Missile To Warship

Rotor, Hinge, Connector and Sprue are supported. See Supported Detach Types Section for more details.



5 - Checking Missile Separation Block

Run the final check to ensure missile detaches correctly (i.e. detects correct port to detach).
Mount missile to ship, then enter CHECKDETACH into the PB and click Run button.


If wrong port is detected, shift your PB nearer to the missile Merge Block (or your intended detach block) and try again.


6 - Mounting Multiple Missiles To Warship

There is no restriction. Once one missile is setup properly, copy and paste it to all the missile mounting Hardpoints on your Warship.

You can also Blueprint different missile builds and have the Projector select which missile type to mount (High explosive, Kinetic penetrator, High speed missile etc).
How To Operate


Diamond Dome Defense Script is currently the only script that can interface and launch these missiles.

In the future, an Advanced Missile Control Script will be introduced to handle various launch modes (Raycast, TV Guided, GPS, Semi-Active etc).
Supported Detach Types
This script supports different types of missile detachment blocks:

1) Merge Blocks.
2) Rotors (and Hinges, which counts as rotors).
3) Connectors.
4) Sprue.

Missile will search for the Nearest Block from the PB, that is matching the above types except Sprue.

Some missiles may have Merge Blocks (for detach) and Connectors (for fueling hydrogen and ores), which the script may pick the Connector instead of the intended Merge Block due to it being closer to the merge block. You can use one of the 3 ways to avoid this by scoping down the search:

1) Use DetachGroupName configuration setting. (See Custom Data Configuration Section).
Example:
DetachGroupName=Missile Merge Blocks

2) Use DetachBlockTag configuration setting. (See Custom Data Configuration Section).
Example:
DetachBlockTag=Missile Detach

3) Use DetachType configuration setting (See below guide section).
Example:
DetachType=Sprue

Below guide section shows all the supported detach types and also the Custom Data configuration to scope down the search (usually not required, but may be used if script gets confused due to multiple possible detach types present nearby).


Merge Block

This is the basic Merge Block detach type.


Custom Data Configuration
DetachType=Merge


Rotor Top

Rotor detach type whereby the Rotor Top (its rotating head) is on the missile. Hinges are considered Rotors and therefore also supported and treated the same way.


Custom Data Configuration
DetachType=RotorTop


Rotor Base

Rotor detach type whereby the actual Rotor (its main body) is on the missile. Hinges are considered Rotors and therefore also supported and treated the same way.


Custom Data Configuration
DetachType=RotorBase


Connector

Connector detach type.


Custom Data Configuration
DetachType=Connector


Sprue

Detach type whereby a holding block must be destroyed (e.g. shot off by gatlings etc) before missile will detach. In this case, script will not attempt to detach any block. Instead, the launcher script MUST handle the destruction of this holding block. Missile will wait for at most 1 second for missile to be detached (by checking if launcher script PB is still reachable). If holding block not destroyed within this waiting time, detach fails and missile script stops.


Custom Data Configuration
DetachType=Sprue



Custom Data Configuration
You can customize the behavior of this script via Custom Data of this script's Programmable Block. The configuration settings are to be added to the AGM section, like the example below:

Note: The configuration is using the INI file format. Above example shows the AGM section and where / how the settings are placed. The variables are non-case sensitive.

Legends:
  • "Per Tick" means in one update tick, which is 1÷60 second for normal 1.0 sim speed.
  • "Number of ticks" means number of the tick described above (i.e. 60 ticks per sec).
  • "Distance" are all in Metres unless specifically mentioned otherwise.
  • "Target Size" refers to target's AABB bounding box's diagonal size in Metres.
  • "Target Radius" refers to half of Target Size, in metres.
  • "IGC" means Intergrid Communications (send data to other ships via Antenna).

Below is the full list of settings available for configuration:

UniqueId
Unique ID assigned to this missile. Used by launcher script control. <Long> (default: 0)

GroupId
Group ID assigned to this missile. Used by launcher script control. <Long> (default: 0)

SenderId
Sender ID allowed to send information to this missile. Used by launcher script control. <Long> (default: 0)

NavigationStrategy
If set to 0, script uses Proportional Navigation. If set to 1, script uses Quartic Prediction (for unlimited speed mod worlds). <Integer> (default: 0)

PropNavConstant
Proportional Navigation Gain. <Number> (default: 5)

PropNavAccelConstant
Proportional Navigation Acceleration Gain. <Number> (default: 0.05)

ProvNavMultiplierIfAccel
Proportional Navigation multiplier if missile is accelerating past vanilla speed. <Number> (default: 1.25)

MinimumThrustAcceleration
Script guesses missile thrust to perform more accurate turning. This value sets the minimum thrust. <Number> (default: 1)

ThrustEstimateFactor
Estimated thrust is scaled with this factor. <Number> (default: 1)

PDGainP
Gyro's PD Controller Proportional Gain. <Number> (default: 30)

PDGainD
Gyro's PD Controller Derivative Gain. <Number> (default: 10)

PDAimLimit
Maximum turning in radians for Pitch and Yaw turning combined. If Pitch and Yaw exceeds, it is scaled back to this maximum value. <Number> (default: 6.3)

LaunchDelayTime
Time in seconds for missile to clear launch tube before starting guidance. <Number> (default: 1)

PerformFanOut
Whether to perform fanning out of missiles to avoid cluttering together too much (easy target for enemy). <True/False> (default: false)

FanOutDurationTicks
Number of ticks to fan out before starting guidance. <Number> (default: 120)

PerformTurretDodge
Whether to perform turret dodging maneuvers. <True/False> (default: false)

TurretDodgeStartDistance
Distance from target to start turret dodging maneuvers. <Number> (default: 700)

TurretDodgeEndDistance
Distance from target to stop turret dodging maneuvers. <Number> (default: 250)

CompensateDampener
Whether to compensate for gravity by tilting missile. <True/False> (default: true)

ActiveHomingEnabled
Whether to use Fire and Forget Active Homing via on-board cameras. <True/False> (default: true)

ExcludeFriendly
Whether to exclude locking on to friendly targets. <True/False> (default: true)

ExcludeNeutral
Whether to exclude locking on to neutral targets. <True/False> (default: false)

RaycastRelockNearby
Whether to switch to alternative valid target if current target is lost. <True/False> (default: true)

OffsetTargeting
Whether to use offset targeting to hit specific spots on the target. <True/False> (default: false)

RandomOffsetAmount
Radius from target center to probe for valid offset targeting spot on the target. <Number> (default: 0)

RaycastMaxDistance
Maximum distance for raycast to trace for initial target aquisition. After full lock-on, this value is not used. <Number> (default: 3000)

ForwardReferenceName
If auto-detection of forward reference is incorrect, use this name tag on the forward reference block (e.g. Remote Control, main missile thruster etc). <String> (default: <empty>)

DampenerReferenceName
If auto-detection of gravity dampener thruster is incorrect, use this name tag on the dampener thruster. <String> (default: <empty>)

TripwireType
If set to 0, tripwire detonates warheads. If set to 1, tripwire arms warheads. <Integer> (default: 0)

UseInertialTripwire
Whether to use Inertial Tripwire, which guess when the impact point will be for triggering warheads. Used for cases when proximity sensors are destroyed. <True/False> (default: true)

IdleDisableSeconds
Number of seconds after missile lost active lock-on and command guidance, or vital missile components, to disable script. <Number> (default: 60)

DetachGroupName
Group name of detach blocks to search for missile detachment. This is to force script to only select detach blocks from a specific group of blocks. <String> (default: <empty>)

DetachBlockTag
Name tag of detach blocks to search for missile detachment. This is to force script to only select detach blocks with a this name tag. <String> (default: <empty>)

DetachType
Scrtipt supports different type of detach blocks (i.e. Merge, Rotor, Hinge, Connector etc). This setting limits the type of block to be searched for missile detachment (i.e. Merge, RotorTop, RotorBase, Connector, Sprue). See "Supported Detach Types Section" of the guide for more details. <String> (default: <empty>)
7 Comments
Mr.Platin 31 May, 2021 @ 11:35am 
Can this script operate Airtight Doors? So it can open it's "hatches" when launching.
Unruly 3 May, 2021 @ 12:13pm 
@overwerk Absolutely, and simultaneously makes me feel like a dummy. Now that you point it out in so many words, I realise why _some_ things reappear on control bars when rebuilt and others don't. Tyvm for replying!
overwerk 3 May, 2021 @ 9:22am 
@Unruly This is already the case. If your missile is correctly grouped in its blueprint, it will print back in that group, you just have to group the missile in the blueprint you plan on using. Hope that helped
Unruly 2 May, 2021 @ 11:58am 
Is there any way to automate the latter steps? During a fight, the last thing I'd want to be doing is messing around in the terminal, assigning group names to programmable blocks.
overwerk 21 Mar, 2021 @ 9:55am 
Going to second this, Sprue is highlited as possible but there is no tagging or Grouping info for the gattling/thruster that is nessesary to blow up the sprue
Bruno051 21 Feb, 2021 @ 11:24am 
how do you set up sprue?
Malacanth 20 Jan, 2021 @ 6:08pm 
Can't seem to find an answer. Launching from a 45 degree angle in gravity I have 4 thrusters, 2 dampeners, 2 forward thrust, when the missile activates it is using the dampener thrusters only and the forward ones do not turn on at all, even when I manually turn on the forward thrust, it still uses dampeners only. Remote is oriented correctly.