• The Eevee Expo Game Jam #10 has concluded, congratulations to all participants! Now it's time for the judges to play through the games, and you can play along to vote who deserves the community choice spotlight.
    You can check out the submitted games here!
    Play through the games and provide some feedback to the devs while you're at it!
  • Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Ability Capsule & Ability Patch for Essentials v15

Ability Capsule & Ability Patch for Essentials v15 1.0.0

Pokémon Essentials Version
Pre-v16.2 ➖
To get this working, complete the following steps:

0. Make sure "Hide extensions for known file types" is disabled in File Explorer settings (if you don't know how to do this, there are many places online that can help; it is not within the scope of these instructions for me to explain how).

1. Download the ABILITYCAPSULE.png and ABILITYPATCH.png files from my Google Drive, then rename them to the first 2 unused item numbers in your \Graphics\Icons\ folder. For example, in stock Essentials v15, the last used item ID is 525 (item525.png is the last icon before itemBack.png in \Graphics\Icons\ there), so the first unused items are 526 and 527. In that case, you would rename ABILITYCAPSULE.png to item526.png and ABILITYPATCH.png to item527.png

2. In Script Editor, navigate to the PokeBattle_Pokemon and search for "def setAbility(value)" (without quotes). In the first blank section below the only result, insert the following code:
Ruby:
Expand Collapse Copy
  # @return [Boolean] whether this Pokémon has a hidden ability
  def hasHiddenAbility?
    return abilityIndex >= 2
  end

3. Now go to PokemonItemEffects and search for "UseInField handlers". At the end of the section above it (this will be different for everyone if custom items were already added; normally, in stock Essentials v15, it'll be the section for DNA Splicers), insert the following code:
Ruby:
Expand Collapse Copy
ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc{|item,pkmn,scene|
  abils = pkmn.getAbilityList
  abil1 = nil; abil2 = nil
  dexdata=pkmn.ability.pbOpenDexData
  pkmn.ability.pbDexDataOffset(dexdata,pkmn.species,29)
  abil1 = dexdata.fgetb
  abil2 = dexdata.fgetb
  dexdata.close
  if abil2.nil? || abil2 == 0 || pkmn.hasHiddenAbility? || pkmn.species == 718
    scene.pbDisplay(_INTL("It won't have any effect."))
    next false
  end
  newabil = (pkmn.abilityIndex + 1) % 2
  if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability?",pkmn.name))
    pkmn.setAbility(newabil)
    scene.pbRefresh
    scene.pbDisplay(_INTL("{1}'s Ability changed to its other Ability!",pkmn.name))
    next true
  end
  next false
})

ItemHandlers::UseOnPokemon.add(:ABILITYPATCH,proc{|item,pkmn,scene|
  current_abil = pkmn.abilityIndex
  normal_abil = pkmn.personalID&1
  dexdata=pkmn.ability.pbOpenDexData
  pkmn.ability.pbDexDataOffset(dexdata,pkmn.species,40)
  hidden_abil=dexdata.fgetb
  dexdata.close
  if hidden_abil > 0 && current_abil<2
    if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability?",pkmn.name))
        pkmn.setAbility(2)
      scene.pbDisplay(_INTL("{1}'s Ability changed to its Hidden Ability!", pkmn.name))
        next true
      end
  else if hidden_abil > 0 && current_abil == 2
    if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability?",pkmn.name))
      pkmn.setAbility(normal_abil)
      scene.pbDisplay(_INTL("{1}'s Ability changed to its normal Ability!", pkmn.name))
        next true
      end
  else if hidden_abil == 0 ||  pkmn.species == 718
    scene.pbDisplay(_INTL("It won't have any effect."))
      next false
  end
  end
  end
  next false
})

4. Click Apply and save your project.

5. Create a place(s) where each item can be found/bought.

6. Save the project again

7. You're done! Proceed with making the rest of your game.

Note: By default, if a Pokemon has more than 1 Hidden Ability, the Ability Patch will only set the Hidden Ability to the first one in the list. Using it again will revert to it's original regular Ability. I believe this issue is also present in Pokemon Essentials v19(.1)'s Generation 8 Project, and will need some expertise to work around.
Credits
@Golisopod User - I used images from his Generation 8 Project for the item icons. Code from the ItemEffects script from the project was adapted as well.
Author
Maq47
Downloads
375
Views
1,590
First release
Last update

Ratings

0.00 star(s) 0 ratings

Latest updates

  1. Fixed everything. Code now works 100%.

    This script is now safe to use. I fixed a few typos and replaced some code in the Ability...
  2. Don't use just yet; Finally tested Ability Patch, and it crashes the game

    Turns out that you cannot simply reference pkmn.ability.h1 because it can return nil instead of...
Back
Top