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

[Error] Help with the Battle Tower

  • 13
    Posts
    4
    Years
    • Seen Sep 9, 2023
    Hi everyone,

    I was trying to use the battle tower and found this error when trying to start a challenge in essentials v18. I tested this in a base essentials project and the error happened there as well. I'm very inexperienced with scripting so I was wondering if there is an easy fix to this.

    The error log is below:

    [Pokémon Essentials version 18.1]
    Exception: RuntimeError
    Message: Script error within event 4 (coords 16,3), map 55 (Battle Tower):
    Exception: NameError
    Message: PBattle_OrgBattle:489:in `start'undefined local variable or method `t' for #<BattleChallenge:0xd6886d0>

    ***Full script:
    pbBattleChallenge.start(0,7)


    Backtrace:
    Interpreter:197:in `pbExecuteScript'
    (eval):1:in `pbExecuteScript'
    Interpreter:1458:in `eval'
    Interpreter:197:in `pbExecuteScript'
    Interpreter:1458:in `command_355'
    Interpreter:359:in `execute_command'
    Interpreter:155:in `update'
    Interpreter:102:in `loop'
    Interpreter:158:in `update'
    Scene_Map:162:in `update'


    Backtrace:
    Interpreter:246:in `pbExecuteScript'
    Interpreter:1458:in `command_355'
    Interpreter:359:in `execute_command'
    Interpreter:155:in `update'
    Interpreter:102:in `loop'
    Interpreter:158:in `update'
    Scene_Map:162:in `update'
    Scene_Map:160:in `loop'
    Scene_Map:169:in `update'
    Scene_Map:229:in `main'

    Any help would be appreciated.
     
    Hi everyone,

    I was trying to use the battle tower and found this error when trying to start a challenge in essentials v18. I tested this in a base essentials project and the error happened there as well. I'm very inexperienced with scripting so I was wondering if there is an easy fix to this.

    The error log is below:
    <Error>

    Any help would be appreciated.

    Well, I don't really have too much time to dig into it and test it myself, but here are my thoughts when I read the error and the code.
    In the file PBattle_OrgBattle, find the class:
    Code:
    class BattleChallenge
    and find the function:
    Code:
      def start(*args)
        ensureType(@id)
        @currentChallenge=@id   # must appear before pbStart
        @bc.pbStart(t,@numRounds)
      end
    According to the usage of pbStart, the missing variable "t" should be an instance of BattleChallengeType, which is returned by ensureType().
    So the correct code must be:
    Code:
      def start(*args)
        t = ensureType(@id) # HERE
        @currentChallenge=@id   # must appear before pbStart
        @bc.pbStart(t,@numRounds)
      end
    Hope that helps.
     
    I tested this fix in the base essentials project and it worked. The battle tower isn't crashing anymore.

    Thanks for the help.
     
    Back
    Top