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

Easy LevelCap(v16, v17, v18, v19)

16
Posts
7
Years

  • Easy LevelCap(v16, v17, v18, v19)

    Hello, some time ago I make a very simple and effective level cap system for using it at my game, since I also share it on other places, I guess doesn't hurt also share it here in case anyone just need it, and doesn't like the ones already published.

    Also, it's easily customizable and works in any version of pokémon essentials, so you can use it even at the v16 or v17.
    For installing, you just need to edit some scripts:​

    First find "def pbGainExpOne"
    Then find "if isOutsider" inside the def, and paste this before it:
    Code:
    #######################################################
    # SuperSimple Level Cap System by Clara. Credits not needed but are appreciated.
    #######################################################
    #==================CONFIGURATION=======================
        levelCapExp = 1 #the exp gained if the levelcap is active change it if you 
                        #want to make the pokemon gain some exp, recomended less than 100
    
        levelCap=15
        levelCap=25  if $game_switches[4]     #1 badge
        levelCap=35  if $game_switches[6]     #2 badge
        levelCap=40  if $Trainer.numbadges>=2 #3 badge
        levelCap=45  if $Trainer.numbadges>=3 #4 badge
        levelCap=50  if $game_variables[8]==1 #5 badge
        levelCap=55  if $game_switches[9]     #6 badge
        levelCap=60  if $game_switches[10]    #7 badge
        levelCap=75  if $game_switches[11]    #8 badge
    #======================================================
        if defined?(pkmn) #check if the pkmn variable exist, for v18 and v19 compatibility
        	thispoke = pkmn
        end
    
        exp=levelCapExp if (thispoke.level >= levelCap) && exp>levelCapExp
    #####################################################

    Now, to customize it, you must change the number assigned to each "levelCap" variable by the level the cap will reach and the "if" next to it for whatever condition you want to use to extend it to that level. The conditions can be switches, variables, the number of medals, etc ... (as seen in the example), so you can customize it in any way you want ^^.

    NOTE: This script only limited the exp gained in battles, for items like the rare candy it won't work, and it will let you still using the item, this is a easy way to let the player skip the level cap if is needed (for example get an evolution or learn a new move in the next level). If you want to fix this, you should follow this: https://www.pokecommunity.com/showpost.php?p=10419480&postcount=3
     
    Last edited:
    1
    Posts
    2
    Years
    • Seen May 5, 2022

    NOTE: This script only limited the exp gained in battles, for items like the rare candy it won't work, and it will let you still using the item.​


    I just found out how to fix this.
    Go to your scripts and find the script called "Item_Effects". Scroll down to line 770, there should be the Rare Candy.
    At the end of line 770 add this little line of text:
    Code:
     || pkmn.level>=levelCap
    What that does is, it will check, if the Pokemon is over or equal to the level cap and won't accept your Rare Candy.
    Right above that (so to your new line 770 ongoing) you copy your set up level caps - exactly like you have them in your battle script. But you'll only need the lines where you set up your caps. In the end, with the given example, it will look like this: (from line 769 to 786)
    Code:
    ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene|
        levelCap=15
        levelCap=25  if $game_switches[4]     #1 badge
        levelCap=35  if $game_switches[6]     #2 badge
        levelCap=40  if $Trainer.numbadges>=2 #3 badge
        levelCap=45  if $Trainer.numbadges>=3 #4 badge
        levelCap=50  if $game_variables[8]==1 #5 badge
        levelCap=55  if $game_switches[9]     #6 badge
        levelCap=60  if $game_switches[10]    #7 badge
        levelCap=75  if $game_switches[11]    #8 badge
      if pkmn.level>=GameData::GrowthRate.max_level || pkmn.shadowPokemon? || pkmn.level>=levelCap
        scene.pbDisplay(_INTL("It won't have any effect."))
        next false
      end
      pbChangeLevel(pkmn,pkmn.level+1,scene)
      scene.pbHardRefresh
      next true
    })
    If you don't do that, the game will throw an error, because levelCap was never defined in the Item_Effects script. Now your Rare Candies should work like they should, they will adapt to the level cap you set up.
    Remember: If you ever change your level cap again after setting it up, make sure to change it in BOTH scripts! Otherwise your Rare Candies will not work properly.​
     
    53
    Posts
    11
    Years
  • No, since I think it is much safer to put the code directly in the script that create a plugin that re-writes the script just for a little feature like this.
    To use it, just follow the instructions on the main post.

    Ah I done it and it is working so I dont need the level scaling or would it still work nicely.
    Just one other thing is there some kind of way of making $game_switches to active when making a challenge run or nuzlocke
     
    16
    Posts
    7
    Years
  • Ah I done it and it is working so I dont need the level scaling or would it still work nicely.
    Just one other thing is there some kind of way of making $game_switches to active when making a challenge run or nuzlocke

    I don't know if I understand well your question, but in case you want to activate the level cap on certain moment, or game mode, you can just put a conditional in this line:
    exp=levelCapExp if (thispoke.level >= levelCap) && exp>levelCapExp

    For example:
    Code:
    [COLOR="Red"]if $PokemonGlobal.isNuzlocke[/COLOR]
     exp=levelCapExp if (thispoke.level >= levelCap) && exp>levelCapExp 
    [COLOR="Red"]end[/COLOR]
    In this case the level cap only will work if you are in Nuzlocke mode, but you can change the condition to any other thing, a switch should work well too.
     
    53
    Posts
    11
    Years
  • I don't know if I understand well your question, but in case you want to activate the level cap on certain moment, or game mode, you can just put a conditional in this line:
    exp=levelCapExp if (thispoke.level >= levelCap) && exp>levelCapExp

    For example:
    Code:
    [COLOR="Red"]if $PokemonGlobal.isNuzlocke[/COLOR]
     exp=levelCapExp if (thispoke.level >= levelCap) && exp>levelCapExp 
    [COLOR="Red"]end[/COLOR]
    In this case the level cap only will work if you are in Nuzlocke mode, but you can change the condition to any other thing, a switch should work well too.

    Dont worry I will just have to experment but I should not be angry when I see errors lol but given a option in the intro for if the player wants to use it but that would mean I have to make another case of Brock,Misty and so on 😊
     
    1
    Posts
    1
    Years
    • Seen Jan 27, 2023
    I found your post and also directly installed and there I have a question. Namely, is there a way to display the level cap somewhere? So in the trainer pass or in the pause menu?
     
    1
    Posts
    1
    Years
    • Seen Jan 7, 2023
    Firstly: Thank you, Clara for providing your code.
    I am currently working on a project in essentials version 19.1. For that project I was looking for a way to implment a level cap. That is how I found out about your work.
    I took what you and Bahamut did and edited it slightly. I just implemented it in such a way that if the player tries to use rare candies to bring the Pokémon above the level cap, the normal massage of "It won't have any effect." will be displayed aswell as "The current level cap is X." where "X" stands for the currently active level-cap. So no big adjustment, but I thought I share it here, if anyone ever wants to use it.

    So here is what I did:
    1.) Do what Clara suggests, but slightly altered:
    - In the Script Editor go to Battle_ExpAndMoveLearning under the section [[Battle ]]
    - Go to line 140, where you should find if isOutsider
    - Before that paste the following:

    Code:
    #######################################################
    # SuperSimple Level Cap System by Clara. Credits not needed but are appreciated.
    #######################################################
    #==================CONFIGURATION=======================
        levelCapExp = 0 #the exp gained if the levelcap is active change it if you 
                        #want to make the pokemon gain some exp, recomended less than 100
    
        levelCap=15
        levelCap=25  if $game_switches[4]     #1 badge
        levelCap=35  if $game_switches[5]     #2 badge
        levelCap=40  if $game_switches[6]     #3 badge
        levelCap=45  if $game_switches[7]     #4 badge
        levelCap=50  if $game_switches[8]     #5 badge
        levelCap=55  if $game_switches[9]     #6 badge
        levelCap=60  if $game_switches[10]    #7 badge
        levelCap=75  if $game_switches[11]    #8 badge
        levelCap=100 if $game_switches[12]    #E4
    #======================================================
        if defined?(pkmn) #check if the pkmn variable exist, for v18 and v19 compatibility
          thispoke = pkmn
        end
    
        exp=levelCapExp if (thispoke.level >= levelCap) && exp>levelCapExp
    #####################################################
    * I altered the condition of some of the if-statements, so it is checked wether each respective badge is obtained.

    2.) Do what Bahamut suggests, but slightly altered:
    - In the Script Editor go to Item_Effects under the section [[Items ]]
    - Go to line 725, where you should find if pkmn.shadowPokemon?
    - Before that implement the level-cap setup from before (the one with the many if-statements)
    - after next false within the if pkmn.shadowPokemon?-statement, implement the following lines:
    Code:
    elsif pkmn.level>=levelCap
        scene.pbDisplay(_INTL("It won't have any effect.\nThe current level cap is {1}.", levelCap ))
        next false


    In total your lines 724-766 should look like this:
    Code:
    ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene|
      levelCap=15
      levelCap=25  if $game_switches[4]     #1 badge
      levelCap=35  if $game_switches[5]     #2 badge
      levelCap=40  if $game_switches[6]     #3 badge
      levelCap=45  if $game_switches[7]     #4 badge
      levelCap=50  if $game_switches[8]     #5 badge
      levelCap=55  if $game_switches[9]     #6 badge
      levelCap=60  if $game_switches[10]    #7 badge
      levelCap=75  if $game_switches[11]    #8 badge
      levelCap=100 if $game_switches[12]    #E4
      if pkmn.shadowPokemon? 
        scene.pbDisplay(_INTL("It won't have any effect."))
        next false
      elsif pkmn.level>=levelCap
        scene.pbDisplay(_INTL("It won't have any effect.\nThe current level cap is {1}.", levelCap ))
        next false
      end
      if pkmn.level >= GameData::GrowthRate.max_level
        newspecies = pkmn.check_evolution_on_level_up
        if newspecies && Settings::RARE_CANDY_USABLE_AT_MAX_LEVEL
          pbFadeOutInWithMusic {
            evo = PokemonEvolutionScene.new
            evo.pbStartScreen(pkmn,newspecies)
            evo.pbEvolution
            evo.pbEndScreen
            scene.pbRefresh
          }
          next true
        else
          scene.pbDisplay(_INTL("It won't have any effect."))
          next false
        end
      end
      maximum = [(GameData::GrowthRate.max_level - pkmn.level),$PokemonBag.pbQuantity(item), levelCap-pkmn.level].min
      qty = scene.pbChooseNumber(
         _INTL("How many {1} do you want to use?", GameData::Item.get(item).name_plural), maximum, 1)
      next false if qty < 1
      $PokemonBag.pbDeleteItem(item, qty - 1)
      pbChangeLevel(pkmn,pkmn.level + 1 + (qty - 1),scene,true)
      scene.pbHardRefresh
      next true
    })

    This will make it so overleveling your Pokémon with rare candies is prohibited. If the player tries anyway, he will see the current level-cap.
    WARNING:
    Be aware that you have to change your level-caps for the different gym-badges in both scirpts (Battle_ExpAndMoveLearning, Item_Effects) if you want it to work correclty and in sync.

    Best regards Heriks ~
     
    Last edited:
    Back
    Top