This guide explains how to set up variables in RPG Maker for tracking player actions and controlling events. Read to learn more about using Variables in RPG MAKER WITH.
Track player actions and control Events in RPG MAKER WITH with Variables! Read on to learn how to count, change the weather, and increase your guide's interactivity.
List of Contents
Variables are powerful tools in RPG MAKER WITH because they allow you to track and store data, enabling dynamic gameplay elements. You can use variables to manage character stats, track player progress, and even create randomized Events using a "roll the dice" mechanic, adding unpredictability and depth to your game.
The first effective way to use variables in your game is to track player actions. For example, you can use variables to count how many times a player interacts with a specific object or character. So, let's create an Event involving an office switch and an office clerk who will track how many times the player has pressed the switch.
1 | In the Events screen, select a tile where you want to place this Event. |
---|---|
2 | Enter the Basic Info and Image for this Event and head to Event Details. |
3 | Press the A Button to add a command line. Go to Flow Control, choose Condition Branch, select Character, and set it to whichever way the player should be facing. In this case, we set it to Player is facing Up. Check Create Else Br. |
4 | We're going to add a Play SFX command. Add another command line above Else, go to Audio, choose Play SFX, and choose a sound effect. Press OK. |
5 | Now let's add a character reaction when the player presses the switch. Add another command line below the Play SFX command. Go to Character, choose Show Balloon, and select a Balloon Icon. Press OK. |
6 | Next, add a Show Text command acknowledging that the player has pressed the switch. Your command box should look like this before we add the Control Variable. |
7 | Now let's add a Control Variable for this Event. Add a command line below the Show Text command, select a Variable slot, select Add under Operation, and set the Constant to 1. This means that every time the player presses the switch, it will count as 1. |
8 | Now we're going to create the office clerk who will be the tracker for this Event. Select a tile and enter the Basic Info and Image. |
9 | Go to Event Details, add a Show Text command and enter the text. In this example, we entered "You pressed the switch /v[0004] times!" This code means that the Count for Variable number 0004 will be displayed. |
10 | Let's do a playtest. We pressed the switch 3 times. |
11 | Success! Our Variable count is working perfectly. |
This time, we're going to use randomized variables to ensure that our game world generates a different weather effect each day and will affect the entire environment. In this example, we'll create a Rest/Inn Event where the player has the choice to sleep in a bed or not. If the player decides to rest, then the weather will change when the character wakes up.
To do this, select a tile to place the Event. Enter the Basic Info but leave the Image blank. Set Priority to Same as Char and set Trigger to Player Touch.
1 | Head to Event Details and add a command line. Go to Flow Control, choose Condition Branch, and set it to "Player is facing Left." Check Create Else Br. In this example, the bed is on the left side so the character needs to face left to activate the Event. Afterward, add a command line above Else. Go to Messages, select Show Text, and enter a question for the player choices. |
---|---|
2 | Add a command line below the Show Text command. We're now going to add a Show Choices command. Go to Messages, choose Show Choices, and set #1 for Yes and #2 for No with the Cancel choice being Choice #2. Press OK. |
3 | Add a command line below When Yes. Go to Screen and select Fade Out Screen. |
4 | We're going to add a Play MFX command. Add another command line below the Fade Out Screen command, go to Audio, choose Play MFX, and choose a sound effect. Press OK. |
5 | Now we're going to add a pause effect for a couple of seconds after the fade out. Add a command line below the Play SFX command, go to Timing, choose Wait, and set the number of frames. In this example, we set the frames to 300 seconds or about 5 seconds. |
6 | Afterward add a Show Text command if the player decides to sleep. |
7 | Add another command line below the Show Text command and go to Screen and select Fade In Screen. |
8 | Now we're going to add a Control Variable for the weather. Add another command line below the Fade In Screen command and go to Game Progress, choose Ctrl Variables, and select the Variable number under Single, Operation to Set, and the Operand to Random 1 ~ 3. This means that whenever the Event is activated the control variable is going to choose a number from 1-3 randomly. |
9 | After adding the Control Variable, your Event Details command box should look like this. |
10 | We are now going to add a Condition Branch for the weather effect. Add a command line below the Control Variable command and go to Flow Control, choose Condition Branch, select Game Progress, choose the Variable number for this Event, and set the constant to 1. Check Create Else Br. Press OK. |
11 | Add a Show Text command that will display to notify the player that the weather has changed. This one is for a Sunny Day. We don't need to set a Weather FX because Sunny Day is the default weather setting. |
12 | Now, add a command line below Else. Go to Flow Control, choose Condition Branch, select Game Progress, choose the Variable for this Event and this time set the constant to 2. Check Create Else Br. Press OK. |
13 | Let's add a Weather effect. Add a command line, go to Screen, and choose Set Weather FX. We selected Rain with Intensity 5. Make sure to uncheck Wait Until End. Add a Show Text command afterward for this Rainy weather. |
14 | Similar to doing the Rain weather effect, add a Condition Branch and set the constant to 3, add a Weather FX and Show Text command. Your Event Details command box should look like this. |
15 | Finally, let's add a Show Text command under When No. This message will display if the player decides not to sleep. |
How to Draw Maps for Specific Locations
Now that we have created and used random variables to create weather effects, let's do a playtest to see if it is working properly.
1 | Choices are working. Let's choose No. |
---|---|
2 | The Show Text for No is working. |
3 | Now, let's see what will happen if we select Yes. |
4 | Success! The weather changed to Snowy Day. |
5 | Let's change the weather one more time. Success! It is now a Rainy Day. |
6 | Let's try to head out and see if it affects the map connected to this one. |
7 | Success! It is also raining outside. |
Creating a Slot Machine is a fun way of using random variables and testing the player's luck. The steps involved in creating a Slot Machine are similar to creating random weather effects but instead of 3 sets of Condition Branches that represent a weather pattern, you can create a Condition Branch from numbers 1-999 and select a winning number from it.
In this example, we created Condition Branches from 1-6, with the number 6 as the winning number.
The player has a 17% chance of winning and will be rewarded with 50G if the player rolls a 6.
Core Guides | |
---|---|
Advanced Guide Part 1 | Advanced Guide Part 2 |
Core Guides | |
---|---|
Beginner's Guide Part 1 | Beginner's Guide Part 2 |
Tips and Tricks | |
---|---|
Map, Event, and Switch Naming Tips | How to Use the Flood Fill Tool |
Core Guides | |
---|---|
Intermediate Guide Part 1 | Intermediate Guide Part 2 |
Tips and Tricks | |
---|---|
How to Make a Switch | How to Use Map Foregrounds and Backgrounds |
How to Change Event Text Color |
How to Use Variables
Genshin Impact Walkthrough & Guides Wiki
Pokemon TCG Pocket (PTCGP) Strategies & Guides Wiki
Call of Duty Black Ops 6 (BO6) Walkthrough & Guides Wiki
Honkai: Star Rail Walkthrough & Guides Wiki
Dragon Quest 3 HD-2D Remake (DQ3) Walkthrough & Guides Wiki
Metaphor: ReFantazio Walkthrough & Guides Wiki
Dragon Age: The Veilguard Walkthrough & Guides Wiki
Pokemon Scarlet and Violet (SV) Walkthrough & Guides Wiki
Wuthering Waves Walkthrough & Guides Wiki
Zenless Zone Zero Walkthrough & Guides Wiki
Super Smash Bros. Ultimate Walkthrough & Guides Wiki
Pokemon Legends: Arceus Walkthrough & Guides Wiki
New Pokemon Snap Walkthrough & Guides Wiki
Elden Ring Shadow of the Erdtree Walkthrough & Guides Wiki
Hyrule Warriors: Age of Calamity Walkthrough & Guides Wiki
The Legend of Zelda: Breath of the Wild Walkthrough & Guides Wiki
FF7 Remake Walkthrough & Guides Wiki
©Gotcha Gotcha Games
The copyrights of videos of games used in our content and other intellectual property rights belong to the provider of the game.
The contents we provide on this site were created personally by members of the Game8 editorial department.
We refuse the right to reuse or repost content taken without our permission such as data or images to other sites.