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

[Scripting Question] Level cap version 18.1

  • 20
    Posts
    4
    Years
    • Seen Jan 30, 2024
    So, i was starting to use essential, and i want to the pokemon stop gaining exp at X lvl until get a badge.

    More of the scripting recommendation i found are from scripting codes that i can't find in the default script of essential, so i ask if someone can explain how to do a cap for ¿beginners?

    Thanx!
     
    But how? Most of the explanation i found don't explain the process, and in most there are codes that can't be found in the Essential base.

    Ej badgelevel=MAXLEVEL
    if pbOwnedByPlayer?(thispoke.index) && internalbattle
    badgelevel=10
    badgelevel=20 if pbPlayer.numbadges>=1
    badgelevel=30 if pbPlayer.numbadges>=2
    badgelevel=40 if pbPlayer.numbadges>=3
    badgelevel=50 if pbPlayer.numbadges>=4
    badgelevel=60 if pbPlayer.numbadges>=5
    badgelevel=70 if pbPlayer.numbadges>=6
    badgelevel=80 if pbPlayer.numbadges>=7
    badgelevel=100 if pbPlayer.numbadges>=8
    end
    if thispoke.level>badgelevel
    newexp=PBExperience.pbAddExperience(thispoke.exp,1,growthrate)
    else
    newexp=PBExperience.pbAddExperience(thispoke.exp,exp,growthrate)
    end

    To modify this code, Rot8er said to go to "def pbObedianceCheck" in PokemomBattle_Battler, but that def don't exist in any of the script base, and don't explain how to create it.
     
    This code was made by Janichroma, you can insert it in the script section:Battle_ExpAndMoveLearning:
    Spoiler:
     
    That help me a lot!

    I put the code whit 2 pokemon, lvl 15 and 20. When i switch the lvl 15 for the lvl 25 and won, it's return this message:

    "undefined local variable or method .thispoke for....... "

    I put the code on the loop where the bar growth

    loop do # For each level gained in turn...
    # EXP Bar animation
    levelMinExp = PBExperience.pbGetStartExperience(curLevel,growthRate)
    levelMaxExp = PBExperience.pbGetStartExperience(curLevel+1,growthRate)

    tempExp1 = pkmn.exp
    battler = pbFindBattler(idxParty)
    -------------------------------------------------------
    if pkmn.exp>=PBExperience.pbGetMaxExperience(growthRate)
    pkmn.calcStats # To ensure new EVs still have an effect
    return
    end
    levelLimits = [20, 25, 30, 35, 40, 45, 50, 55, 60]
    leadersDefeated = pbPlayer.numbadges
    if pkmn.level>=levelLimits[leadersDefeated]
    exp = 0
    elsif thispoke.level<levelLimits[leadersDefeated]
    totalExpNeeded = PBExperience.pbGetStartExperience(levelLimits[leadersDefeated], growthRate)
    currExpNeeded = totalExpNeeded - pkmn.exp
    if exp > currExpNeeded
    exp = currExpNeeded
    end
    end
    --------------------------------------------------------
     
    Mb forgot to check the code. Just change "thispoke" to "pkmn" in this line
    Code:
    elsif [COLOR="Red"]thispoke[/COLOR].level<levelLimits[leadersDefeated]
    Code:
    elsif [COLOR="Red"]pkmn[/COLOR].level<levelLimits[leadersDefeated]
     
    Mb forgot to check the code. Just change "thispoke" to "pkmn" in this line
    Code:
    elsif [COLOR="Red"]thispoke[/COLOR].level<levelLimits[leadersDefeated]
    Code:
    elsif [COLOR="Red"]pkmn[/COLOR].level<levelLimits[leadersDefeated]

    The same problem but with levelLimits. Maybe is in the wrong line?
     
    First of all I'd advise you to not put the code after the exp bar animation, because even if it doesn't raise an error there, it won't do anything. The experience calculation is already done there. Try putting the code where I proposed to insert it and if that doesn't work post your error message, I'm happy to help you. :)
     
    First of all I'd advise you to not put the code after the exp bar animation, because even if it doesn't raise an error there, it won't do anything. The experience calculation is already done there. Try putting the code where I proposed to insert it and if that doesn't work post your error message, I'm happy to help you. :)

    Same error: https://ibb.co/7tRVmyy

    I post the full code with the scrip in case it's help. Thanx for the help, really. There are a lot of stuff changed in v18 that the tutorial don't explain.

    Spoiler:
     
    I apologize for not testing the code myself first. But now after realizing I put it into the wrong place, I can confirm that it should work now. Just delete the code you inserted beforehand and instead add this:
    Spoiler:
     
    Here's a script you can check out. It has the added benefit of preventing levelling up through items.

    (broken link removed)
     
    Back
    Top