Teardown – Select An Environment to Load Via a Title Screen

Teardown – Select An Environment to Load Via a Title Screen 1 - steamlists.com
Teardown – Select An Environment to Load Via a Title Screen 1 - steamlists.com
Teardown is limited to only load one environment at a time per map. However, the game is able to handle multiple environments in one map using layers.

Following this step-by-step guide is one example of how to achieve this. In this guide, we will be using layers and locations.

Difficulty: intermediate

Knowledge needed: understanding of groups, layers, locations, knowledge of LUA code and Teardown script writing, specifically Ui and registry key knowledge

 
 

Starting off

 
In this tutorial, we will use two different environment nodes – a “sunny” template environment and a “night” template environment. 
 
Load up your map in the map editor. Create a new group in the main scene (right-click Main Scene, –> New Group). 
 
In the layer category of the group options, give it two names relative to both of your environment templates (e.g. we will write the name “sunny” for a sunny day environment and “dark” for a night environment – this creates a combined layer called “sunny dark”). Create a new location inside this group, place it below your map and tag it as “hidden” (or anything you want, hidden is just a relatable tag). 
 
Create two more groups. Name one as “sunny” in the layer property, and the other “dark”. Two layers have been created; one called “sunny” and another called “dark”. 
 
Cut/paste your “sunny” environment node inside the “sunny” group layer in the scene explorer. Cut/paste your “dark” environment node inside the “dark” group layer in the scene explorer. 
 
We will now cut everything else inside your Main Scene excluding your three groups you just created and their contents, and paste it all inside your combined “sunny dark” group layer (will not be visible in the Layers window, use the scene explorer). 
 
Teardown - Select An Environment to Load Via a Title Screen 
 
 

Scripting

 
Open up a text editing program. Notepad++ is recommended but a notepad file will work. If you are using Notepad++ remember to set the programming language to LUA in the language dropdown menu. Save the file as “layers.lua”, in a folder called “script” inside your map’s “main” folder (create it if it’s not already there). 
 
Go to the scene explorer once again, and right-click Main Scene, then create a new script. Find the location of the “layers.lua” script (LEVEL/script/layers.lua). Keep this script outside of any group, just leave it in the Main Scene. 
 
Now, assuming we’re all familiar with a bit of Teardown coding, then go back to your layers.lua script file. Some required code used for this section includes: 
Teardown - Select An Environment to Load Via a Title Screen 
 
An example of what your complete title screen code can look like: 
Teardown - Select An Environment to Load Via a Title Screen 
 
The above code will make a title screen look like this after hitting the Play button, with the code

UiButtonImageBox(“LEVEL/optionsbox2.png”, 6, 6)

being a custom image: 
Teardown - Select An Environment to Load Via a Title Screen 
 
Clicking Noon will load the map using the “sunny” layer which has the “sunny” environment; 
Clicking Evening will load the map using the “dark” layer which has the “dark” environment. 
 

By NGNT

I hope you enjoy the Guide we share about Teardown – Select An Environment to Load Via a Title Screen; if you think we forget to add or we should add more information, please let us know via commenting below! See you soon!
 
 
 
 


Be the first to comment

Leave a Reply

Your email address will not be published.


*