• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Manipulating a variable within a script

hirokimura

Miltank's Fanboy Number One
150
Posts
6
Years
  • Hey guys !
    Just a quick question there, if I may ask.
    I'd like to increment a variable directly within a script like in Battle_startandend...
    I know that's possible, but I kinda suck with the syntax used and I don't want to break the game q_q

    Could someone please teach me how to increment by 1 or 2 a specific variable in ruby ?
    Thanks !
     
    277
    Posts
    15
    Years
  • I am on mobile right now, so I can't go into a lot of detail, but I believe you are looking for:

    $game_variables[VARIABLE] += rand(1..2)

    This will add a random amount between 1 and 2 to one of you game variables.
     

    hirokimura

    Miltank's Fanboy Number One
    150
    Posts
    6
    Years
  • Nice ! Exactly what I was looking for. Might come up with a nice feature plugin soon. Well, I still have to determine how to make it plug and play like other plugins but well xD
    Thanks a lot :)
     
    Back
    Top