• 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!
  • Cyndy, May, Hero (Conquest), or Wes - 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.

Using Rare Candy Script

  • 65
    Posts
    10
    Years
    I was trying to make an event where the player's pokémon level up by 1, just like Rare Candy. So I thought that using this script would work.
    Code:
    pbChangeLevel(pokemon,pokemon.level+1,scene)
    But I'm getting this error:

    Exception: RuntimeError

    Message: Script error within event 4, map 5 (Rota 31):

    Exception: NameError

    Message: (eval): 1 :in `pbExecuteScript'undefined local variable or method `pokemon' for #<Interpreter:0xae17ec8>

    ***Full script:

    pbChangeLevel(pokemon,pokemon.level+1,scene)


    Interpreter:243:in `pbExecuteScript'

    Interpreter:1606:in `eval'

    Interpreter:243:in `pbExecuteScript'

    Interpreter:1606: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'



    Interpreter:276:in `pbExecuteScript'

    Interpreter:1606: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'

    Any ideas how to solve this problem?
     
    I was trying to make an event where the player's pokémon level up by 1, just like Rare Candy. So I thought that using this script would work.
    Code:
    pbChangeLevel(pokemon,pokemon.level+1,scene)
    But I'm getting this error:

    Exception: RuntimeError

    Message: Script error within event 4, map 5 (Rota 31):

    Exception: NameError

    Message: (eval): 1 :in `pbExecuteScript'undefined local variable or method `pokemon' for #<Interpreter:0xae17ec8>

    ***Full script:

    pbChangeLevel(pokemon,pokemon.level+1,scene)

    How would the interpreter know what pokemon is?
     
    It's not like I got this error and started this thread, I tried replacing the "pokemon" with an species, like Eevee for example.
    Like pbChangeLevel(EEVEE,EEVEE.level+1,scene)

    But got this error:
    Exception: RuntimeError

    Message: Script error within event 4, map 5:

    Exception: NameError

    Message: (eval):1 :in `pbExecuteScript'uninitialized constant Interpreter::EEVEE

    ***Full script:

    pbChangeLevel(EEVEE,EEVEE.level+1,scene)

    Also, this script is in a conditional branch "pbHasSpecies?(:EEVEE)"
     
    It's not like I got this error and started this thread, I tried replacing the "pokemon" with an species, like Eevee for example.
    Like pbChangeLevel(EEVEE,EEVEE.level+1,scene)

    But got this error:
    Exception: RuntimeError

    Message: Script error within event 4, map 5:

    Exception: NameError

    Message: (eval):1 :in `pbExecuteScript'uninitialized constant Interpreter::EEVEE

    ***Full script:

    pbChangeLevel(EEVEE,EEVEE.level+1,scene)

    Also, this script is in a conditional branch "pbHasSpecies?(:EEVEE)"

    A species isn't a pokemon. You need a specific pokemon, an actual instance of PokeBattle_Pokemon.
    For instance, $Trainer.party[0] is a pokemon (provided you have one).
     
    Oh, I see now, I was questioning myself how the script would know what member of your party to raise level or if it would raise the level of the entire party.

    Okay, now I have the same error with "scene", and I don't really understand what this "scene" means. Using my few knowledge on RPG Maker, I tried using "$scene_map".

    But got this error:

    Exception: RuntimeError

    Message: Script error within event 4, map 5:

    Exception: NoMethodError

    Message: Section097:655:in `pbChangeLevel'undefined method `pbRefresh' for nil:NilClass

    ***Full script:

    pbChangeLevel($Trainer.party[0],$Trainer.party[0].level+1,$scene_map)


    Interpreter:243:in `pbExecuteScript'

    (eval): 1 :in `pbExecuteScript'

    Interpreter:1606:in `eval'

    Interpreter:243:in `pbExecuteScript'

    Interpreter:1606: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'



    Interpreter:276:in `pbExecuteScript'

    Interpreter:1606: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'
     
    Oh, I see now, I was questioning myself how the script would know what member of your party to raise level or if it would raise the level of the entire party.

    Okay, now I have the same error with "scene", and I don't really understand what this "scene" means. Using my few knowledge on RPG Maker, I tried using "$scene_map".

    But got this error:

    Exception: RuntimeError

    Message: Script error within event 4, map 5:

    Exception: NoMethodError

    Message: Section097:655:in `pbChangeLevel'undefined method `pbRefresh' for nil:NilClass

    ***Full script:

    pbChangeLevel($Trainer.party[0],$Trainer.party[0].level+1,$scene_map)


    Interpreter:243:in `pbExecuteScript'

    (eval): 1 :in `pbExecuteScript'

    Interpreter:1606:in `eval'

    Interpreter:243:in `pbExecuteScript'

    Interpreter:1606: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'



    Interpreter:276:in `pbExecuteScript'

    Interpreter:1606: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'

    Because the method you're using is meant to be used in the party scene. Make that line where the error occurs

    Code:
    scene.pbRefresh if scene!=nil

    and make your call

    pbChangeLevel($Trainer.party[0],$Trainer.party[0].level+1,nil)

    $scene_map isn't anything. $scene can often refer to an instance of Scene_Map, but that's neither here nor there.
     
    Back
    Top