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

Ability Capsule allows learning Hidden Abilities

  • 137
    Posts
    7
    Years
    I have some upcoming updates to my game (Pokémon Zero, check it out) and thought I'd share something I've worked on. Ability Capsules also offer the choice of switching to a Hidden Ability.

    How it works is this:
    If a Pokémon has only one Ability choice (e.g. Metapod), then it won't have any effect.
    If it has two choices (e.g. Charmeleon), then it will ask if you want to switch to the other one.
    If it has more than two (e.g. Makuhita), then it will ask you which of the other abilities you would like to switch to, or give you the option to cancel.

    I've tested this quickly, but do let me know if you find any issues. Simply replace the whole block that starts
    Code:
    ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
    with the code block below. Hopefully this is useful to someone!

    Code:
    ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pokemon,scene|
       abils=pokemon.getAbilityList
       if abils.length==1 # Pokemon only has one possible Ability, e.g. Metapod
         scene.pbDisplay(_INTL("It won't have any effect."))
         next false
       elsif abils.length==2 # Ask to switch to the only other Ability
         newabil=abils.find{|a| a[0]!=pokemon.ability}
         newabilid=newabil[0]
         newabilname=PBAbilities.getName(newabilid)
         if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
                            pokemon.name,newabilname))
           newabilindex=newabil[1]
           pokemon.setAbility(newabilindex)
           scene.pbRefresh
           scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
              PBAbilities.getName(pokemon.ability)))
           next true
         end
       else
         commands = []
         abilindices = []
         for i in abils # List every other possible Ability for this mon and ask to choose one
           if i[1]!=pokemon.abilityIndex
             commands.push(PBAbilities.getName(i[0]))
             abilindices.push(i[1])
           end
         end
         commands.push("Cancel")
         msg = _INTL("Which Ability should {1} learn?",pokemon.name)
         cmd = scene.pbShowCommands(msg,commands)
         if cmd>=0 && cmd<commands.length-1
           chosenabilindex=abilindices[cmd]
           pokemon.setAbility(chosenabilindex)
           scene.pbRefresh
           scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pokemon.name,
                          PBAbilities.getName(pokemon.ability)))
           next true
         end
       end
       next false
    })
     
    Last edited:
    Back
    Top