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

[Scripting Question] Help with Evolution on Faint Method

  • 10
    Posts
    4
    Years
    • Seen Dec 12, 2022
    I had an idea to evolve Vaporeon, Jolteon, and Flareon when their HP reached 0 if they had a certain level of happiness while a Ho-Oh was in the party, as a reference to the fan theory that the legendary beasts evolved from them. I got most of the way there, but stumbled on the fact that the only triggers for evolution in the game are based on level up, item, or trade. I tried having them evolve with the Revival Herb, but that always revived the pokemon without evolving them, prioritizing the item's core function, so that doesn't work. As for level up methods, the closest I got was using the code at the bottom of this post, but pokemon don't gain exp in battle if they are fainted, so that wouldn't work out. I'd rather not make it a requirement to use a Rare Candy to evolve them, and besides, they can technically evolve without fainting this way, so it'd be pointless.

    The problem is, I can't find where pbMiniCheckEvolution, pb MiniCheckEvolutionItem, PBEvolution, or whatever command, actually triggers upon level up or item use. Does anyone know where I can find this, so I can create a new check for when HP reaches zero? (pbMiniCheckEvolutionFaint or something.) Any help would be appreciated!

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

    (the reason the hp value is set to 5 is because on level up the pokemon's health increases and it no longer is 0, and 5 is the highest it would change by for the eeveelutions. I would probably remove this if I can get the faint trigger working.)
     
    For anyone reading this later, this has been resolved thanks to NettoHikari on Relic Castle, they wrote this code. Here's how it works (Compatible with 17.2):

    1. Go into PField_Battles and replace the definition for pbEvolution check so that it instead looks like this (This removes a line that prevents pokemon from evolving if they faint and allows them to do so):
    Code:
    def pbEvolutionCheck(currentlevels)
      for i in 0...currentlevels.length
        pokemon = $Trainer.party[i]
        newspecies = Kernel.pbCheckEvolution(pokemon,0,true)
        if pokemon && (!currentlevels[i] || pokemon.level!=currentlevels[i])
          newspecies = Kernel.pbCheckEvolution(pokemon) if newspecies <= 0
        end
        if newspecies>0
          evo = PokemonEvolutionScene.new
          evo.pbStartScreen(pokemon,newspecies)
          evo.pbEvolution
          evo.pbEndScreen
        end
      end
    end

    2. Then, go into Pokemon_Evolution and replace the definition for pbCheckEvolution with this:
    Code:
    def pbCheckEvolution(pokemon,item=0,faint=false)
      if faint
        return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
           next pbMiniCheckEvolutionFaint(pokemon,evonib,level,poke)
        }
      elsif item==0
        return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
           next pbMiniCheckEvolution(pokemon,evonib,level,poke)
        }
      else
        return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
           next pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)
        }
      end
    end

    3. Finally, put in the pbMiniCheckEvolutionFaint with the rest of the MiniCheckEvolution scripts.
    Code:
    def pbMiniCheckEvolutionFaint(pokemon,evonib,level,poke)
      case evonib
      when PBEvolution::HasInPartyFaint
        return poke if pokemon.hp == 0
      end
      return -1
    end

    If anyone has any problems using this, let me know!
     
    Last edited:
    Back
    Top