• 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.
  • 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • 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.

[Eventing Question] Checking for Abilities

  • 4
    Posts
    6
    Years
    • Seen Jan 16, 2021
    Is there a way to check if a pokemon in the party has a specific ability through an event, the same way you can check for moves with a conditional branch?

    If not, how can I define a method to do so? I guess finding where the method for checking moves is, and using it as a sheet to make one checking abilities would work, but I don't know where that is located.
     
    I did something like this recently to have an event check for a certain held item. Use CTRL+SHIFT +F to search for "def pbCheckMove" and try imitating that script.
     
    def hasAbility?(value=0)
    if value==0
    return self.ability>0
    else
    if value.is_a?(String) || value.is_a?(Symbol)
    value=getID(PBAbilities,value)
    end
    return self.ability==value
    end
    return false
    end


    So I found this code, but I don't know how to make it check for specific ability in a pokemon that's in the party using the conditional branches. Can someone more experienced in coding help?
     
    Try this as the script for your conditional branch:
    Code:
    for i in 0..$Trainer.party.length
    	return $Trainer.party[i].hasAbility?(:INTIMIDATE)
    return false
    end
    replacing Intimidate with whatever ability you want to check for.
     
    Back
    Top