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
40,098
Reaction score
13,704
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
40,098
Reaction score
13,704
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 Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,047
Members
137,569
Latest member
Shtelsky
Top