Relic Castle

I had this idea to evolve Vaporeon, Jolteon, and Flareon when they faint if their happiness was high enough while a Ho-Oh is in the party, as a reference to the fan theory that the Legendary Beasts are reincarnated versions of the OG eeveelutions. I've gotten close to that goal, but the only default triggers in Essentials for evolution are level, item, or trade, not faint. I got to the point where they evolve when their HP is below 5 after they level up, with the code pasted below, but I feel it would be better if it triggers when HP reaches 0 instead of level up. Where does the game trigger evolutions for the different triggers, (pbMiniCheckEvolution, pbMiniCheckEvolutionItem, PBEvolution, whatever it might be) so I can find it and create a new trigger for reaching 0 HP? Any help would be appreciated.

when PBEvolution::HasInPartyFaint #Legendary Dogs
return poke if pokemon.hp<=5 && pokemon.happiness>=220

(I'd imagine the pokemon.hp<=5 would be removed when the 0 HP trigger is used, but this is what I have now.
Top