Formula to choose a variable using another variable

 Nova

Veteran
Veteran
Joined
Feb 8, 2015
Messages
163
Reaction score
136
Is it possible to set a variable to another variables ID and then use that in a formula? Example: variable 1 = 30. that would mean variable 1 equals whatever variable 30 equals.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,141
Reaction score
12,416
First Language
English
Primarily Uses
RMMV
Yes, but you need to state what maker you're using.


You've posted in Tech Support - All Makers, but this question really belongs in the Support forum for the specific maker. MV uses different names to everything else, so if we assume you're using MV and give you the answer for that, and you're actually using Ace, it won't work.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,141
Reaction score
12,416
First Language
English
Primarily Uses
RMMV
I've moved this thread to VX Ace Support. Please be sure to post your threads in the correct forum next time. Thank you.


So you're using it in a damage formula?


So let's say the variable that contains the other variable's id is 8, and that variable 8 is currently set to 15.

$game_variables[$game_variables[8]]which will then be interpreted as

Code:
$game_variables[15]
So use what I have in the first code block, replacing 8 with whatever variable contains the other variable id.
If it's in the damage formula, you might be able to reduce it to this:

Code:
v[v[8]]
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Check out SpokenWord- my text-to-speech plugin for RPG Maker MV!
just watched spacex launch. was awesome.
Jumping and gravitation 0.1 build - RPG Maker MV
Currently playing final fantasy 3 on DS. It's an old one but its a classic.

Forum statistics

Threads
97,957
Messages
948,113
Members
129,203
Latest member
mizz
Top