Basically I took Kirik's resource and slapped Maruno's debug code for changing a Pokémon's ability into it and made it work from the item menu. Crediting me is optional, but please credit the originals.
Go to your 002_Item_Effects and add the following code at the bottom.
[CODE lang="ruby"...
I tried this resource out and I was able to adapt it for 21.1 of Pokémon Essentials. I have just recently been able to pull it off, so I have not done extensive testing. This is what needs to be done if you want the Hidden Ability Capsule/Super Capsule to work for 21.1 (It is important to note that I have not tested this with the Bag Screen with interactable Party resource by DiegoWT. I'm using the stock Bag and Pokemon Party UI that comes with Essentials, alongside the Modular UI Scenes Plugin by Lucidious89. You are on your own if you want this to work with the Bag Screen with interactable Party Plugin)
In the Script Editor (The second icon to the left of the green play button), go to Item_Effects. You can press CTRL + SHIFT + F to bring up a Find in All Sections search feature. Type ABILITYPATCH into the search bar and press Start Search. Jump to Item_Effects, Line 1103.
Below the block of code for the Ability Patch, copy and paste the following line of code:
V21.1 Super Capsule Item Handler Code Block:
ItemHandlers::UseOnPokemon.add(:SUPERCAPSULE, proc { |item, qty, pkmn, scene|
abils = pkmn.getAbilityList
ability_commands = []
abil_cmd = 0
cmd = 0
for i in abils
ability_commands.push(((i[1] < 2) ? "" : "(H) ") + GameData::Ability.get(i[0]).name)
abil_cmd = ability_commands.length - 1 if pkmn.ability_id == i[0]
break if cmd < 0
end
abil_cmd = scene.pbShowCommands(_INTL("Choose an ability."), ability_commands, abil_cmd)
next if abil_cmd < 0
pkmn.ability_index = abils[abil_cmd][1]
pkmn.ability = nil
scene.pbRefresh
scene.pbDisplay(_INTL("{1}'s ability changed to {2}!",pkmn.name,pkmn.ability.name))
next true
})
The next step is to add in the resources the Super Capsule Needs. The Super Capsule needs an item sprite, an item index in the PBS files, and a Pokémon to have 2 Abilities and 2 Hidden Abilities. The official Pokémon games allow a Pokémon to have 2 Abilities and 1 Hidden Ability. Pokémon Essentials’ Ability Index system means a Pokémon can have multiple hidden abilities. But I recommend sticking to just 1 or 2 Hidden Abilities at most.
How to add the item sprite:
On AiurJordan’s Hidden Ability Capsule (v19.1) resource page, hover over the Super Capsule item sprite. Right-click and press Open Image in New Tab or Save Image As. (I prefer Open Image in New Tab, because it usually means you get just the image itself, and sometimes at its best quality) Save the SUPERCAPSULE.png into the Graphics/Items folder in the directory of your current or testing Pokemon Essentials project. I also shared the same png in this reply as well, for those who want to do fewer clicks and tab swapping.
In the PBS folder of your current or testing Pokemon Essentials project, open the items.txt file. Copy and paste the following block of code into a section of the item list that makes sense to you. I recommend listing the Super Capsule below the Ability Patch item like this:
items.txt Super Capsule Code Block:
#-------------------------------
[SUPERCAPSULE]
Name = Super Capsule
NamePlural = Super Capsules
Pocket = 2
Price = 10000
BPPrice = 200
FieldUse = OnPokemon
Description = A capsule that allows a Pokémon to switch between all abilities they possess.
#-------------------------------
The last step is to give a Pokémon 2 Abilities and 2 Hidden Abilities. Or as many Hidden Abilities as you want. Go to the PBS folder of your current or testing Pokémon Essentials project and open the pokemon.txt file. For this example, I just gave Bulbasaur 2 Hidden Abilities.
2 Hidden Abilities for Hidden Ability Capsule Code Block:
# These lines need to be below the Happiness line and the Moves line.
# I recommend that you don’t delete the original lines that are in pokemon.txt)
#Abilities = OVERGROW
#HiddenAbilities = CHLOROPHYLL
Abilities = CHLOROPHYLL,THICKFAT
HiddenAbilities = LEAFGUARD,OVERGROW
Once you have done these steps, follow the best practices when testing out new additions you are making yourself to Pokémon Essentials. Clear the PluginScripts.rxdata file when adding in new plugins or making or adding code additions to the core Pokémon Essentials script files, use the Windows Key + R and type %appdata% to go to the Roaming folder on a Windows PC and find the save folder location of the name of your Pokemon Essentials project, and delete Game.rxdata file, so you have as fresh a state as possible for testing out plugins and changes/additions to the Pokemon Essentials scripts.
Once you have followed the steps I did, you should have a Super Capsule item that makes it possible for a Pokémon to switch between 2 Abilities and 2 Hidden Abilities. And work as intended without causing problems. It's important to note that as of writing this, I just managed to get it working and I didn't see any issues with the Super Capsule item from my testing. So I have not extensively tested this, to make sure any ability-changing interactions don't cause problems with the Super Capsule item. Other ability-changing options exist, such as Jason Godwyn's Pokeditor that have a more concise player UX experience. But sadly, I wasn't smart enough to adapt the Pokeditor to allow a Pokemon to switch between 2 hidden abilities. So that's why I did the work to adapt this resource for 21.1. I hope this can help out those who want a Pokemon game where the Pokemon have 2 Abilities and 2 Hidden Abilities.
This section is for the discussion of the tutorials and resources on Eevee Expo. To find tutorials and resources, check out the Tutorial and Resource Manager for optimal navigation.