• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Form-changing moves?

Rinkoou

Awful-Pun Master
  • 54
    Posts
    8
    Years
    Hello! I was hoping that someone could help me with a question I have, that question being "How do I make a move that changes the user's form during the battle after being used, such as Relic Song but without the reverting once using it again and changing back after battle." Any help would be appreciated!
     
    Last edited by a moderator:
    I'm not sure how to stop the form reversion, but the actual changing form part is quite easy:
    Here's the move effect (Note: This assumes effect ID 159 isn't used)
    Code:
    class PokeBattle_Move_159 < PokeBattle_Move
      def pbEffectAfterHit(attacker,opponent,turneffects)
        if isConst?(@id,PBMoves,:MOVENAME)
          if !attacker.effects[PBEffects::Transform] &&
             !(attacker.hasWorkingAbility(:SHEERFORCE) && self.addlEffect>0) &&
             !attacker.isFainted?
            attacker.form=1
            attacker.pbUpdate(true)
            @battle.scene.pbChangePokemon(attacker,attacker.pokemon)
            @battle.pbDisplay(_INTL("{1} transformed!",attacker.pbThis))
            PBDebug.log("[Form changed] #{attacker.pbThis} changed to form #{attacker.form}")
          end
        end
      end
    end
    Replace MOVENAME with the internal name of the move. You could make the effect apply to only one pokemon by adding this line to the first if statement.
    Code:
    && isConst?(attacker.species,PBSpecies,:SPECIES)
    Replace SPECIES with the internal name of the pokemon you want it to apply to.
     
    Last edited:
    Thanks, pokeawesomesause! I just defined the form as a Mega Evolution for it to revert after battle, so everything works!
     
    Back
    Top