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

Using Rare Candy Script

65
Posts
9
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?
     
    1,224
    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)

    How would the interpreter know what pokemon is?
     
    65
    Posts
    9
    Years
  • 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)"
     
    1,224
    Posts
    10
    Years
  • 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).
     
    65
    Posts
    9
    Years
  • 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'
     
    1,224
    Posts
    10
    Years
  • 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