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

Forme change before using moves in battle

1,405
Posts
11
Years
  • This was originally a script i made for Deoxys in my game, but i thought you guys may want to use it for something else. Special thanks to DL Kurosh for the Stance Change script. Give credit to both of us if you use this.

    Look for this in PokeBattle_Battler script:
    Code:
    if status==PBStatuses::FROZEN && (thismove.flags&0x40)!=0 # flag g: Thaws user before moving
          self.status=0
          pbCheckForm
          @battle.pbDisplay(_INTL("{1} was defrosted by {2}!",pbThis,thismove.name))
        end

    Put this right after it (for multiple forms just place one right after each other)
    Code:
    if isConst?(self.ability,PBAbilities,:ABILITY) &&
           isConst?(self.species,PBSpecies,:POKEMON) && hp>0
            @pokemon.form=1 #change this to whatever form you want
            pbCheckForm
          end

    You can remove the Ability condition, but don't remove the Pokemon condition, especially if you are using an Ability condition because it can get traced.

    after hp>0 you can add any condition you want. these are the ones i tried:
    isConst?(self.ability,PBAbilities,:ABILITY) if the Pokemon has a specific ability, so moves like Worry Seed will temporally disable changing forms. For multiple abilities, separate them with ||.
    isConst?(self.species,PBSpecies,:POKEMON) if the Pokemon is a specific species. This should always be in the script so only a specific Pokemon can transform.
    thismove.basedamage == 0 if the move deals 0 damage, so every status move fits this condition. You can use < or > instead of == for lower than the value or greater than the value. You can also change 0 to any value you want.
    thismove.priority == 0 if the move doesn't have priority. You can change it to > 0 to make every move that has priority fulfill the condition.
    thismove.function == 0x2A if the moves function code is 02A (written in hex which is 0x2A, all moves need to be in hex otherwise it won't work). 02A is the function code of Cosmic Power and Defend Order, so if Deoxys uses Cosmic Power, he will change forme. You can use != for not equal, so if Deoxys uses Cosmic Power, he will not transform. If using multiple function codes for the same forme, make sure to separate them with || instead of &&.

    There are probably way more, but i haven't tried anything else. Try using thismove.something to find out other things, there is probably one for type.

    If dealing with multiple forms, make sure no move can fulfill more than 1 requirement, because otherwise the Pokemon will transform multiple times.

    Then look for this:
    Code:
    # Giratina
        if isConst?(self.species,PBSpecies,:GIRATINA) && hp>0
          if [email protected]
            [email protected]
            transformed=true
          end
        end

    Put this under it:
    Code:
    if isConst?(self.species,PBSpecies,:POKEMON) && hp>0
          if [email protected]
            [email protected]
            transformed=true
          end
        end

    This will treat the Pokemon as transformed and will display the message that it transformed.

    If you want to have the Pokemon change back to it's first forme at the end of the battle, look for:
    Code:
      def pbResetForm
        if !@effects[PBEffects::Transform]
          if isConst?(self.species,PBSpecies,:CASTFORM) ||
             isConst?(self.species,PBSpecies,:CHERRIM) ||
             isConst?(self.species,PBSpecies,:DARMANITAN) ||
             isConst?(self.species,PBSpecies,:MELOETTA)
            self.form=0
          end
        end
        pbUpdate(true)
      end

    Add
    Code:
    isConst?(self.species,PBSpecies,:POKEMON) ||

    If you did everything correctly, it should work.

    Here is what it should look like (it's a bit messy because Deoxys has 4 forms, and didn't feel like testing every single function code for multiple transformations)
    Spoiler:
     
    247
    Posts
    10
    Years
  • I like this :) i have to try it later for some evolution! Do you think that can a pokemon learn a move and maybe show the animation of the evolution?
     
    1,405
    Posts
    11
    Years
  • I like this :) i have to try it later for some evolution! Do you think that can a pokemon learn a move and maybe show the animation of the evolution?

    Yeah you can. I don't know how to work with animations, but you put a script that calls it(still don't know how) after pbUpdate(true) here in PokeBattle_Battler

    Code:
    if transformed
          pbUpdate(true)
          @battle.scene.pbChangePokemon(self,@pokemon)
          @battle.pbDisplay(_INTL("{1} transformed!",pbThis))
        end
      end
     
    Back
    Top