• 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.

Using RNG

26
Posts
13
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?
     
    129
    Posts
    8
    Years
    • Seen Mar 23, 2023
    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