An Anatomy of Switches
Part 1: Basics
What Is A Switch?
A Switch is a function that allows you to trigger certain events when the switch is activated. Those familiar with RPG Maker in particular will already know about switches and the same applies in Smile Game Builder.
In Smile Game Builder, there are five types of switches:
- Local Switch
- Global Switch
- Variable Switch
- Conditional Switch
- Trigger Switch
In this article, I’ll go through each one in turn, with examples as necessary. This is a basic outline of each type’s function within SGB, but in future parts I’ll expand them with more details.
A Local Switch is unique to each event. That means that they can only be used in that event and values can’t be transferred to other events.
Some of the more common uses of local switches are for chests and other searchables. They’re also used in certain “stationary” events, such as moving NPCs left or right if you give them specified items.
You’d use local switches when you know you’re only going to use them in single events and nowhere else.
There’s only one Local Switch and, honestly, that’s all you need.
Whenever you want to use switches across events, you’d use a Global Switch.
One example might be if you wanted to trigger something from one map and activate it on another map. A global switch is particularly useful for this, since it can be used anywhere in your game and, therefore, can be turned ON or OFF at any time as well.
SGB has a total of 999 switches, which may seem a lot, but it still mounts up if you use them excessively. It’s better to use a combination of the switches in this list, depending on what you intend to do.
A Variable Switch is for using variables to trigger other events based on their values.
I’ve used variable switches for sequencing event triggers in intros or cut scenes, notably in Tutorial #21.
Another example is for checking Player Direction or Camera Mode. Their values are stored in a variable, which can then act as a switch depending on the direction the player is facing or whether the camera is in normal view or first-person view.
Things like Held Money or Inventory (in the Event Sheet Conditions) can also be classed as variable switches, since their values are stored.
Conditional Switches are specifically for when you use conditions in Event Sheet Conditions, such as toggling switches (Event Switch/Switch) or checking if an ally is in the party (Ally/Party).
If any of the specific conditions are true, then the event triggers as a switch so that the events in the Event Details will activate.
Conditional switches can also be used in Event Panels. In Event Switches/Condition Checks, Check Variable Box and Check Switch Box are conditional switches because they do something based on certain conditions. (A lot more will be added in the future.)
With Conditional Switches, if you have more than one in the Event Sheet Conditions, then all of them need to be met in order to run the event.
The final type of switch is the Trigger Switch. This is set in the Event Details and activates depending on which one you use.
The most common is When Main Hero Talks, where if the action key is pressed, then whatever you put in the Event Details will run to execute the event. It’s usually used for opening doors and chests, or talking with people – interacting with other events requiring some kind of action.
The two other Trigger Switches of note are Triggered Automatically (1 Time Only) and Automatically Start (Synchronize and Run Repeatedly), which work in similar ways, but with some major differences.
The former activates once when conditions to trigger the event are met and the latter runs repeatedly in the background when the conditions are met and will continue until those conditions become false.
In Tutorial #15, there’s a more detailed explanation of event triggers as a whole, which you can watch to see how each one works.
Notes About Switches
- Switches can be used in the same way in Common Events as events placed on maps.
- Event triggers (in Event Details) affect how events are run. With the exception of Triggered Automatically (Repeated) and Automatically Start (Synchronize and Run Repeatedly), the events will run through once until the end is reached or their conditions change.
- Switches in general can be used in one of two ways:
- Placed as Event Sheet Conditions, where the events will run depending on the trigger and the condition(s) being met, or
- If used in the Event Details, conditions on other sheets (up to a maximum of 20 per event) will run. This will continue until all conditions are met or there are no other conditions.
- Automatically Start (Synchronize and Run Repeatedly) takes priority over all of the other triggers, which also affects when and how switches are activated.
This concludes the first part of the multi-part series An Anatomy of Switches. In the next parts, I’ll go through each one in more detail and how they can be used effectively for all kinds of things. I’ll also reference their use in my tutorials as that arises.
Note that these are not the “official” categorization of switches. They’re my own, which I’ve deemed easier to reference and which I’ll be using in future parts.