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

[Scripting Question] How do I check if a Pokemon is NOT Wishiwashi using code?

429
Posts
4
Years
  • if isSpecies?(:WISHIWASHI) && self.ability == :SCHOOLING
    if @level>=20 && @hp>@totalhp/4
    if @form!=1
    @battle.pbShowAbilitySplash(self,true)
    @battle.pbHideAbilitySplash(self)
    pbChangeForm(1,_INTL("{1} formed a school!",pbThis))
    end
    elsif @form!=0
    @battle.pbShowAbilitySplash(self,true)
    @battle.pbHideAbilitySplash(self)
    pbChangeForm(0,_INTL("{1} stopped schooling!",pbThis))
    end
    end

    That's the code Wishiwashi uses to determine if it's Wishiwashi and if it has the ability Schooling.

    I had this idea where the code could then check if the user is NOT Wishiwashi but has this ability anyway, and if that's the case, boost the user's stats. And if the user's HP drops to the point where Wishiwashi's Schooling ability would deactivate, remove the boosted stat effect. It'd have to be a less severe stat boost, but I can playtest the numbers and figure out how reduced the stat-buff should be once the code works.
     
    Last edited:
    772
    Posts
    13
    Years
    • UK
    • Seen May 7, 2024
    To check for if it's not you need to use ! At the beginning

    Code:
    !isSpecies?(:WISHIWASHI)

    You could also modify your code so that there's an "elsif self.ability == :SCHOOLING" on the if isSpecies?(:WISHIWASHI) && self.ability == :SCHOOLING

    i.e.

    Code:
    if isSpecies?(:WISHIWASHI) && self.ability == :SCHOOLING
        # Is Wishiwashi & has schooling ability
    elsif self.ability == :SCHOOLING
        # Isn't Wishiwashi but has schooling ability
    end
     
    Last edited:
    429
    Posts
    4
    Years
  • Thank you! Right now there's an error keeping the game from turning on.

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.1.0]
    [v19.1 Hotfixes 1.0.7]

    Exception: ArgumentError
    Message: invalid byte sequence in UTF-8

    Backtrace:
    368:Compiler:105:in `[]'
    368:Compiler:105:in `block in pbEachFileSectionEx'
    368:Compiler:100:in `each_line'
    368:Compiler:100:in `pbEachFileSectionEx'
    368:Compiler:134:in `pbEachFileSection'
    369:Compiler_CompilePBS:389:in `block in compile_pokemon'
    369:Compiler_CompilePBS:383:in `open'
    369:Compiler_CompilePBS:383:in `compile_pokemon'
    368:Compiler:704:in `compile_all'
    [v19.1 Hotfixes] Debug bug fixes.rb:68:in `compile_all'

    I've looked at the text the error message speaks of, and nothing appears out of the ordinary. There are no coding errors in the PBS. I've seen this error before and fixed it by copypasting over a backup copy of the problem file from a backup of my work, from before I made any changes to these files. Does Wordpad do something UTF-8 doesn't like? Because right now it seems these files cannot be edited in any way at all without making the entire game unable to run.
     
    772
    Posts
    13
    Years
    • UK
    • Seen May 7, 2024
    Try using an editor like notepad++ (on windows) or Xcode (on Mac) and see if there's a character added to the start of the file. I've found some editors do this
     
    429
    Posts
    4
    Years
  • Thank you, Notepad++ seems a lot better. What file was causing the error there?

    [Pokémon Essentials version 19.1]
    [Generation 8 Project v1.1.0]
    [v19.1 Hotfixes 1.0.7]

    Exception: ArgumentError
    Message: invalid byte sequence in UTF-8

    Backtrace:
    368:Compiler:105:in `[]'
    368:Compiler:105:in `block in pbEachFileSectionEx'
    368:Compiler:100:in `each_line'
    368:Compiler:100:in `pbEachFileSectionEx'
    368:Compiler:134:in `pbEachFileSection'
    369:Compiler_CompilePBS:389:in `block in compile_pokemon'
    369:Compiler_CompilePBS:383:in `open'
    369:Compiler_CompilePBS:383:in `compile_pokemon'
    368:Compiler:704:in `compile_all'
    [v19.1 Hotfixes] Debug bug fixes.rb:68:in `compile_all'
     
    Last edited:
    772
    Posts
    13
    Years
    • UK
    • Seen May 7, 2024
    Looks like its your Pokémon.txt that has issues, though it may be in more depending on if you've edited any others.
     
    Back
    Top