• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
7
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:
    3
    Posts
    9
    Years
    • Seen Nov 15, 2020
    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:

    Rinkoou

    Awful-Pun Master
    54
    Posts
    7
    Years
  • Thanks, pokeawesomesause! I just defined the form as a Mega Evolution for it to revert after battle, so everything works!
     
    Back
    Top