• 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.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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!
  • 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 and EXP All Interaction Glitch

  • 1
    Posts
    6
    Years
    • Seen Jun 28, 2020
    I'm working on my first project and it's main feature is a badge dependent level cap (you stop gaining experience once you hit the cap.) I've added to Base Essentials code to achieve this effect in PBExperience Script.

    def PBExperience.pbAddExperience(currexp,expgain,growth)
    if growth>=6 || growth<0
    return ArgumentError.new("The growth rate is invalid.")
    end
    exp = currexp+expgain
    maxexp = pbGetExpInternal(MAXLEVEL,growth)
    # Setting the maximum level depending on badges

    if $Trainer.numbadges == 0
    maxexp = pbGetExpInternal(20,growth)
    end
    if $Trainer.numbadges == 1
    maxexp = pbGetExpInternal(32,growth)
    end
    if $Trainer.numbadges == 2
    maxexp = pbGetExpInternal(45,growth)
    end
    if $Trainer.numbadges == 3
    maxexp = pbGetExpInternal(55,growth)
    end

    exp = maxexp if exp>maxexp
    return exp
    end

    However, I've also added the Exp All into my game and am using the code that comes with Essentials to handle that. Because of that, I'm getting a glitch where after a pokemon faints and goes through the fainting animation, it stays alive with 1hp and can act the next turn, even though it's sprite moved from fainting. This glitch is extremely inconsistent, it only happens ~10% of the time, isn't pokemon or move specific, but it does only happen when the pokemon that fainted is at the level cap. There's a certain sequence of events in my current save file I'm using to reproduce and test this, and if I remove the level cap code, the glitch doesn't happen, so I'm fairly certain this is what's causing it (turning off the EXP All also prevents the glitch from happening.) This glitch has does not crash the game or give an error message, and the battle continues normally as if the fainted pokemon lived at 1hp, (if the pokemon faints a second time, it stays fainted.) Does anyone have any idea what specifically in my code could be causing this?
     

    Attachments

    • [PokeCommunity.com] Level Cap and EXP All Interaction Glitch
      Bug1.PNG
      43.5 KB · Views: 12
    • [PokeCommunity.com] Level Cap and EXP All Interaction Glitch
      Bug2.PNG
      49.4 KB · Views: 11
    • [PokeCommunity.com] Level Cap and EXP All Interaction Glitch
      Bug3.PNG
      36.7 KB · Views: 12
    Back
    Top