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

Error when trainer tries to use an item

yonicstudios

Game Developer
54
Posts
8
Years
  • On Essentials 16.2, when a trainer tries to use one of the items specified on its PBS file, an error occurs.

    Code:
    Exception: NoMethodError
    
    Message: undefined method `>=' for nil:NilClass
    
    PokeBattle_Battle:1609:in `pbRegisterItem'
    
    PokeBattle_AI:3767:in `pbEnemyShouldUseItem?'
    
    PokeBattle_AI:4056:in `pbDefaultChooseEnemyCommand'
    
    PokeBattle_Scene:2747:in `pbChooseEnemyCommand'
    
    PokeBattle_Battle:2738:in `pbCommandPhase_ebs'
    
    PokeBattle_Battle:2733:in `each'
    
    PokeBattle_Battle:2733:in `pbCommandPhase_ebs'
    
    EliteBattle_Battle:292:in `pbCommandPhase'
    
    EliteBattle_Battle:222:in `pbStartBattleCore'
    
    EliteBattle_Battle:221:in `logonerr'
    I think this is because idxTarget, a parameter of the method pbEnemyShouldUseItem? (in PokéBattle_AI), is nil by default and is passed as nil in pbRegisterItem (in PokéBattle_Battle).

    But I don't know how to solve this error.

    The items are specified as follows in the PBS file, just in case I've made a mistake there:

    Code:
    POKEMANIAC
    Hubert
    6,FULLRESTORE,FULLRESTORE,FULLRESTORE,FULLRESTORE
    ZUBAT,15,,SCREECH,GROWL,,,0
    ZUBAT,15,,SCREECH,GROWL,,,0
    ZUBAT,15,,SCREECH,GROWL,,,0
    ZUBAT,15,,SCREECH,GROWL,,,0
    ZUBAT,15,,SCREECH,GROWL,,,0
    ZUBAT,15,,SCREECH,GROWL,,,0
     
    Last edited:
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    I'm not sure if it's the exact same, but I used to get an error with trainer using items when I thought I had a clean, unmodified 16.2. It wasn't clean and definitely not 16.2 Are you sure you're on the latest version?
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • My money is on them using a difficulty modifier (game mode) script. Probably the one by Shiney570. That one seems to bug out the game AI.
     

    yonicstudios

    Game Developer
    54
    Posts
    8
    Years
  • My money is on them using a difficulty modifier (game mode) script. Probably the one by Shiney570. That one seems to bug out the game AI.

    No, I haven't added any scripts that modify the vanilla battle system, apart from Elite Battle System, but that doesn't change anything regarding to where the error is.
    Although I did alter some of the vanilla battle scripts to add some features, I've never touched the AI parts of the code. I even made a diff of the original 16.0 Essentials scripts vs the one in my project and the scripts regarding the methods I've mentioned and they are identical.


    M3rein said:
    I'm not sure if it's the exact same, but I used to get an error with trainer using items when I thought I had a clean, unmodified 16.2. It wasn't clean and definitely not 16.2 Are you sure you're on the latest version?

    I am 100% sure that it is version 16.2 as I always make a version.txt file with the version of Essentials everytime I update.

    EDIT: Well this is weird. I downloaded a new unmodified 16.2 patch and it's a bit different. Maybe I replaced the 16.2 scripts with the 16.0 version by accident.
     
    Last edited:
    971
    Posts
    7
    Years
    • Age 21
    • Seen Nov 28, 2022
    I am 100% sure that it is version 16.2 as I always make a version.txt file with the version of Essentials everytime I update.

    I don't necessarily doubt, but are you sure that when you update, you update properly, according to the wikia?
     

    yonicstudios

    Game Developer
    54
    Posts
    8
    Years
  • I don't necessarily doubt, but are you sure that when you update, you update properly, according to the wikia?

    Yes, although it was a bit simpler because I had started with 16.0 and then inmediately after updated to 16.2. But now that I recall, I remember that I had a time in which some of my custom scripts were lost because I had accidentally replaced a Script file while solving an issue with the editor scripts. That might probably have been when the 16.0 scripts got mixed in.

    I guess I'll have to manually update the scripts.
     
    Back
    Top