• 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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] [Pokemon Essentials v19.1] Vertical Fight Menu Wrapping Issues

zedcoeur

Zed Coeur
  • 29
    Posts
    6
    Years
    • Seen Apr 15, 2022
    Hello, everyone. I'm currently dealing with a situation where my Fight menu for battles doesn't properly wrap back to the top-most when I input DOWN at the bottom-most move.

    This is the code I'm currently using:

    Code:
    if Input.trigger?(Input::UP)
            cw.index -= 1
            if cw.index<Pokemon::MAX_MOVES && cw.index>=battler.pokemon.numMoves
              cw.index = battler.pokemon.numMoves-1
            end
            cw.index = 0 if cw.index>=Pokemon::MAX_MOVES
            cw.index = battler.pokemon.numMoves-1 if cw.index<0
          elsif Input.trigger?(Input::DOWN)
            cw.index += 1
            cw.index = 0 if cw.index<Pokemon::MAX_MOVES && cw.index>=battler.pokemon.numMoves
            cw.index = 0 if cw.index==Pokemon::MAX_MOVES
            cw.index = Pokemon::MAX_MOVES if cw.index<0
          end

    and this is the error I'm getting:

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.0.1]

    Exception: NoMethodError
    Message: undefined method `total_pp' for nil:NilClass

    Backtrace:
    388:SU SceneMenus:368:in `refreshMoveData'
    388:SU SceneMenus:351:in `refreshSelection'
    388:SU SceneMenus:394:in `refresh'
    388:SU SceneMenus:64:in `index='
    390:SU SceneCommands:104:in `block in pbFightMenu'
    390:SU SceneCommands:78:in `loop'
    390:SU SceneCommands:78:in `pbFightMenu'
    182:Battle_Phase_Command:67:in `pbFightMenu'
    182:Battle_Phase_Command:215:in `block (2 levels) in pbCommandPhaseLoop'
    182:Battle_Phase_Command:206:in `loop'
     
    Back
    Top