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

Encounter Modifier Error

Sero

私はセクシーです
82
Posts
15
Years
  • I'm trying to set up a battle with a Darmanitan w/ zen mode but each time I turn on the switch to activate the modifier, I get this error:

    Code:
    ---------------------------
    Pokémon
    ---------------------------
    Exception: RuntimeError
    
    Message: Script error within event 1, map 113 (Raiken Mountain):
    
    Exception: NameError
    
    Message: Section086:26undefined local variable or method `poke' for nil:NilClass
    
    ***Full script:
    
    pbWildBattle(PBSpecies::DARMANITAN,25,18,true,false)
    
    
    Interpreter:243:in `pbExecuteScript'
    
    PokemonEncounterModifiers:23:in `call'
    
    PBEvent:54:in `trigger'
    
    PBEvent:49:in `each'
    
    PBEvent:49:in `trigger'
    
    PokemonField:928:in `pbGenerateWildPokemon'
    
    PokemonField:952:in `pbWildBattle'
    
    (eval):1:in `pbExecuteScript'
    
    Interpreter:1599:in `eval'
    
    Interpreter:243:in `pbExecuteScript'
    
    
    
    Interpreter:276:in `pbExecuteScript'
    
    Interpreter:1599:in `command_355'
    
    Interpreter:494:in `execute_command'
    
    Interpreter:193:in `update'
    
    Interpreter:106:in `loop'
    
    Interpreter:198:in `update'
    
    Scene_Map:103:in `update'
    
    Scene_Map:101:in `loop'
    
    Scene_Map:114:in `update'
    
    Scene_Map:68:in `main'
    
    
    
    This exception was logged in 
    
    C:\Users\KwesiD\Saved Games/Pokémon/errorlog.txt.
    
    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK   
    ---------------------------

    It works fine without the modifier switch.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    So you've added some code that causes an error, but you won't show us that code to actually let us help?
     

    Sero

    私はセクシーです
    82
    Posts
    15
    Years
  • Sorry.
    I called the battle using pbWildBattle(PBSpecies::DARMANITAN,25,18,true,false) and in PokemonEncounterModifiers I added
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       pokemon=e[0]
       if $game_switches[66]
         poke.setAbility(2)
       end
    }

    I also tried the shiny modifier that uses switch #30 that was already in essentials and it works without any problems.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Sorry.
    I called the battle using pbWildBattle(PBSpecies::DARMANITAN,25,18,true,false) and in PokemonEncounterModifiers I added
    Code:
    Events.onWildPokemonCreate+=proc {|sender,e|
       [COLOR=Red]pokemon[/COLOR]=e[0]
       if $game_switches[66]
         [COLOR=Red]poke[/COLOR].setAbility(2)
       end
    }
    I also tried the shiny modifier that uses switch #30 that was already in essentials and it works without any problems.
    Those two red words should be the same.
     

    Sero

    私はセクシーです
    82
    Posts
    15
    Years
  • Thanks. I copied and pasted from the wiki and it had poke.setAbility,but it works now.
     
    Back
    Top