• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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.

Using RNG

  • 25
    Posts
    14
    Years
    I've noticed on PSystem_Utilities that there exists the LCRNG that the official pokemon games use, how can i make my game use the LCRNG system?
     
    If you want to replace the random number generator battles use, insert the following in a script section above Main in your script editor.

    Code:
    class PokeBattle_Battle
      def pbRandom(x)
        if !@lcrng
          @lcrng = LinearCongRandom.pokemonRNG
        end
        return @lcrng.getNext % x
      end
    
      def pbAIRandom(x)
        if !@lcrng
          @lcrng = LinearCongRandom.pokemonRNG
        end
        return @lcrng.getNext % x
      end
    end

    Doing this will redefine the two random functions that the battle system uses to use that class you mentioned. (Note: I haven't tested this code. Also, you can probably use @lcrng.getNext16 instead of @lcrng.getNext with little difference in quality.)
     
    Back
    Top