• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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] "Set Tailwind When Sent Out" ability code crashes game with nonsense error message. Who can help me fix this?

  • 428
    Posts
    5
    Years
    Code:
    Battle::AbilityEffects::OnSwitchIn.add(:STORMWIND,
      proc { |ability, battler, battle, switch_in|
    battler.pbOwnSide.effects[PBEffects::Tailwind] = 5
        @battle.pbDisplay(_INTL("Tailwind intensified!"))
      }
    )

    Everything seems fine to me, but is it fine? It's crashing the game any time anyone with this ability gets sent out. It's supposed to set Tailwind when your Pokemon is sent out, and be to Tailwind what Drought is for Sunny Day: An automatic use of that move in ability form.

    If it helps, here's the error message:

    Code:
    [Pokémon Essentials version 20.1]
    [v20.1 Hotfixes 1.0.4]
    
    Exception: NoMethodError
    Message: undefined method `[]=' for true:TrueClass
    
    Backtrace:
    [Essentials Deluxe] Pokedex.rb:332:in `register'
    [ZUD Mechanics] Battle_Overrides.rb:58:in `pbSetSeen'
    151:Battle_ActionSwitching:293:in `block in pbSendOut'
    151:Battle_ActionSwitching:291:in `each'
    151:Battle_ActionSwitching:291:in `pbSendOut'
    148:Battle_StartAndEnd:240:in `block in pbStartBattleSendOut'
    148:Battle_StartAndEnd:197:in `each'
    148:Battle_StartAndEnd:197:in `pbStartBattleSendOut'
    148:Battle_StartAndEnd:284:in `pbStartBattleCore'
    148:Battle_StartAndEnd:270:in `pbStartBattle'
     
    Update: Adding another = didn't fix it.

    Code:
    Battle::AbilityEffects::OnSwitchIn.add(:STORMWIND,
      proc { |ability, battler, battle, switch_in|
    battler.pbOwnSide.effects[PBEffects::Tailwind] == 5
        @battle.pbDisplay(_INTL("Tailwind intensified!"))
      }
    )
     
    This error has absolutely nothing to do with your ability. The error is occurring because you didn't follow the instructions when installing Essentials Deluxe, and didn't start a new game like you were supposed to.

    Also, you only want a single equation sign for your ability. The way you originally had it was correct. Also, remove the @ in front of @battle.
     
    Back
    Top