Formula to choose a variable using another variable

Discussion in 'RPG Maker VX Ace' started by  Nova, Dec 29, 2015.

  1.  Nova

     Nova Veteran Veteran

    Messages:
    163
    Likes Received:
    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.
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,184
    Likes Received:
    11,053
    Location:
    Australia
    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.
     
    #2
  3.  Nova

     Nova Veteran Veteran

    Messages:
    163
    Likes Received:
    136
    Oh, my bad. For this, I'm using Ace.
     
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,184
    Likes Received:
    11,053
    Location:
    Australia
    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: Dec 29, 2015
    #4

Share This Page