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

Creating a New Move

CDQ

Glorious Young Gentleman
20
Posts
9
Years
  • I was recently messing with my Project CDQ (Pokemon Essentials project) and wanted to know about creating a whole new move

    I had already created some moves that used the data of other moves (ex. creating the "Frost Kick" move out of Powder Snow) and wanted to actually make something new, scripts and everything

    I had a move I made called Flare Ring, a Fire-type healing move that has the same use as Aqua Ring except I wanted to make it heal 3/16 HP every turn as opposed to Aqua Ring

    I'd like to know how to completely create a move, Flare Ring specifically, instead of using the move and seeing "Aqua Ring healed Pokemon's HP a little!" (not the exact saying but you hopefully understand)

    Here is what I would like to make:

    A script that makes Flare Ring heal the HP every turn, and actually says "Flare Ring healed Pokemon's HP a little bit"

    I think it's really a big deal of work, but I am learning at the moment and appreciate any help

    (Also if there's some kinda topic that has this related to my question I'd like to be linked to it)
     
    1,224
    Posts
    10
    Years
  • Though the wiki mentions it briefly, there isn't really any tutorial that explains how to implement something like this. Easiest way is to just find all instances of aqua ring and copy them, but I'll try to explain what each part does.

    First step, look in PBEffects. You'll see a list of Effects that can exist in battle, you're going to add onto this list. Note that effects in this instances are not the same as Statuses or Move Effects. However, a Move Effect is what will change the state of Effects, so they are sort of codependent.
    Long story short, you're going to add this

    Code:
    FlareRing   = XXX
    after the last effect in PBEffects, replacing XXX with the next available number.

    Effects that would effect a side of the field need to be initialized as 0 (or false for a boolean) in PokeBattle_ActiveSlider, but in this case the effect only affects a specific pokemon, so this is not needed.

    Next, in PokeBattle_Battler, after

    Code:
    @effects[PBEffects::AquaRing]    = false

    add

    Code:
    @effects[PBEffects::FlareRing]    = false

    This will allow it to be passable via Baton Pass, if you want that sort of thing.

    Next we are going to make the effect actually do something. This is in PokeBattle_Battle

    Code:
    # Aqua Ring
        for i in priority
          next if i.hp<=0
          if i.effects[PBEffects::AquaRing]
            hpgain=(i.totalhp/16).floor
            hpgain=(hpgain*1.3).floor if isConst?(i.item,PBItems,:BIGROOT)
            hpgain=i.pbRecoverHP(hpgain,true)
            pbDisplay(_INTL("{1}'s Aqua Ring restored its HP a little!",i.pbThis)) if hpgain>0
          end
        end

    Under that, we are going to put

    Code:
    # Flare Ring
        for i in priority
          next if i.hp<=0
          if i.effects[PBEffects::FlareRing]
            hpgain=(i.totalhp*3/16).floor
            hpgain=(hpgain*1.3).floor if isConst?(i.item,PBItems,:BIGROOT)
            hpgain=i.pbRecoverHP(hpgain,true)
            pbDisplay(_INTL("{1}'s Flare Ring restored its HP a little!",i.pbThis)) if hpgain>0
          end
        end

    This section of the code is where all the checks are done before ending a turn and moving onto the next one.

    Next we are going to create the Move Effect, that will initiate the effect.

    This is the class used for Aqua Ring

    Code:
    ################################################################################
    # Rings the user.  Ringed Pokémon gain 1/16 of max HP at the end of each round.
    ################################################################################
    class PokeBattle_Move_0DA < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::AquaRing]
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        attacker.effects[PBEffects::AquaRing]=true
        @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of water!",attacker.pbThis))
        return 0
      end
    end

    So we're going to make one for Flare Ring. It's pretty simple.

    Code:
    ################################################################################
    # Rings the user.  Ringed Pokémon gain 3/16 of max HP at the end of each round.
    ################################################################################
    class PokeBattle_Move_XXX < PokeBattle_Move
      def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
        if attacker.effects[PBEffects::FlareRing]
          @battle.pbDisplay(_INTL("But it failed!"))
          return -1
        end
        pbShowAnimation(@id,attacker,nil,hitnum,alltargets,showanimation)
        attacker.effects[PBEffects::FlareRing]=true
        @battle.pbDisplay(_INTL("{1} surrounded itself with a veil of fire!",attacker.pbThis))
        return 0
      end
    end

    All we had to do was make it so that it would make the effect true for the user, unless the effect was already true. Make sure to replace XXX with the next available number. 0DG is actually available, but let's not get into all that.


    Make sure you make the function code in your moves.txt for this move matches what you replaced XXX with, and you should be good to go. Let me know if you have any questions.
     
    Back
    Top