• 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.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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!
  • 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.

[Scripting Question] Ability Contrary crashes the game

  • 37
    Posts
    6
    Years
    • Seen Jul 25, 2020
    In a battle in my game the opponent has an inkay with contrary, i tested against him arcanine but the game crashes
     
    You're gonna have to post the whole error message to have any hopes of getting help.
     
    so this is the error message:
    Code:
    ---------------------------
    Pokemon G
    ---------------------------
    Exception: RuntimeError
    
    Message: Script error within event 3, map 36 (Tetto Arceus Re):
    
    Exception: NameError
    
    Message: Section077:1016:in `pbReduceAttackStatStageIntimidate'undefined local variable or method `attacker' for #<PokeBattle_Battler:0xc2dfb50>
    
    ***Full script:
    
    pbTrainerBattle(PBTrainers::LEADER_Misty,"Pseudo",_I("Acc..."),false,0,false)
    
    Interpreter:243:in `pbExecuteScript'
    
    PokeBattle_Battler:1160:in `pbAbilitiesOnSwitchIn'
    
    PokeBattle_Battler:1158:in `each'
    
    PokeBattle_Battler:1158:in `pbAbilitiesOnSwitchIn'
    
    PokeBattle_Battle:2362:in `pbOnActiveAll'
    
    PokeBattle_Battle:2361:in `each'
    
    PokeBattle_Battle:2361:in `pbOnActiveAll'
    
    PokeBattle_DynamicBattle:183:in `pbStartBattleCore'
    
    PokeBattle_Battle:2602:in `pbStartBattle'
    
    PTrainer_NPCTrainers:497:in `pbTrainerBattle'
    
    
    
    Interpreter:276:in `pbExecuteScript'
    
    Interpreter:794: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'


    The thing i just noticed is that the most of the 6/7 gen abilities are not working: this one crashes but for example galvanize doesnt make the game crashing but doesnt change the normal moves to electric type
     
    Yeah well this error seems reasonable to me. At least in my copy of Essentials pbReduceAttackStateStageIntimidate only takes opponent as a parameter. What even is an attacker in the context of "opponent's attack stat being reduced by Intimidate"?

    It's possible that "self" might be what you want instead of "attacker", I guess that this is the Pokémon who has Intimidate.
     
    Yeah well this error seems reasonable to me. At least in my copy of Essentials pbReduceAttackStateStageIntimidate only takes opponent as a parameter. What even is an attacker in the context of "opponent's attack stat being reduced by Intimidate"?

    It's possible that "self" might be what you want instead of "attacker", I guess that this is the Pokémon who has Intimidate.

    I'm not really good about scripts, can you explain me a bit easier how to solve this problem? or maybe a link to working 6/7 gen abilities because a lot of them don't work(for example also galvanize and grass pelt)
     
    I'm not really good about scripts, can you explain me a bit easier how to solve this problem? or maybe a link to working 6/7 gen abilities because a lot of them don't work(for example also galvanize and grass pelt)

    Code:
    Section077:1016:in `pbReduceAttackStatStageIntimidate'undefined local variable or method `attacker' for #<PokeBattle_Battler:0xc2dfb50>

    This says "attacker" doesn't exist on line 1016 of your script. Try replacing "attacker" with "self". But I have no idea if this will work, because obviously I can't see your code.

    As for links to abilities, I'm afraid I have no idea where to find them. Maybe try asking on the Discord?
     
    Last edited:
    Thank you, now contrary works correctly, but now i have to solve the problem with like 70 other abilities
     
    Thank you, now contrary works correctly, but now i have to solve the problem with like 70 other abilities
    If you're going to work on editing abilities or scripts or adding anything into the scripts in general I'd highly recommend doing them one at a time, especially if you're not comfortable with scripting yet. It's extremely easy to lose track of things you've changed when you're not aware of everything you're doing and it could lead to your game having unfixable errors later on or force you to back track and undo current progress with your game. Just something to be careful about.
     
    • Like
    Reactions: Poq

    If you're going to work on editing abilities or scripts or adding anything into the scripts in general I'd highly recommend doing them one at a time, especially if you're not comfortable with scripting yet. It's extremely easy to lose track of things you've changed when you're not aware of everything you're doing and it could lead to your game having unfixable errors later on or force you to back track and undo current progress with your game. Just something to be careful about.
    I am, i've backuped scripts and i test every ability one by one
     
    Back
    Top