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

[Essentials Tutorial] Dynamax tutorial

37
Posts
6
Years
  • Le0OnPa.gif
    o5ody9o.gif


    Let's make a Dynamax function to your game! (Remember that the system is still incomplete, you will need to upgrade as new role information is released)

    LOG: (last update:12/30/2019)
    Spoiler:


    Let's start this crap!

    Inside Settings, search for "MEGARINGS" and bellow add:
    Code:
    DBANDS                = [:DYNAMAXBAND]
    First we need to create some effects that will be used for Max Moves, Dynamax and Gigantamax.
    Within the PBEffects script for battler effects, add (where XXX is the next numeric value):
    Code:
    Dynamax = XXX
    DBoost = XXX
    DButton = XXX
    # Max Move Effects
    MaxGuard = XXX
    MaxKnuckle = XXX
    MaxAirstream = XXX
    MaxOoze = XXX
    MaxQuake = XXX
    MaxSteelspike = XXX
    # Gigantamax
    Gigantamax = XXX
    MaxMove1 = XXX
    MaxMove2 = XXX
    MaxMove3 = XXX
    MaxMove4 = XXX
    Now we have the necessary effects to work on Dynamax mechanics and the like, continuing on PokeBattle_Battler (with R), among the "attr_acessor" put:
    Code:
      attr_accessor :dynamax
      attr_accessor :gigantamax
    Then continue and search for "def isMega?" and below put the following lines:
    Code:
    # Dynamax is compatible with large maps
     def hasDynamax?
        maps = [] # maps for allow Dynamax
        if $game_map && maps.include?($game_map.map_id) &&
          !(self.isConst?(species,PBSpecies,:ZACIAN) ||
          self.isConst?(species,PBSpecies,:ZAMAZENTA))
          return true
        end
        return false
      end
      
      def isDynamax?
        #return false if @effects[PBEffects::Transform]
        if @pokemon
          return (@pokemon.isDynamax? rescue false)
        end
        return false
      end
      
      def makeUnmax
        return pbUndynamax
      end

    If you want to use Gigantamax, just remove "#" in lines
    Code:
      def hasGigantamax?
        return false if @effects[PBEffects::Transform]
        if @pokemon # && @pokemon.dynamax_lvl==10
          if isConst?(species,PBSpecies,:CHARIZARD) # ||
            #isConst?(species,PBSpecies,:BUTTERFREE) ||
            #isConst?(species,PBSpecies,:PIKACHU) ||
            #isConst?(species,PBSpecies,:MEOWTH) ||
            #isConst?(species,PBSpecies,:MACHAMP) ||
            #isConst?(species,PBSpecies,:GENGAR) ||
            #isConst?(species,PBSpecies,:KINGLER) ||
            #isConst?(species,PBSpecies,:LAPRAS) ||
            #isConst?(species,PBSpecies,:EEVEE) ||
            #isConst?(species,PBSpecies,:SNORLAX) ||
            #isConst?(species,PBSpecies,:GARBODOR) ||
            #isConst?(species,PBSpecies,:MELMETAL) ||
            #isConst?(species,PBSpecies,:CORVIKNIGHT) ||
            #isConst?(species,PBSpecies,:ORBEETLE) ||
            #isConst?(species,PBSpecies,:DREDNAW) ||
            #isConst?(species,PBSpecies,:COALOSSAL) ||
            #isConst?(species,PBSpecies,:APPLETUN) ||
            #isConst?(species,PBSpecies,:SANDACONDA) ||
            #isConst?(species,PBSpecies,:TOXTRICITY) ||
            #isConst?(species,PBSpecies,:CENTISKORCH) ||
            #isConst?(species,PBSpecies,:HATTERENE) ||
            #isConst?(species,PBSpecies,:GRIMMSNARL) ||
            #isConst?(species,PBSpecies,:ALCREMIE) ||
            #isConst?(species,PBSpecies,:COPPERAJAH) ||
            #isConst?(species,PBSpecies,:DURALUDON) ||
            #isConst?(species,PBSpecies,:ETERNATUS)
            return true
          end
        end
        return false
      end

    Continuing...
    Code:
      def pbUndynamax
        if @pokemon
          @battle.pbDisplay(_INTL("{1}'s reversing the changes!",pbThis))
          @battle.pbCommonAnimation ("UnDynamaxAnimationHere",self,nil)
          @effects[PBEffects::DBoost] = false
          @effects[PBEffects::Dynamax] = 0
          @effects[PBEffects::DButton] = false
          # Only for Gigantamax
          if hasGigantamax?
            @pokemon.form=0
            @battle.scene.pbChangePokemon(self,@pokemon)
            @effects[PBEffects::Gigantamax]=0
          end
          @pokemon.makeUndynamax
          pbUnMaxMove(unmax=true)
          pbUpdate(true)
          @pokemon.pbReversing
          #@battle.scene.pbChangePokemon (self, @ pokemon) No need this line, cuz only check if Gigantamax up
          @battle.pbCommonAnimation ("UnDynamaxAnimation2Here",self,nil)
        end
      end
    Now inside "pbInitEffects(battonpass)", put after the last line:
    Code:
        # Dynamax / Gigantamax
        @effects[PBEffects::Dynamax] = 0
        @effects[PBEffects::DBoost] = false
        @effects[PBEffects::DButton] = false
        @effects[PBEffects::Gigantamax] = 0
        # Max Move Effects
        @effects[PBEffects::MaxGuard] = false
        @effects[PBEffects::MaxKnuckle] = false
        @effects[PBEffects::MaxAirstream] = false
        @effects[PBEffects::MaxOoze] = false
        @effects[PBEffects::MaxQuake] = false
        @effects[PBEffects::MaxSteelspike] = false
        # Max Special Usage
        @effects[PBEffects::MaxMove1] = 0
        @effects[PBEffects::MaxMove2] = 0
        @effects[PBEffects::MaxMove3] = 0
        @effects[PBEffects::MaxMove4] = 0
    Search for "def isAirborne?" and below add:
    Code:
    # Dynamax
      def pbMaxMove
        imposter=isConst?(species,PBSpecies,:DITTO) && isConst?(ability,PBAbilities,:LIMBER)
         for i in 0...4 # [@moves[0],@moves[1],@moves[2],@moves[3]]
           if @moves[i].id>0 && !imposter
             if @moves[i] .pbIsStatus?
               @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXGUARD)))
             elsif @moves[i].type==0 # Normal
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXSTRIKE)))
             elsif @moves[i].type==1 # Fighting
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXKNUCKLE)))
             elsif @moves[i].type==2 # Flying
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXAIRSTREAM)))
             elsif @moves[i].type==3 # Poison
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXOOZE)))
             elsif @moves[i].type==4 # Ground
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXQUAKE)))
             elsif @moves[i].type==5 # Rock
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXROCKFALL)))
             elsif @moves[i].type==6 # Bug
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXFLUTTERBY)))
             elsif @moves[i].type==7 # Ghost
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXPHANTASM)))
             elsif @moves[i].type==8 # Steel
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXSTEELSPIKE)))
             elsif @moves[i].type==10 # Fire
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXFLARE)))
             elsif @moves[i].type==11 # Water
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXGEYSER)))
             elsif @moves[i].type==12 # Grass
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXOVERGROWTH)))
             elsif @moves[i].type==13 # Electric
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXLIGHTNING)))
             elsif @moves[i].type==14 # Psychic
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXMINDSTORM)))
             elsif @moves[i].type==15 # Ice
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXHAILSTORM)))
             elsif @moves[i].type==16 # Dragon
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXWYRMWIND)))
             elsif @moves[i].type==17 # Dark
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXDARKNESS)))
             elsif @moves[i].type==18 # Fairy
    	   @moves[i]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(getConst(PBMoves,:MAXSTARFALL)))
             end
           end
           @moves[i].pp=PokeBattle_Move.pbFromPBMove(@battle,@pokemon.moves[i]).pp
           @moves[i].totalpp=PokeBattle_Move.pbFromPBMove(@battle,@pokemon.moves[i]).totalpp
         end
       return false
      end
     
      def pbUnMaxMove(unmax=false)
        @moves = [
         PokeBattle_Move.pbFromPBMove(@battle,@pokemon.moves[0]),
         PokeBattle_Move.pbFromPBMove(@battle,@pokemon.moves[1]),
         PokeBattle_Move.pbFromPBMove(@battle,@pokemon.moves[2]),
         PokeBattle_Move.pbFromPBMove(@battle,@pokemon.moves[3])
         ]
        if unmax
          @pokemon.moves[0].pp-=@effects[PBEffects::MaxMove1]
          @pokemon.moves[1].pp-=@effects[PBEffects::MaxMove2]
          @pokemon.moves[2].pp-=@effects[PBEffects::MaxMove3]
          @pokemon.moves[3].pp-=@effects[PBEffects::MaxMove4]
          for i in 0...4
            @moves[i][email protected][i].pp
            @moves[i][email protected][i].totalpp
          end
        end
      end
    In "pbFaint", just below "@pokemon.makeUnprimal if self.isPrimal?" add line:
    Code:
        # Dynamax
        @pokemon.makeUnmax if self.isDynamax?
    Now in PokeBattle_BattleEffects, search for "def pbFlinch(attacker=nil)" and replace with:
    Code:
      def pbFlinch(attacker=nil)
        return false if @effects[PBEffects::Dynamax]>0 # Dynamax can't be flinched
        return false if (!attacker || !attacker.hasMoldBreaker) && hasWorkingAbility(:INNERFOCUS)
        @effects[PBEffects::Flinch]=true
        return true
      end
    Now in PokeBattle_Move add to "attr_acessor":
    Code:
    attr_accessor (:dynamax)
    Continue and search for "def pbCalcDamage(attacker,opponent,options=0)", search for:
    Code:
      if attacker.hasWorkingItem(:CHOICEBAND) && pbIsPhysical?(type)
        atkmult=(atkmult*1.5).round
      end
      if attacker.hasWorkingItem(:CHOICESPECS) && pbIsSpecial?(type)
        atkmult=(atkmult*1.5).round
      end
    And replace with these:
    Code:
      if !attacker.isDynamax?
        if attacker.hasWorkingItem(:CHOICEBAND) && pbIsPhysical?(type)
          atkmult=(atkmult*1.5).round
        end
        if attacker.hasWorkingItem (:CHOICESPECS) && pbIsSpecial?(type)
          atkmult=(atkmult*1.5).round
        end
      end

    In PokeBattle_Battle (without R), within "def initialize(scene,p1,p2,player,opponent)", search for "if @opponent.is_a?(Array)"
    and just below put these lines:
    Code:
        # DynaMax
        @dynaMax = []
        if @player.is_a? (Array)
          @dynaMax[0] = [-1]*@player.length
        else
          @dynaMax[0] = [-1]
        end
        if @opponent.is_a?(Array)
          @dynaMax[1] = [-1]*@opponent.length
        else
          @dynaMax[1] = [-1]
        end
    Bellow "def pbHasMegaRing?(battlerIndex)" add:
    Code:
      def pbHasDBand?(battlerIndex)
        return true if !pbBelongsToPlayer?(battlerIndex)
        for i in DBANDS
          next if !hasConst?(PBItems,i)
          return true if $PokemonBag.pbQuantity(i)>0
        end
        return false
      end
    And bellow "def pbCanShowCommands?(idxPokemon)" add:
    Code:
      def dynaMax
        return @dynaMax
      end
    In "def pbRegisterSwitch(idxPokemon,idxOther)" add above "return true":
    Code:
        # Dynamax
        if @dynaMax[side][owner]==idxPokemon
          @dynaMax[side][owner]=-1
        end
        # Reverse Dynamax if still on
        if @battlers[idxPokemon].isDynamax?
         @battlers[idxPokemon].pbUndynamax
        end
    Now in "def pbRegisterItem(idxPokemon,idxItem,idxTarget=nil)", also add above "return true":
    Code:
        # Dynamax
        if @dynaMax[side][owner]==idxPokemon
          @dynaMax[side][owner]=-1
        end
    Search for "Mega Evolve Battler" using "CTRL + F" or "CTRL + Shift + F" and UP put Dynamax Battler:
    Code:
    ################################################################################
    # Dynamax battler.
    ################################################################################
    
      def pbCanDynamax?(index)
        return false if $game_switches[NO_DYNAMAX]
        return false if! @battlers[index].hasDynamax?
        return false if pbIsOpposing?(index) && !@opponent
        return false if !pbHasDBand?(index)
        # If a Poke holding a Mega Stone / Z-Crystal, Dynamax not be able
        # to activate for him!
        return false if @battlers[index].hasZMove? # Only if you are using Z-Moves addon, otherwise remove this line
        return false if @battlers[index].hasMega?
        side = (pbIsOpposing?(index)) ? 1 : 0
        owner = pbGetOwnerIndex(index)
        return false if @dynaMax[side][owner]!=-1
        return false if @battlers[index].effects[PBEffects::SkyDrop]
        # Only for AI get Max / G-Max Moves
        @battlers[index].pbMaxMove if !pbBelongsToPlayer?(index)
        return true
      end
      
      def pbRegisterDynamax(index)
        side = (pbIsOpposing?(index)) ? 1 : 0
        owner = pbGetOwnerIndex(index)
        @dynaMax[side][owner]=index
      end
    
      def pbDynamax(index)
        return if! @battlers[index] || !@battlers[index].pokemon
        return if! (@ battlers [index] .hasDynamax? rescue false)
        return if (@battlers[index].isDynamax? rescue true)
        ownername = pbGetOwner(index).fullname
        ownername = pbGetOwner(index).name if pbBelongsToPlayer?(index)
        @battlers [index].effects[PBEffects::Dynamax]=3
        @battlers [index].effects[PBEffects::DBoost]=true
        @scene.pbRecall(index)
        # Checking Gigantamax
        if @battlers[index].hasGigantamax?
          @battlers[index].pokemon.makeGigantamax
          @battlers[index].effects[PBEffects::Gigantamax]=3
          @battlers[index].form=@battlers[index].pokemon.form
          @ scene.pbChangePokemon(@battlers[index],@battlers[index].pokemon)
        end
        if pbBelongsToPlayer?(index) || @battlers[index].pbPartner && !pbIsOpposing?(index)
          @scene.pbSendOut index,@battlers[index].pokemon)
        elsif pbIsOpposing?(index)
          @scene.pbTrainerSendOut (index,@battlers[index].pokemon)
        end
        @battlers[index].pokemon.makeDynamax
        @battlers[index].pbUpdate(true)
        maxname=(@battlers[index].pokemon.maxName rescue nil)
        if! maxname || maxname ==""
          maxname = _INTL ("{1}",PBSpecies.getName(@battlers[index].pokemon.species))
        end
        #pbDisplay(_INTL("{1} has Mega Evolved into {2}!",@battlers[index].pbThis,meganame))
        PBDebug.log("[Dynamax] #{@battlers[index].pbThis} became Max #{maxname}")
        side = (pbIsOpposing?(index)) ? 1 : 0
        owner = pbGetOwnerIndex(index)
        @dynaMax[side][owner]=-2
        pbPlayCrySpecies(@battlers[index])
      end
    Within "def pbCommandPhase" under "# Reset choices to perform Mega Evolution" add the lines:
    Code:
        # Dynamax
        for i in 0...@dynaMax[0].length
          @dynaMax[0][i]=-1 if @dynaMax[0][i]>=0
        end
        for i in 0...@dynaMax[1].length
          @dynaMax[1][i]=-1 if @dynaMax[1][i]>=0
        end
    Now let's configure Dynamax to interact with player turns and choices during battle:

    Within "if cmd==0 # Fight" put:
    Code:
        # Dynamax
        if @dynaMax[side][owner]==i
          @dynaMax[side][owner]=-1
        end
    Below, in "@doublebattle" within "if target<0":
    Code:
        # Dynamax
        @dynaMax[0][0]=-1 if @dynaMax[0][0]>=0
        @dynaMax[1][0]=-1 if @dynaMax[1][0]>=0
    Also in "elsif target==PBTargets::UserOrPartner # Acupressure":
    Code:
        # Dynamax
        @dynaMax[0][0]=-1 if @dynaMax[0][0]>=0
        @dynaMax[1][0]=-1 if @dynaMax[1][0]>=0
    Go to "elsif cmd==3 # Run" and do the same:
    Code:
        # Dynamax
        if @dynaMax[side][owner]==i
          @dynaMax[side][owner]=-1
        end
    Now in "elsif cmd==-1 # Go back to the first battler's choice":
    Code:
        # Dynamax
        @dynaMax[0][0]=-1 if @dynaMax[0][0]>=0
        @dynaMax[1][0]=-1 if @dynaMax[1][0]>=0
    Within "def pbAttackPhase", just below "# Mega Evolution", add:
    Code:
        # Dynamax
        dynamaxed = []
        for i in priority
          if @choices[i.index][0]== 1 && !i.effects[PBEffects::SkipTurn]
            side = (pbIsOpposing?(i.index)) ? 1 : 0
            owner = pbGetOwnerIndex (i.index)
            if @dynaMax[side][owner]==i.index
              pbDynamax(i.index)
              dynamaxed.push(i.index)
            end
          end
        end
    And finalizing the modifications in PokeBattle_Battle (without R), look for "def pbEndOfRoundPhase" and inside "# Form checks" add:
    Code:
        # Dynamax
        if @battlers[i].effects[PBEffects::Dynamax]>0
          @battlers[i].effects[PBEffects::Dynamax]-=1
          if @battlers[i].effects[PBEffects::Dynamax]==0
            @battlers[i].pbUndynamax
          end
        end
    Now, inside of "def pbThrowPokeBall(idxPokemon,ball,rareness=nil,showplayer=false)", bellow this line "((pokemon.makeUnprimal if pokemon.isPrimal?) rescue nil)", add:
    Code:
    ((pokemon.makeUnmax if pokemon.isDynamax?) rescue nil)
    Now in PokeBattle_Scene, look for "def initialize(battler,viewport=nil)" and under "@megaButton=0 # 0 = don't show, 1 = show, 2 = pressed" add:
    Code:
        # Dynamax
        @dButton=0 # 0 = don't show, 1 = show, 2 = pressed
    In "def refresh":
    Add "@dButton" to the parameters
    Code:
        @buttons.refresh(self.index,@battler? @battler.moves : nil, @megaButton,@zButton,@ultraButton,@dButton) if @buttons
    Just below within "def update" do the same:
    Code:
       @buttons.update(self.index,moves,@megaButton,@zButton,@ultraButton,@dButton) # Dynamax
    Jumping to "def initialize (index=0,moves=nil,viewport=nil)" under "@megaevobitmap=AnimatedBitmap.new (_INTL("Graphics/Pictures/Battle/cursor_mega"))" add:
    Code:
       # Dynamax
       @dynamaxbitmap=AnimatedBitmap.new (_INTL("Graphics/Pictures/Battle/cursor_dynamax"))
    * Note that you will need an image called "cursor_dynamax" in the Battle folder (I will leave the cursor I use at the end of the tutorial, don't skip the steps)

    Just below "def dispose" under "@megaevobitmap.dispose", add the line:
    Code:
       @dynamaxbitmap.dispose
    Continuing, new below further replace your lines:
    Code:
       def update(index=0,moves=nil,megaButton=0)
         refresh(index,moves,megaButton)
       end
      
       def refresh(index,moves,megaButton)
    For these:
    Code:
       def update(index=0,moves=nil,megaButton=0,dButton=0) # Dynamax
         refresh(index,moves,megaButton,dButton) # Dynamax
       end
      
       def refresh(index,moves,megaButton,dButton) # Dynamax
    Under "if megaButton>0" put:
    Code:
       # Dynamax
       if dButton>0
         self.bitmap.blt(146.0,@dynamaxbitmap.bitmap,Rect.new(0,(dButton-1)*46.96.46))
       end
    Now look for the line "# Draw Mega Evolution" and above "elsif @battler.isPrimal?" add:
    Code:
       elsif @battler.isDynamax?
         imagepos.push(["Graphics/Pictures/Battle/icon_dynamax",@spritebaseX+0.32,0,0,-1,-1))
    * I will also leave at the end of the tutorial the Dynamax icon that I use

    Now search for "def pbFightMenu (index)" and under "cw.megaButton=1 if (@battle.pbCanMegaEvolve?(Index) && [email protected]?(Index))", add the lines:
    Code:
        # Dynamax
        cw.dButton = 0
        cw.dButton = 1 if (@battle.pbCanDynamax?(index) && [email protected]?(index) && [email protected]?(index) &&
        [email protected]?(index))
    * Note that "[email protected]?(Index) && [email protected]?(Index))" should only be added if you have properly configured the Ultra Burst and
    Z-Move, otherwise remove these commands!

    Below, within "if Input.trigger?(Input::C) # Confirm choice" add the lines:
    Code:
        if battler.effects [PBEffects::DButton]
          battler.effects [PBEffects::MaxMove1] += 1 if cw.index == 0
          battler.effects [PBEffects::MaxMove2] += 1 if cw.index == 1
          battler.effects [PBEffects::MaxMove3] += 1 if cw.index == 2
          battler.effects [PBEffects::MaxMove4] += 1 if cw.index == 3
        end
    Within the "elsif Input.trigger?(Input::A) # Use Mega Evolution" command, add:
    Code:
        if @ battle.pbCanDynamax?(index) # Use Dynamax
          battler.effects[PBEffects::DButton] = true
          battler.pbMaxMove
          @ battle.pbRegisterDynamax (index)
          pbPlayDecisionSE
          cw.dButton = 2
          pbUpdate
        end
    And replace your "elsif Input.trigger?(Input :: B) # Cancel fight menu" with:
    Code:
        elsif Input.trigger?(Input::B) # Cancel fight menu
          battler.effects[PBEffects::DButton] = false
          battler.pbUnMaxMove if! battler.isDynamax?
          @lastmove[index] = cw.index
          pbPlayCancelSE
          return -1
        end
    In "def pbFainted(pkmn)" change:
    Code:
        frames = pbCryFrameLength(pkmn.pokemon)
        pbPlayCry(pkmn.pokemon)
        frames.times do
          pbGraphicsUpdate
          pbInputUpdate
          pbFrameUpdate
        end
    Per:
    Code:
        # Dynamax Reversions if is fainted
        if @ battle.battlers[pkmn.index].isDynamax?
          @battle.battlers[pkmn.index].pbUndynamax
        else
          frames = pbCryFrameLength(pkmn.pokemon)
          pbPlayCry(pkmn.pokemon)
          frames.times do
            pbGraphicsUpdate
            pbInputUpdate
            pbFrameUpdate
          end
        end
    To give Pokemon a boost to your HP you will need to create an attribute called Dynamax Level, add "attr_writer: dynamax_lvl at the start and then
    search for "# Recalculates this Pokémon's stats.", swap for:
    Code:
    # Recalculates this Pokémon's stats.
      def calcStats
        nature=self.nature
        stats=[]
        pvalues??=[100,100,100,100,100]
        na5=(nature/5).floor
        nm5=(nature%5).floor
        if nd5!=nm5
          pvalues??[nd5]=110
          pvalues??[nm5]=90
        end
        level = self.level
        bs = self.baseStats
        for i in 0..5
          base = bs[i]
          if i==PBStats::HP
            stats[i]=calcHP(base,level,@iv[i],@ev[i])
          else
            stats[i]=calcStat(base,level,@iv[i],@ev[i],pvalues??[i-1])
          end
        end
        # Dynamax HP Boost
        if isDynamax?
          @totalhp=(stats[0]*pbDynamaxBoost).floor
          diff=@totalhp-@hp
          @hp=((@totalhp-diff)*pbDynamaxBoost).floor
          @hp=0 if @hp <= 0
          @hp=@totalhp if @hp>@totalhp
        elsif isReversing?
          @totalhp=stats[0]
          @hp=(@hp/pbDynamaxBoost).floor
          @hp+1 if !self.isFainted? # Because complete the caltulation
          diff=@totalhp-@hp
          @hp=0 if @hp<=0
          @hp=@totalhp if @hp>@totalhp
        else
          if! isReversing? # Original Essentials Calc for HP
            diff = @totalhp-@hp
            @totalhp=stats[0]
            @hp=@totalhp-diff
            @hp=0 if @hp<= 0
            @hp=@totalhp if @hp>@totalhp
          end
        end
        @attack=stats[1]
        @defense=stats[2]
        @speed=stats[3]
        @spatk=stats[4]
        @spdef=stats[5]
      end
    Just below, add the lines:
    Code:
    ################################################################################
    # Dynamax Properties
    ################################################################################
    
      # Dynamax
      
      def makeDynamax
        @dynamax = true
        @needreverse = true
      end
      
      def makeUndynamax
        @dynamax = false
      end
    
      def isDynamax?
        return @dynamax
      end
      
      def hasGigantamax?
        return @gigantamax
      end
      
      def dynamax_lvl
        return @dynamax_lvl || 0
      end
      
      def pbReversing
        return @needreverse = false
      end
      
      def isReversing?
        if @needreverse
          return true
        end
        return false
      end
      
      def pbDynamaxBoost
        dynamaxboost=1.5+0.05*dynamax_lvl
      end
    Okay, we have finished using Dynamax and its proper basic functions in battle.
    Note that no individual move functions or items have been added to manipulate Dynamax Level. This will be done in another tutorial (maybe posted right here)

    Now let's define the switch that will use to block the use of Dynamax. In Setings, find 'NO_MEGA_EVOLUTION' and place:
    Code:
    NO_DYNAMAX = XXX
    Where 'XXX' is the switch number you want to block Dynamax activation

    Okay, here we finish all the code!

    Now let's create the Max Moves and Item Dynamax Band.
    Navigate to the PBS folder and in 'move.txt' add the lines: (replace 'XXX' with the last numbar and and 'YYY' with the function of MoveEffectf personal move)
    Code:
    XXX,MAXFLARE,Max Flare,YYY,110,FIRE,Physical,100,10,0,00,0,,"This is a Fire-type attack Dynamax Pokémon use. The user intensifies the sun for five turns."
    XXX,MAXFLUTTERBY,Max Flutterby,YYY,110,BUG,Physical,100,10,0,00,0,,"This is a Bug-type attack Dynamax Pokémon use. This lowers the target's Sp. Atk stat."
    XXX,MAXLIGHTNING,Max Lightning,YYY,110,ELECTRIC,Physical,100,10,0,00,0,,"This is an Electric-type attack Dynamax Pokémon use. The user turns the ground into Electric Terrain for five turns."
    XXX,MAXSTRIKE,Max Strike,YYY,110,NORMAL,Physical,100,10,0,00,0,,"This is a Normal-type attack Dynamax Pokémon use. This lowers the target's Speed stat."
    XXX,MAXKNUCKLE,Max Knuckle,YYY,110,FIGHTING,Physical,100,10,0,00,0,,"This is a Fighting-type attack Dynamax Pokémon use. This raises ally Pokémon's Attack stats."
    XXX,MAXPHANTASM,Max Phantasm,YYY,110,GHOST,Physical,100,10,0,00,0,,"This is a Ghost-type attack Dynamax Pokémon use. This lowers the target's Defense stat."
    XXX,MAXHAILSTORM,Max Hailstorm,YYY,110,ICE,Physical,100,10,0,00,0,,"This is an Ice-type attack Dynamax Pokémon use. The user summons a hailstorm lasting five turns."
    XXX,MAXOOZE,Max Ooze,YYY,110,POISON,Physical,100,10,0,00,0,,"This is a Poison-type attack Dynamax Pokémon use. This raises ally Pokémon's Sp. Atk stats."
    XXX,MAXGEYSER,Max Geyser,YYY,110,WATER,Physical,100,10,0,00,0,,"This is a Water-type attack Dynamax Pokémon use. The user summons a heavy rain that falls for five turns."
    XXX,MAXAIRSTREAM,Max Airstream,YYY,110,FLYING,Physical,100,10,0,00,0,,"This is a Flying-type attack Dynamax Pokémon use. This raises ally Pokémon's Speed stats."
    XXX,MAXSTARFALL,Max Starfall,YYY,110,FAIRY,Physical,100,10,0,00,0,,"This is a Fairy-type attack Dynamax Pokémon use. The user turns the ground into Misty Terrain for five turns."
    XXX,MAXWYRMWIND,Max Wyrmwind,YYY,110,DRAGON,Physical,100,10,0,00,0,,"This is a Dragon-type attack Dynamax Pokémon use. This lowers the target's Attack stat."
    XXX,MAXMINDSTORM,Max Mindstorm,YYY,110,PSYCHIC,Physical,100,10,0,00,0,,"This is a Psychic-type attack Dynamax Pokémon use. The user turns the ground into Psychic Terrain for five turns."
    XXX,MAXROCKFALL,Max Rockfall,YYY,110,ROCK,Physical,100,10,0,00,0,,"This is a Rock-type attack Dynamax Pokémon use. The user summons a sandstorm lasting five turns."
    XXX,MAXQUAKE,Max Quake,YYY,110,GROUND,Physical,100,10,0,00,0,,"This is a Ground-type attack Dynamax Pokémon use. This raises ally Pokémon's Sp. Def stats."
    XXX,MAXDARKNESS,Max Darkness,YYY,110,DARK,Physical,100,10,0,00,0,,"This is a Dark-type attack Dynamax Pokémon use. This lowers the target's Sp. Def stat."
    XXX,MAXOVERGROWTH,Max Overgrowth,YYY,110,GRASS,Physical,100,10,0,00,0,,"This is a Grass-type attack Dynamax Pokémon use. The user turns the ground into Grassy Terrain for five turns."
    XXX,MAXSTEELSPIKE,Max Steelspike,YYY,110,STEEL,Physical,100,10,0,00,0,,"This is a Steel-type attack Dynamax Pokémon use. This raises ally Pokémon's Defense stats."
    XXX,MAXGUARD,Max Guard,YYY,0,NORMAL,Status,100,10,0,00,0,,"This is a Status category attack Dynamax Pokémon use. Protect against all move, include other Dynamax moves."
    Regarding the item Dynamax Band, in 'items.txt' add: (replace 'XXX' with the last number)
    Code:
    XXX,DYNAMAXBAND,Dynamax Band,Dynamax Band's,8,0,"Allows the player's Pokémon to Dynamax and perform Max Moves.",0,0,6,

    Here the Dynamax Button and Icon:

    raR8QrA.png

    TMTwiLk.png
    Credit Smogon's Project if you use this!

    This tutorial was made in Version 17 of Essentials, may contain errors and if necessary some methods must be adapted to work in later or earlier versions.
    If you use, please remember to give credit for: Me
    And for support: WolfPP, Zeak, Vendily, MGriffin and Luka S.J
     
    Last edited:
    32
    Posts
    6
    Years
  • Thanks for sharing!
    However, I do have a question since it was rather difficult following all the steps and always asking yourself where exactly do you have to put it.
    Anyway, for some reason I don't understand, I still get the following message:

    Spoiler:


    I looked for every "dButton", but unless I misplaced it, it doesn't seem like I missed anyone.
    Do you know what I missed or where my error lies?
    I already have an icon for the item "dynamax band" and have a cursor_dynamax.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Spoiler:

    Maybe you need
    Code:
    attr_accessor :dButton
    In the FightMenuDisplay class?
    (But if that doesn't work you should wait for fauno, because I'm just guessing based on the code and the error message, I haven't tried making the change).
     
    658
    Posts
    7
    Years
  • Is the size change really necessary in the non-EBS version? The screen in already pretty crammed and then the Giant Sprites will make it much worse. I think a red semi-transparent cloud overlay might be better at conveying the Dynamax effect.

    Gigantamax just requires a few extra checks in the hasDyanamax? part for Species of Pokémon and some more checks for the G-Max Moves in the Move AI & Player Move part (I can't code all this myself but I know fauno may be able to do this in a day or two)

    Its amazing that in just a week of SwSh's release, a whole new system has been coded, and that to in such a way that everyone can use it (unlike the Z-Move Addon) so props to you fauno!
     
    32
    Posts
    6
    Years
  • Maybe you need
    Code:
    attr_accessor :dButton
    In the FightMenuDisplay class?
    (But if that doesn't work you should wait for fauno, because I'm just guessing based on the code and the error message, I haven't tried making the change).

    Thanks for telling me! I already did that when I noticed that OP probably forgot to mention it. Now that I checked again, the only mistake I made was calling it dynamaxButton instead of dButton in attr_accessor.
    Anyway, when I did that the error disappeared but I still can't seem to activate the dynamax function during a battle. The button for it doesn't appear either.
    Let's see if OP knows anything about it.
     
    37
    Posts
    6
    Years
  • Thanks for telling me! I already did that when I noticed that OP probably forgot to mention it. Now that I checked again, the only mistake I made was calling it dynamaxButton instead of dButton in attr_accessor.
    Anyway, when I did that the error disappeared but I still can't seem to activate the dynamax function during a battle. The button for it doesn't appear either.
    Let's see if OP knows anything about it.

    This is due to the fact that you did not include Dynamax maps in the required 'def', I said in the code that the system checks if the player is on a certain map that you set to enable the function, remove the lines in Dynamax battler:
    In 'def pbCanDynamax?(index)'
    Code:
    return false if !@battlers[index].hasDynamax?

    and in 'def pbDynamax(index)':

    Code:
    return if !(@battlers[index].hasDynamax? rescue false)

    for cancel that verification.
     

    Soccersam

    Hilbert is Badass
    179
    Posts
    7
    Years
    • Seen Feb 26, 2024
    I know this is off-topic, but I just had to ask- how on earth did you get the trainer to speak in-battle? I am guessing the question mark before the Weezing Dynamax form change was the trainer sprite, so how did you get it to speak during the battle? I've been looking around to implement this feature, but with no luck so far.
     
    37
    Posts
    6
    Years
  • I know this is off-topic, but I just had to ask- how on earth did you get the trainer to speak in-battle? I am guessing the question mark before the Weezing Dynamax form change was the trainer sprite, so how did you get it to speak during the battle? I've been looking around to implement this feature, but with no luck so far.

    Well, this code is not part of Dynamax as you know, I just customized it to use in my project, I believe there is some tutorial about it, you can include it inside 'Dynamax Battler' in 'PokeBattle_Battle'.
     

    Soccersam

    Hilbert is Badass
    179
    Posts
    7
    Years
    • Seen Feb 26, 2024
    Well, this code is not part of Dynamax as you know, I just customized it to use in my project, I believe there is some tutorial about it, you can include it inside 'Dynamax Battler' in 'PokeBattle_Battle'.

    Well, yes, that's the thing. I can't find that tutorial/script anywhere, either here or in the RC forums, so I was wondering where you got your hands on that.
     
    32
    Posts
    4
    Years
    • Seen Sep 19, 2023
    Hola necesito ayuda, al momento de usar el movimiento lo ejecuta como un movimiento normal, tengo equipada la DBAND, pero no aparece el cursor


    sorry i can't english.
     

    Diegou18

    Forever Chandelure lover.
    75
    Posts
    6
    Years
    • Seen Aug 16, 2021
    Hola necesito ayuda, al momento de usar el movimiento lo ejecuta como un movimiento normal, tengo equipada la DBAND, pero no aparece el cursor


    sorry i can't english.

    (This method was given by fauno. I only translated it to make it understandable for the guy of the post before mine).

    Quita las líneas en Dinamax battler:

    -Dentro de 'def pbCanDynamax?(index)' borra esto:
    Code:
    return false if !@battlers[index].hasDynamax?

    Y en 'def pbDynamax(index)' borra esto:
    Code:
    return if !(@battlers[index].hasDynamax? rescue false)
     

    #Not Important

    All hail the wishmaker
    910
    Posts
    4
    Years
  • Does this work for v17.2...
    Last time I checked this i couldnt find some things and messaged u as pfrompallet...
     
    Back
    Top