RPG MAKER WITH

How to Use Variables

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.

how to use variables top img

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.

How to Use Variables

Use the Event Editor to Make Variables

variables

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.

How to Make a Puzzle

Count Using Variables

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.

Create Different Weather Patterns Using Variables

select tile

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

Playtesting Random Weather Effects

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.

Create a Slot Machine

Slot Machine

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.

conditional branch slot machine

In this example, we created Condition Branches from 1-6, with the number 6 as the winning number.

slot machine winning number

The player has a 17% chance of winning and will be rewarded with 50G if the player rolls a 6.

RPG MAKER WITH Related Guides

Advanced Guide - RPG MAKER WITH

All Advanced Guide Articles

Core Guides
Advanced Guide Part 1 Advanced Guide Part 2
Supplementary Guides
How to Make a Boss Dungeon With Traps How to Make a Puzzle
Advanced Playtesting How to Make Enemies
How to Make Enemy Groups How to Make Different Kinds of Monster Encounters
How to Make a Boss Battle How to Make an Ending
How to Use Common Events How to Use Variables
EXP Curve Explained Status Effect Creation Basics
Animations Guide How to Set an Enemy’s Action Patterns
Event Priorities Explained
Tips and Tricks
How to Switch Battle Views How to Make a Debug Room
How to Make Your Characters Jump Kinds of Games You Can Make With RPG MAKER WITH
Game Design Fundamentals What to Do When You Can’t Make a Good Game

Beginner

Intermediate Guide - RPG MAKER WITH

Basic Information - RPG MAKER WITH

Author

    Walkthrough Menu

    All rights reserved