The PokéCommunity Forums Fan Games Game Development Scripts, Tutorials & Tools
Essentials Script Some Common Custom Abilities People Might Want to Use (All Tested)

Scripts, Tutorials & Tools This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply
 
Thread Tools
  #1    
Old 4 Weeks Ago (10:32 AM). Edited 4 Weeks Ago by Tommaniacal.
Tommaniacal Tommaniacal is offline
     
    Join Date: Apr 2016
    Posts: 29
    Here are some custom abilities I've coded that I've seen in a lot of fangames, and people have asked how to implement. I've tested all of them and they appear to be working correctly :]

    Distract: Breaks the concentration of opposing pokemon upon entering battle, lowering their Sp. Atk stat. (Special version of Intimidate) Suggested users: Kadabra, Alakazam, Gardevoir, Gothitelle
    How to implement:
    Spoiler:
    In PokeBattle_Battler, paste the red code directly below the code for Intimidate:
    Code:
        # Intimidate
        if self.hasWorkingAbility(:INTIMIDATE) && onactive
          PBDebug.log("[Ability triggered] #{pbThis}'s Intimidate")
          for i in 0...4
            if pbIsOpposing?(i) && [email protected][i].fainted?
              @battle.battlers[i].pbReduceAttackStatIntimidate(self)
            end
          end
        end
        # Distract
        if self.hasWorkingAbility(:DISTRACT) && onactive
          PBDebug.log("[Ability triggered] #{pbThis}'s Distract")
          for i in 0...4
            if pbIsOpposing?(i) && [email protected][i].fainted?
              @battle.battlers[i].pbReduceAttackStatDistract(self)
            end
          end
        end
    Then, in PokeBattle_BattlerEffects, paste the red underneath the code for
    Code:
    pbReduceAttackStatIntimidate: 
      def pbReduceAttackStatIntimidate(opponent)
        return false if fainted?
        if effects[PBEffects::Substitute]>0
          @battle.pbDisplay(_INTL("{1}'s substitute protected it from {2}'s {3}!",
             pbThis,opponent.pbThis(true),PBAbilities.getName(opponent.ability)))
          return false
        end
        if !opponent.hasWorkingAbility(:CONTRARY)
          if pbOwnSide.effects[PBEffects::Mist]>0
            @battle.pbDisplay(_INTL("{1} is protected from {2}'s {3} by Mist!",
               pbThis,opponent.pbThis(true),PBAbilities.getName(opponent.ability)))
            return false
          end
          if hasWorkingAbility(:CLEARBODY) || hasWorkingAbility(:WHITESMOKE) ||
             hasWorkingAbility(:HYPERCUTTER) ||
             (hasWorkingAbility(:FLOWERVEIL) && pbHasType?(:GRASS))
            abilityname=PBAbilities.getName(self.ability)
            oppabilityname=PBAbilities.getName(opponent.ability)
            @battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
               pbThis,abilityname,opponent.pbThis(true),oppabilityname))
            return false
          end
          if pbPartner.hasWorkingAbility(:FLOWERVEIL) && pbHasType?(:GRASS)
            abilityname=PBAbilities.getName(pbPartner.ability)
            oppabilityname=PBAbilities.getName(opponent.ability)
            @battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
               pbPartner.pbThis,abilityname,opponent.pbThis(true),oppabilityname))
            return false
          end
        end
        return pbReduceStatWithCause(PBStats::ATTACK,1,opponent,PBAbilities.getName(opponent.ability))
      end
      def pbReduceAttackStatDistract(opponent)
        return false if fainted?
        if effects[PBEffects::Substitute]>0
          @battle.pbDisplay(_INTL("{1}'s substitute protected it from {2}'s {3}!",
             pbThis,opponent.pbThis(true),PBAbilities.getName(opponent.ability)))
          return false
        end
        if !opponent.hasWorkingAbility(:CONTRARY)
          if pbOwnSide.effects[PBEffects::Mist]>0
            @battle.pbDisplay(_INTL("{1} is protected from {2}'s {3} by Mist!",
               pbThis,opponent.pbThis(true),PBAbilities.getName(opponent.ability)))
            return false
          end
          if hasWorkingAbility(:CLEARBODY) || hasWorkingAbility(:WHITESMOKE) ||
             (hasWorkingAbility(:FLOWERVEIL) && pbHasType?(:GRASS))
            abilityname=PBAbilities.getName(self.ability)
            oppabilityname=PBAbilities.getName(opponent.ability)
            @battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
               pbThis,abilityname,opponent.pbThis(true),oppabilityname))
            return false
          end
          if pbPartner.hasWorkingAbility(:FLOWERVEIL) && pbHasType?(:GRASS)
            abilityname=PBAbilities.getName(pbPartner.ability)
            oppabilityname=PBAbilities.getName(opponent.ability)
            @battle.pbDisplay(_INTL("{1}'s {2} prevented {3}'s {4} from working!",
               pbPartner.pbThis,abilityname,opponent.pbThis(true),oppabilityname))
            return false
          end
        end
        return pbReduceStatWithCause(PBStats::SPATK,1,opponent,PBAbilities.getName(opponent.ability))
      end
    end
    This one is super long and easy to mess up, if you get a syntax error look at the code for intimidate; it's nearly identical, and make sure you add it before the very last 'end'


    Vampire Bite: The Pokémon's biting attacks drain half the damage taken by the target. Suggested users: Zubat, Golbat, Crobat, Spinarak, Ariados, Gorebyss
    How to implement:
    Spoiler:
    In PokeBattle_Battler, paste the red code directly below 'if !target.damagestate.substitute' and directly above the code for Cursed Body:
    Code:
          if !target.damagestate.substitute
    #Vampire Bite
            if user.hasWorkingAbility(:VAMPIREBITE) && move.isBitingMove?
              if target.hasWorkingAbility(:LIQUIDOOZE)
                PBDebug.log("[Ability triggered] #{user.pbThis}'s Vampire Bite")
                PBDebug.log("[Ability triggered] #{target.pbThis}'s Liquid Ooze")
                hploss=user.pbReduceHP((target.damagestate.hplost/2).round,true)
                @battle.pbDisplay(_INTL("{1} sucked up the liquid ooze!",user.pbThis))
              else 
                if user.effects[PBEffects::HealBlock]==0
                  PBDebug.log("[Ability triggered] #{user.pbThis}'s Vampire Bite")
                  hpgain=user.pbRecoverHP((target.damagestate.hplost/2).round,true)
                  if hpgain>0
                    @battle.pbDisplay(_INTL("{1}'s Vampire Bite restored its HP!",user.pbThis))
                  end
                end
              end
            end
            if target.hasWorkingAbility(:CURSEDBODY,true) && @battle.pbRandom(10)<3
              if user.effects[PBEffects::Disable]<=0 && move.pp>0 && !user.fainted?
                user.effects[PBEffects::Disable]=3
                user.effects[PBEffects::DisableMove]=move.id
                @battle.pbDisplay(_INTL("{1}'s {2} disabled {3}!",target.pbThis,
                   PBAbilities.getName(target.ability),user.pbThis(true)))
                PBDebug.log("[Ability triggered] #{target.pbThis}'s Cursed Body disabled #{user.pbThis(true)}")
              end
            end


    Steel-Toe: Boosts the power of kicking moves (variant of Iron Fist) Suggested users: Hitmonlee, Blaziken, Lopunny
    How to Implement:
    Spoiler:
    In PokeBattle_Move, add the red code below all of the move flags, 'isBombMove' will probably be the last one:
    Code:
      def isBombMove?
        return (@flags&0x2000)!=0 # flag n: Is bomb move
      end
      def isKickingMove? # Kicking moves
        return ( isConst?(@id,PBMoves,:DOUBLEKICK) ||
               isConst?(@id,PBMoves,:MEGAKICK) ||
               isConst?(@id,PBMoves,:JUMPKICK) ||
               isConst?(@id,PBMoves,:ROLLINGKICK) ||
               isConst?(@id,PBMoves,:LOWKICK) ||
               isConst?(@id,PBMoves,:HIGHJUMPKICK) ||
               isConst?(@id,PBMoves,:TRIPLEKICK) ||
               isConst?(@id,PBMoves,:BLAZEKICK) ||
               isConst?(@id,PBMoves,:BULLDOZE) ||
               isConst?(@id,PBMoves,:STOMP)) 
      end  
    If you added gen 7 moves, add Trop Kick, High Horse Power, and Stomping Tantrum to the list above. Then, underneath the code for Iron Fist, add this:
    Code:
        if attacker.hasWorkingAbility(:IRONFIST) && isPunchingMove?
          damagemult=(damagemult*1.2).round
        end
        if attacker.hasWorkingAbility(:STEELTOE) && isKickingMove?
          damagemult=(damagemult*1.2).round
        end

    There are many other custom abilities that are variants of other moves, for example a special version of Huge Power, but all you have to do is change a few values, so I didn't include those. If you're new to essentials and to coding, I highly recommend looking at the scripts for existing abilities, and basing your new ones off those. It teaches you about coding much more than just looking up how to do it. If you get stuck, then ask people for help :]
    Reply With Quote
    Reply

    Quick Reply

    Join the conversation!

    Create an account to post a reply in this thread, participate in other discussions, and more!

    Create a PokéCommunity Account
    Thread Tools

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -8. The time now is 6:26 PM.