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

How to "Upgrade" Moves

  • 39
    Posts
    13
    Years
    So, to add a little variety to my project, I came up with an idea of upgrading moves like you could in Pokemon Mystery Dungeon.

    I really don't feel like copying moves in moves.txt and then adding the effects of the upgrade one by one. Is there a way to do this using script and adding the effects?

    For example,
    A normal Hydro Pump will have its usual base damage of 120. But a +5 Hydro Pump will have a base damage 135. And it will have a prefix of "+5."

    I also have an idea of adding enchants to go along with the upgrade. For example, I'll give a move an enchant that increases its base damage by 20%. It will be called "+5 Empowered Hydro Pump" ("+5" and "Empowered" being separate prefixes) with a base damage of 135*1.2= 162.

    I would greatly appreciate any help on this.

    P.S: Status and certain moves with variable base damages are excluded from the upgrade/enchant system.
     

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Here's something interesting for you to think about:

    The items PP Up and PP Max are existing items that can upgrade a move. This upgrade is solely an increase in the maximum PP that move can have.
     
  • 39
    Posts
    13
    Years
    Code:
    ItemHandlers::UseOnPokemon.add(:PPUP,proc{|item,pokemon,scene|
       move=scene.pbChooseMove(pokemon,_INTL("Boost PP of which move?"))
       if move>=0
         if pokemon.moves[move].ppup>=3
           scene.pbDisplay(_INTL("It won't have any effect."))
           next false
         else
           pokemon.moves[move].ppup+=1
           movename=PBMoves.getName(pokemon.moves[move].id)
           scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
           next true
         end
       end
    })

    Do I just change ppup to basedmg? And how do you change the display of the move name from "x" to "+1 x"?

    I appreciate you shedding some light on this, honestly. ^_^

    Edit: I also want to program in a chance of the item failing and degrading the move.
     
    Last edited:

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    A move is defined in the script section PBMove, in the class PBMove. It's quite simple, actually; the only things that are defined for it are the move's ID number (which move it is), the PP of the move, and the number of PP Up effects that have been applied to it. This last thing is used to decide what the maximum PP of the move is. As an interesting aside, there is no inherent limit on the number of PP Up effects (e.g. you could have more than 3, or negative numbers that reduce the maximum PP) - the limits are only contained within the item effects.

    Now. You'll notice the above class isn't very big, and doesn't do things like give you the name of the move or its accuracy or power or physical/special/status category. That's because it doesn't need to; by default, any two moves with the same ID will have identical names/powers/accuracies/etc., so Essentials might as well look up those details straight from the PBS file "moves.txt". And that's what it does. The way it does this is it uses the class PBMoveData, which loads the move data which comes from the PBS file. This class is also in the script section PBMove, so you can see exactly what information it could provide.

    The thing is, you don't want a move's name or power or effect chance to be the same for every single occurrence of that kind of move. You want to be able to change them, like you can with the maximum PP. This means you're going to need to add in a few more methods and variables into the class PBMove, so that you can use them to return customised things based on the enchantments/prefixes that particular move has. This is how the PP works, so you can do something similar for name/power/function code/effect chance/whatever.

    That's not all, though. Once you've edited PBMove, you still need to change other scripts so that they use your new methods (which return the names/numbers you want) rather than using PBMoveData to simply get the default information. You can start by searching for the phrase "PBMoveData.new" and then seeing whether each instance needs to be changed. Changed to what? Well, have a look at how the PP numbers are obtained by the scripts, and how they're different to, say, obtaining the power value.

    Assuming you've done all that correctly, you now have a system that allows you to customise moves with prefixes and enchantments. The last thing you'll need is a way to apply them. This could be by using an item on the move (like PP Up), or having an NPC do it (for a price), or whatever. You should probably have a separate, stand-alone method that actually changes the prefix (which involves choosing a random number and then picking another random number if the first was an inappropriate prefix, e.g. damage multiplier for a status move, and possibly worsening the move instead). Don't worry about this stage until you've done the above stuff.

    What could your prefixes and enchantments do? Well, they could change any aspect of a move that is defined in the PBS file "moves.txt". They could also do anything that an ability could do (e.g. boost all future-used Fire moves like Flash Fire does). Maybe a really powerful Hydro Pump could make it start raining for 2 turns, or a Lucky Metronome could choose only powerful/super-effective moves. They're just some ideas.



    In a nutshell, there's a lot of fiddly stuff to do. At least there's an existing example of how it could be done (PP, obviously), but your system would need to be a little more complex than that. I recommend you have just one variable which represents the prefix (just like how one variable represents a Pokémon's nature), and apply different effects based on the value of that one variable.

    Good luck managing to fit the longer move names into the small spaces available for them!
     
  • 39
    Posts
    13
    Years
    For now, I'm going to put the enchant feature on hold. I will focus on upgrades for now. I tried making an item do so (named an amplifier) and even a new variable. But for some reason, when I try to use it in the overworld, the game brings up a window stating "Can't use that item here." I'm really lost. I would appreciate the help. :\

    Note: Changes will be in blue.
    Code:
    class PBMove
      attr_reader(:id) # Gets this move's ID.
      attr_accessor(:pp) # Gets the number of PP remaining for this move.
      attr_accessor(:ppup) # Gets the number of PP Ups used for this move.
    [COLOR="blue"]  attr_accessor(:upgrade) # Upgrades base damage of the move.[/COLOR]
    
    # Gets this move's type.
      def type
        movedata=PBMoveData.new(@id)
        return movedata.type
      end
    
    [COLOR="blue"]# Gets upgraded basedamage
      def upgrade
        movedata=PBMoveData.new(@id)
        return (@basedamage+7).floor
      end[/COLOR]
      
    # Gets the maximum PP for this move.
      def totalpp
        movedata=PBMoveData.new(@id)
        tpp=movedata.totalpp
        return tpp+(tpp*@ppup/5).floor
      end
    
    # Initializes this object to the specified move ID.
      def initialize(moveid)
        movedata=PBMoveData.new(moveid)
        @pp=movedata.totalpp
        @id=moveid
        @ppup=0
      end
    end

    Update in script section PokemonItemEffects.
    Code:
    ItemHandlers::UseOnPokemon.add(:PPUP,proc{|item,pokemon,scene|
       move=scene.pbChooseMove(pokemon,_INTL("Boost PP of which move?"))
       if move>=0
         if pokemon.moves[move].ppup>=3
           scene.pbDisplay(_INTL("It won't have any effect."))
           next false
         else
           pokemon.moves[move].ppup+=1
           movename=PBMoves.getName(pokemon.moves[move].id)
           scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
           next true
         end
       end
    })
    
    [COLOR="Blue"]ItemHandlers::UseOnPokemon.add(:AMPLIFIER,proc{|item,pokemon,scene|
       move=scene.pbChooseMove(pokemon,_INTL("Boost power of which move?"))
       if move>=0
         if pokemon.moves[move].upgrade>=5
           scene.pbDisplay(_INTL("The base damage of the move is at its maximum."))
           next false
         else
           pokemon.moves[move].upgrade+=1
           movename=PBMoves.getName(pokemon.moves[move].id)
           scene.pbDisplay(_INTL("{1}'s base damage increased.",movename))
           next true
         end
       end
    })[/COLOR]
    
    ItemHandlers::UseOnPokemon.add(:PPMAX,proc{|item,pokemon,scene|
       move=scene.pbChooseMove(pokemon,_INTL("Boost PP of which move?"))
       if move>=0
         if pokemon.moves[move].ppup>=3
           scene.pbDisplay(_INTL("It won't have any effect."))
           next false
         else
           pokemon.moves[move].ppup=3
           movename=PBMoves.getName(pokemon.moves[move].id)
           scene.pbDisplay(_INTL("{1}'s PP increased.",movename))
           next true
         end
       end
    })

    I would really appreciate the help on this. I'm really lost.

    P.S: Even if I can't incorporate this system into the game, no worries. I'll just continue on with my story. And no, I will not post this on the Beginner's Showcase because I'm afraid I might not finish it. If you want the synopsis, you can just pm me ^_^.
     
    Last edited:

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Delete that def upgrade, and put @upgrade=0 in the def initialize. Make sure your Amplifier item is defined properly in items.txt (i.e. as an item that can be used on a Pokémon). Start a new game. Your Amplifier item should now work.

    Try adding the following where your def upgrade used to be:

    Code:
    def basedamage
      movedata=PBMoveData.new(@id)
      base=movedata.basedamage
      return base+@upgrade*7
    end
    This particular code adds 7 to the base damage for each upgrade point the move has (max. +35).

    Your next step is to do what my fourth paragraph above says: search the scripts and make sure wherever basedamage is used, it's taken directly from the move rather than from PBMoveData.
     
    Back
    Top