• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll 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.

Change the maximum level of Pokemon more time

Qwertyis666

Dragon Trainer Since 1996
  • 60
    Posts
    11
    Years
    Hello everyone! I'm working back on my game (Pokemon Korano) and I have a little question about maximum level:
    I want to change the maximum level you can up your Pokemon (to prevent grindind,etc) with every gym leader you beat.
    Let's me explain; went you start, the maximum level will be cap at 15, after you earn the first badge the cap will be 20, etc, etc.

    I know in Settings script section (first one) there is the max level setting (MAXIMUMLEVEL=100) so I change it to MAXIMUMLEVEL=$game_variables[77], where variable 77 is my current lvl cap.
    But i always got a error went the ''[ ]'' are a syntax error...

    Oh and I'm on Pokemon Essentials V.14
    Anyone can help me with this?

    Thanks in advance and sorry for my bad english :)
     
    The reason you get the error is because at that point in time, $game_variables is not a thing yet, and it actually it wouldn't be able to initialize the class just yet. Even if it could, this variable is only initialized one time, so it would not update. Best bet is to manually update it, or have it continuously check that variable in the loop in Scene_Map. After
    Code:
    def main
        createSpritesets
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
    add
    Code:
    MAXIMUMLEVEL=$game_variables[77]
    PBExperience::MAXLEVEL=$game_variables[77]
     
    The reason you get the error is because at that point in time, $game_variables is not a thing yet, and it actually it wouldn't be able to initialize the class just yet. Even if it could, this variable is only initialized one time, so it would not update. Best bet is to manually update it, or have it continuously check that variable in the loop in Scene_Map. After
    Code:
    def main
        createSpritesets
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
    add
    Code:
    MAXIMUMLEVEL=$game_variables[77]
    PBExperience::MAXLEVEL=$game_variables[77]

    I always get a syntax error where MAXIMUMLEVEL=$game_variables[77] is at (Line 69 here)
    The error screen don't give me more info. (Only display syntax error at line 69)

    In Scene_Map, here my script

    Code:
    def main
        createSpritesets
        Graphics.transition
        loop do
          Graphics.update
          Input.update
          update
          MAXIMUMLEVEL=$game_variables[77]
          PBExperience::MAXLEVEL=$game_variables[77]
          if $scene != self
            break
          end
        end
        Graphics.freeze
        disposeSpritesets
        if $game_temp.to_title
          Graphics.transition
          Graphics.freeze
        end
      end

    What I have made wrong?
     
    I forgot Ruby won't let you redefine constants (it will let you through events though). Add this in a new section

    Code:
    def pbUpdateMax
      redef_without_warning(:MAXIMUMLEVEL,$game_variables[77])
      PBExperience.redef_without_warning(:MAXLEVEL,$game_variables[77])
    end
    
    class Object
      def def_if_not_defined(const, value)
        mod = self.is_a?(Module) ? self : self.class
        mod.const_set(const, value) unless mod.const_defined?(const)
      end
      
      def redef_without_warning(const, value)
        mod = self.is_a?(Module) ? self : self.class
        mod.send(:remove_const, const) if mod.const_defined?(const)
        mod.const_set(const, value)
      end
    end
    And just replace what you did above with
    Code:
    pbUpdateMax
     
    I forgot Ruby won't let you redefine constants (it will let you through events though). Add this in a new section

    Code:
    def pbUpdateMax
      redef_without_warning(:MAXIMUMLEVEL,$game_variables[77])
      PBExperience.redef_without_warning(:MAXLEVEL,$game_variables[77])
    end
    
    class Object
      def def_if_not_defined(const, value)
        mod = self.is_a?(Module) ? self : self.class
        mod.const_set(const, value) unless mod.const_defined?(const)
      end
      
      def redef_without_warning(const, value)
        mod = self.is_a?(Module) ? self : self.class
        mod.send(:remove_const, const) if mod.const_defined?(const)
        mod.const_set(const, value)
      end
    end
    And just replace what you did above with
    Code:
    pbUpdateMax

    Big Thanks mej, like you know, this is not the first time you give me your help and I very appreciate it :)
     
    Doesn't quite work the way I wanted it... as I learned from asking around on the PC forums, you can't change a constant like the max level. What you need to do is add into the save section on bootup so that the game "remembers" that you've adjusted the max level.

    E.g. Your Max Level in the settings is 150, but you want it to go up as you beat gym leaders, sure you can use the event settings to make a new event that changes the max level to say 20 after you beat gym leader 1, but if you save the game and then close it, you will then be able to level past 20 unless you add a check in the save section of the settings to remember that if you have only one badge, you can't level past 20.
     
    Doesn't quite work the way I wanted it... as I learned from asking around on the PC forums, you can't change a constant like the max level. What you need to do is add into the save section on bootup so that the game "remembers" that you've adjusted the max level.

    E.g. Your Max Level in the settings is 150, but you want it to go up as you beat gym leaders, sure you can use the event settings to make a new event that changes the max level to say 20 after you beat gym leader 1, but if you save the game and then close it, you will then be able to level past 20 unless you add a check in the save section of the settings to remember that if you have only one badge, you can't level past 20.

    Check out this post. I don't think it's a good idea to change the actual maximum level, and it's better to just change the player's maximum level (this way you can give opponents Pokemon that are over the cap). I might have to add preventing leveling up with the day care, but this should cover most other situations.
     
    Back
    Top