• 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!
  • Akari, Red, Kris, May - which Pokémon protagonist is your favorite? Let us know by voting in our semifinal favorite protagonist 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.

[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
    5
    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
     
    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.
     
    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