• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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
    7
    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 !
     
    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.
     
    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