• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Move Script Issues

  • 40
    Posts
    4
    Years
    • Seen Jan 13, 2022
    I am trying to code it to where if a Pokemon has the ability Formula Gear, Shift Gear gives double the Attack and Speed boosts. But my attempts have failed.
    Here is the latest code, if you could help, I would appreciate it:
    Code:
    class PokeBattle_Move_036 < PokeBattle_MultiStatUpMove
      def initialize(battle,move)
        super
        if !b.hasActiveAbility?(:FORMULAGEAR)
          @statUp = [PBStats::SPEED,2,PBStats::ATTACK,1]
        end
        @statUp = [PBStats::SPEED,4,PBStats::ATTACK,2]
      end
    end
     
    Just adapt it with your custom move (change '137' to a new move number):
    Code:
    #===============================================================================
    # Increases the user's and its ally's Defense and Special Defense by 1 stage
    # each, if they have Plus or Minus. (Magnetic Flux)
    #===============================================================================
    # NOTE: In Gen 5, this move should have a target of UserSide, while in Gen 6+ it
    #       should have a target of UserAndAllies. This is because, in Gen 5, this
    #       move shouldn't call def pbSuccessCheckAgainstTarget for each Pokémon
    #       currently in battle that will be affected by this move (i.e. allies
    #       aren't protected by their substitute/ability/etc., but they are in Gen
    #       6+). We achieve this by not targeting any battlers in Gen 5, since
    #       pbSuccessCheckAgainstTarget is only called for targeted battlers.
    class PokeBattle_Move_137 < PokeBattle_Move
      def ignoresSubstitute?(user); return true; end
    
      def pbMoveFailed?(user,targets)
        @validTargets = []
        @battle.eachSameSideBattler(user) do |b|
          next if !b.hasActiveAbility?([:MINUS,:PLUS])
          next if !b.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self) &&
                  !b.pbCanRaiseStatStage?(PBStats::SPDEF,user,self)
          @validTargets.push(b)
        end
        if @validTargets.length==0
          @battle.pbDisplay(_INTL("But it failed!"))
          return true
        end
        return false
      end
    
      def pbFailsAgainstTarget?(user,target)
        return false if @validTargets.any? { |b| b.index==target.index }
        return true if !target.hasActiveAbility?([:MINUS,:PLUS])
        @battle.pbDisplay(_INTL("{1}'s stats can't be raised further!",target.pbThis))
        return true
      end
    
    
      def pbEffectAgainstTarget(user,target)
        showAnim = true
        if target.pbCanRaiseStatStage?(PBStats::DEFENSE,user,self)
          if target.pbRaiseStatStage(PBStats::DEFENSE,1,user,showAnim)
            showAnim = false
          end
        end
        if target.pbCanRaiseStatStage?(PBStats::SPDEF,user,self)
          target.pbRaiseStatStage(PBStats::SPDEF,1,user,showAnim)
        end
      end
    
      def pbEffectGeneral(user)
        return if pbTarget(user)==PBTargets::UserAndAllies
        @validTargets.each { |b| pbEffectAgainstTarget(user,b) }
      end
    end
     
    Back
    Top