Switches and variables
A switch is ON or OFF. This is an important concept for activating a switch, you can change the course of the adventure of the hero. A switch can be activated with a command event.
Events can display or change the page with their switch condition.
Consider an example :
We placed two events on a map :
The chest is not present at the beginning of the game when the hero talks to the character on the left, this one shows the chest.
In the event
Character, add command event
Select the switch not used in your game
The command is added to the list
Then go to the event
Conditionsand assign the switch used previously.
The chest will appear only if the swicht
S-0001 is enabled. Initially, this is not the case, the chest is not present. But speaking in character, it activates the switch showing the chest.
A variable is a numeric value. Thus, you can test the value in the trigger condition of an event and if it is verified then the event will be executed. A value is assigned to the variable via a command event.
Continuing the example above the chest. This time, the hero must speak 3 times the character to reveal the chest.
- In the event
Character, add the variable
- Choose the identifier of the variable
- Turn the operation
constant, set the value
- Then go to the event
Condiitonsand assign the variable used previously. The target value is
Thus, when the hero talks to the character, the
V-0001 variable is incremented by 1. The chest will appear when the variable is 3 or more, ie, when the hero talked 3 times the character.
When an event emits a detection, it triggers all local switches other events in the detection area.
Consider an example.
On the above image, a character is surrounded by 3 chests. Each chest can be opened with this method the tutorial
Create chest, ie, that each chest opens with the local switch
The character makes a detection of 2 tiles and activate the local switch of events around.
- In the event
Character, click the command event
Put 2 in area and AD in self switch to activate
Thus, the 2 chests in the red square from image below will open when the hero talks to the character