How to set a variable based on another variable

breadpan

Villager
Member
Joined
Jun 14, 2021
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
Say I want X to equal (Y+ 1). How do I do this?
 

Sarena

RPG Making since RM95!
Veteran
Joined
Oct 3, 2015
Messages
56
Reaction score
21
First Language
English
Primarily Uses
RMMZ
There are at least two ways that you can do this!

Eventing:
In a Control Variables event, set the variable X equal to Y. Then you can add another Control Variables event command that adds + 1 to the Y variable.

Coding:
In the Control Variables event command, set the Single variable to X. Then, under Script, use this code:
JavaScript:
$gameVariables.value(ID) + 1
In this example, you would replace ID with the variable ID number for Y (i.e. 2).
ControlVar.png
 

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
525
Reaction score
1,532
First Language
Indonesia
Primarily Uses
RMMV
Yes, like said above

normal eventing solution should be 2 command like this:
1629256934190.png

If you wanna go advanced, it should be like this:
1629257125366.png
Where the script is basically write down your own formula.
 

breadpan

Villager
Member
Joined
Jun 14, 2021
Messages
9
Reaction score
1
First Language
English
Primarily Uses
RMMV
Thank you! This was very helpful.
 

Latest Threads

Latest Posts

Latest Profile Posts

Have you ever had the problem of not knowing how to name your game?
I tried to draw it to keep the aspect ratio of 48*48
It doesn't look good, but I'm not sure if there are other ways to render larger characters. and then maintain the sharpness or not
SF_Enemy1_6 added!
index.php

Just thought I'd share how my battlers are looking for my 4 main characters. From left to right... Ashlyn the brave fighter, Lizzabelle the peaceful mage, Suki the thief, Saedra the not-so-peaceful mage.

pLZHVLI.png
Power to the Game Make!

Forum statistics

Threads
118,780
Messages
1,118,657
Members
155,950
Latest member
Sorcuris
Top