• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our 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.

Encounter Modifier Error

Sero

私はセクシーです
  • 82
    Posts
    16
    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.
     
    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.
     
    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.
     
    Thanks. I copied and pasted from the wiki and it had poke.setAbility,but it works now.
     
    Back
    Top