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

[Scripting Question] How To Create Abilities? [Essentials v19]

  • 18
    Posts
    3
    Years
    I'm curious on how to make an ability in v19, I all the tutorials I can find are outdated, and the wiki has the one for v20, which I am currently not willing to put in the effort to upgrade to lol.

    I defined my ability in the pbs, abilities.txt
    Code:
    268,RUBYCORE,Ruby Core,"Attack and Speed are sharply raised in a pinch."
    Then I went into BattleHandlers_Abilities.rb and made an attempt at making it so attack and speed are raised by 2 when at 1/3hp or lower
    Code:
    #==============================================================================
    # Ability: Ruby Core
    #==============================================================================
    BattleHandlers::DamageCalcUserAbility.add(:RUBYCORE,
      proc { |ability,user,target,move,mults,baseDmg,type|
        if user.hp <= user.totalhp / 3
          battle.pbShowAbilitySplash(battler)
          battler.pbRaiseStatStageByAbility(:ATTACK,2,SPEED,2,battler)
      }
    )

    What else do I need to do, as it currently doesn't work, and if needed, what needs to be corrected?
     
  • 104
    Posts
    2
    Years
    • Seen Mar 12, 2024
    The easiest way to make new abilities (or moves and items for that matter) is to find a like-styled ability and copy it. There is two abilities that kind of do what you want. The first, and easier one to copy is Berserk.

    Code:
    BattleHandlers::TargetAbilityAfterMoveUse.add(:BERSERK,
      proc { |ability,target,user,move,switched,battle|
        next if !move.damagingMove?
        next if target.damageState.initialHP<target.totalhp/2 || target.hp>=target.totalhp/2
        next if !target.pbCanRaiseStatStage?(:SPECIAL_ATTACK,target)
        target.pbRaiseStatStageByAbility(:SPECIAL_ATTACK,1,target)
      }
    )

    All you would have to do is change the hp amount to 1/3 instead of 1/2, and change the stat gains.

    Code:
    BattleHandlers::TargetAbilityAfterMoveUse.add(:RUBYCORE,
      proc { |ability,target,user,move,switched,battle|
        next if !move.damagingMove?
        next if target.damageState.initialHP<target.totalhp/3 || target.hp>=target.totalhp/3
        next if !target.pbCanRaiseStatStage?(:ATTACK,target)
        target.pbRaiseStatStageByAbility(:ATTACK,2,target)
        next if !target.pbCanRaiseStatStage?(:SPEED,target)
        target.pbRaiseStatStageByAbility(:SPEED,2,target)
      }
    )

    That will only proc when a Pokemon takes damage from a move that drops it below 1/3. So not from Toxic, Leech Seed damage, etc.

    To make it proc on passive damage, you would have to copy the way Wimp Out/Emergency Exit is made, as it is the only ability that procs on passive damage that isn't a form change. However, I couldn't get that to work, and requires alot of script edits and additions. I would recommend making it act like Beserk.
     
    Back
    Top