Space Engineers: Visual Scripting Tool Guide

A guide on how to assemble some simple scripts to control game play for a scenario.

 

Visual Scripting Tool

This guide will show how to construct and understand the example scenario from here.
Step 1: Build a grid
In this example, I have a refinery, a cargo box, a button panel and a battery. the button panel is set to be able to turn on the refinery


Step 2: Tag the entities
Pressing f11 twice brings up the scenario menu where you can “Tag” selected items for the scenario

Right-click to pan the camera then Left click to select an item. When selected it will be highlighted in dark blue.

Rename selected Entity “Tags” the grid

Selected Block “Tags” highlighted item

I have called the grid “Main_Base” and named all the functional blocks by their type “Refinery_1”, “Cargo_1” Button_1” & “Battery_1”

Once you are done, put your character where you want the player to start and save.

Step 3: Now it’s time to start the VST tool.

When you load up the visual scripting tool choose saved world and pick the save you just created

To verify the connection press the run scenario button and you should get a “hello world” chat message.

As the last script in the state machine, it will end the scenario.

Additionally using a finished state to the line will close out the session with the option of unloading the game and rolling keen credits. Right-click and choose final then drag a connection from the “end” objective script over the final block to connect.

Detail about the tool

Step 4: time to add logic!

Below is the default script that will be inside the mission 01 start script in your scenario from the start.

Explanation of types of nodes,
-Methods in Mission script this will be the logic running throughout the whole session
GameStarted – runs on initial world load
GameFinished – runs through once on stare machine completed
Update – runs once per game tick
Dispose – runs through once on world unload
PlayerDied – trigger when the player dies default to “death screen” and unloads world.

-Methods in objective scrips, these are separated with transitions as your scenario progresses
-init – runs through once on script load
This will be where you want to place all the setup blocks and questlog.

-Update runs through once per game tick
This will be where the interactive items will be attached

-Dispose – runs through once on script unload

-Deserialize – not used

-Events
-Begins a Sequence Line execution when the associated event occurs in the game.
-Single Sequence Line output and parameter pins, no input pins
-Dark orange

​ -Key Events:
-Functions similarly to normal Events, but with user-specified “key” values
-Only fires when parameters with the specified values are triggered

-Functions:
-Methods loaded from libraries
-Input and output connections for parameters
-Green

-Script Nodes:

-Basic nodes for performing specific actions
-Includes sequence controllers, variables, and logic gates
-Colors vary

Step 5: The storyline
It’s a good idea to have a clear picture of the series of events you want to play through.
In this case, we have a simple set of objectives.
Repair the refinery
Turn on the refinery
Overload the battery
Restore power
Detect player removed ingots
Close session

Now we can use the “start” script to set up the scene.

Making the Scenario

Step 6: scripting visually

On the init event we want to set the refinery integrity, set power to off and place materials inside the cargo container once this is done we can use a complete node to close this script.

Each of these sections is connected by a sequence to make it look neat.

Don’t be fooled by the name a sequence runs so fast it might as well be all at the same time.

This set of nodes will take the health of the entity and halve the value to set the health of the block. Get block health with either take current health of the maximum state depending setting of the build integrity boolean. If you want you can directly set the heath value as an integer directly into the set health node.

The set adds the components, this could be done in the scenario set when it’s being built but you might want to have this as an event in the scenario so I’ve set this out here.

The last node added to the sequence is the complete transition

This will terminate this script section and move to the next one defined in the state machine.
To get a complete node you must drag out a connection from a node and search for “complete” in the context menu

On the dispose event we will create a new questlog called “The ultimate quest” and set the first detail task to “repair the refinery!”

The questlog is the list of tasks at the top of the screen

From the state machine, we can see the next script from “start” is “part” if you add more scripts you can use the state machine to control what order they will play.

Within the “part” script we want to use the update method to check the condition of the refinery.

Here you can see how to highlight an object by using the integrity check the highlight will deactivate once the refinery is functional

A branch allows you to stop a script from proceeding until a true/false condition is met. It is used here prior to updating the questlog, If true then proceed and update the quest to “Activate the refinery”, but because the update method is run every frame we need to add a “once” script so what comes afterwards is not repeated.

This will section compare the block heath in both its current state and its potential maximum, the arithmetic node is set to compare and will output a boolean of false until the block integrity is 100%

As this part is complete the next step is to turn on the system so that to guide the player a highlight is set on the button panel.

“Button pressed” method will disable the panel highlight, then apply a large amount of damage to the battery entity finally update our questlog “Power overload look for alternative power supply”.

Now onto the end script using the update method to check the grid is powered this will set the output to true and allow the branch to continue where we set quest complete.


As the last script in the state machine, it will end the scenario.

Additionally using a finished state to the line will close out the session with the option of unloading the game and rolling keen credits. Right-click and choose final then drag a connection from the “end” objective script over the final block to connect.


Thanks to Chipstix213 for his great guide, all credit to his effort. you can also read the original guide from Steam Community. enjoy the game.

Related Posts:

About Robins Chew

I'm Robins, who love to play the mobile games from Google Play, I will share the gift codes in this website, if you also love mobile games, come play with me. Besides, I will also play some video games relresed from Steam.

Leave a Comment