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

[Question] Can someone please help me? For some reason whenever I try to battle a trainer this error comes up. Did I mess something up I shouldn´t?

  • 19
    Posts
    4
    Years
    • Seen Oct 27, 2023
    ---------------------------
    Pokemon Control and Freedom
    ---------------------------
    [Pokémon Essentials version 18.1]

    Exception: NameError

    Message: undefined local variable or method `i' for #<PokeBattle_AI:0xd79bde8>



    Backtrace:

    AI_Move_Utilities:307:in `pbRoughDamage'

    AI_Move:255:in `pbGetMoveScoreDamage'

    AI_Move:232:in `pbGetMoveScore'

    AI_Move:127:in `pbRegisterMoveTrainer'

    AI_Move:125:in `eachBattler'

    PokeBattle_Battle:421:in `each'

    PokeBattle_Battle:421:in `eachBattler'

    AI_Move:125:in `pbRegisterMoveTrainer'

    AI_Move:22:in `pbChooseMoves'

    AI_Move:17:in `eachMoveWithIndex'



    This exception was logged in

    C:\Users\USERNAME\Saved Games\Pokemon Control and Freedom\errorlog.txt.

    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK
    ---------------------------


    I would be glad if someone could help me with this. I´ve been working on my game for 4 years now and I really don´t want to let it all go to waste
     
  • 1,411
    Posts
    10
    Years
    • Online now
    Lol wait, you've been working on it for 4 years and fear having to toss all of that work out just because you can't solve a simple definition error? Surely you've picked up on some basic things by now, even if you aren't proficient at coding. Just read the error, the issue is just that you didn't properly define "i" in the pbRoughDamage method. You were probably messing about with the AI and overlooked something. Just go back and undo your changes if you can't specify the exact location of the error.
     
  • 429
    Posts
    4
    Years
    Just copypaste unedited AI data over your changed version from an unchanged recently-downloaded copy of Pokemon Essentials, replacing the code causing problems with unedited code, and then set all enemy trainers to use the hardest AI.
     
    Back
    Top