- 148
- Posts
- 11
- Years
- Upstate New York
- Seen Sep 5, 2023
Like the title says, I'm trying to make an ability that gives the pokemon a boost when it switches in depending on the level of the opponent. Keep getting an error.
Plan to make different effects for levels 20, 30, 40, etc...
The Error
---------------------------
Pokemon Essentials
---------------------------
Exception: RuntimeError
Message: Script error within event 18, map 48 (Justin's Rout 1):
Exception: NameError
Message: Section064:842:in `pbAbilitiesOnSwitchIn'undefined local variable or method `opponent' for #<PokeBattle_Battler:0x8489360>
***Full script:
pbTrainerBattle(PBTrainers::BEGINNER,"Ash",_I("How are you so tough!?"),false,0,false)
Interpreter:243:in `pbExecuteScript'
PokeBattle_Battle:2055:in `pbOnActiveAll'
PokeBattle_Battle:2054:in `each'
PokeBattle_Battle:2054:in `pbOnActiveAll'
PokeBattle_Battle:2880:in `pbStartBattleCore'
PokeBattle_Battle:2674:in `pbStartBattle'
PokemonTrainers:426:in `pbTrainerBattle'
PokemonTrainers:425:in `pbSceneStandby'
PokemonTrainers:427:in `pbTrainerBattle'
PokemonTrainers:424:in `pbBattleAnimation'
Interpreter:276:in `pbExecuteScript'
Interpreter:788:in `command_111'
Interpreter:320: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'
I figure it has something to do with the "if opponent.level<=1" line, but I don't know how to tell by reading the error. Any help would be great.
Code:
if isConst?(opponent.ability,PBAbilities,:FATHERSBOND) && if opponent.level<=1 #Level Greater then 1
if opponent.pbCanIncreaseStatStage?(PBStats::DEFENSE)
opponent.pbIncreaseStatBasic(PBStats::DEFENSE,1)
@battle.pbCommonAnimation("StatUp",opponent,nil)
@battle.pbDisplay(_INTL("{1} detected a minor threat to his child",
opponent.pbThis,PBAbilities.getName(opponent.ability)))
end
end
end
Plan to make different effects for levels 20, 30, 40, etc...
The Error
Spoiler:
---------------------------
Pokemon Essentials
---------------------------
Exception: RuntimeError
Message: Script error within event 18, map 48 (Justin's Rout 1):
Exception: NameError
Message: Section064:842:in `pbAbilitiesOnSwitchIn'undefined local variable or method `opponent' for #<PokeBattle_Battler:0x8489360>
***Full script:
pbTrainerBattle(PBTrainers::BEGINNER,"Ash",_I("How are you so tough!?"),false,0,false)
Interpreter:243:in `pbExecuteScript'
PokeBattle_Battle:2055:in `pbOnActiveAll'
PokeBattle_Battle:2054:in `each'
PokeBattle_Battle:2054:in `pbOnActiveAll'
PokeBattle_Battle:2880:in `pbStartBattleCore'
PokeBattle_Battle:2674:in `pbStartBattle'
PokemonTrainers:426:in `pbTrainerBattle'
PokemonTrainers:425:in `pbSceneStandby'
PokemonTrainers:427:in `pbTrainerBattle'
PokemonTrainers:424:in `pbBattleAnimation'
Interpreter:276:in `pbExecuteScript'
Interpreter:788:in `command_111'
Interpreter:320: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'
I figure it has something to do with the "if opponent.level<=1" line, but I don't know how to tell by reading the error. Any help would be great.