Formula to choose a variable using another variable

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.
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.
Oh, my bad. For this, I'm using Ace.
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]]

Original thread: https://forums.rpgmakerweb.com/threads/formula-to-choose-a-variable-using-another-variable.53861/