• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Cyndy, May, Hero (Conquest), or Wes - 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] Custom Ability

  • 6
    Posts
    8
    Years
    • Seen May 4, 2017
    I've created some custom abilities but actually i dont know how to haddle this concept.

    I want to create an ability like sturdy or something that just makes the pokemon inmortal BUT, he can take damage up to 1hp remaining and then its ability activates (so the battle seems fair until that).

    Is it even possible?
     
    No, he wants to make an ability that always leaves the user with at least 1 HP, regardless of how much damage the move should have done. No restriction that the Pokemon needed to be at full health to trigger it, which means it triggers forever and the Pokemon cannot be killed. Think of it less like Sturdy and more like an infinite Endure.

    Endure is found on line 1168 of the script section PokeBattle_Move. By adding in the red lines, you have your ability as described:
    Code:
            if @function==0xE9 # False Swipe
              damage=damage-1
            [COLOR="Red"]elsif opponent.hasWorkingAbility(:GODSENDURANCE)
              damage=damage-1[/COLOR]
            elsif opponent.effects[PBEffects::Endure]
              damage=damage-1
              opponent.damagestate.endured=true
              PBDebug.log("[Lingering effect triggered] #{opponent.pbThis}'s Endure")
            elsif damage==opponent.totalhp
              if opponent.hasWorkingAbility(:STURDY) && !attacker.hasMoldBreaker
                opponent.damagestate.sturdy=true
                damage=damage-1
                PBDebug.log("[Ability triggered] #{opponent.pbThis}'s Sturdy")
              elsif opponent.hasWorkingItem(:FOCUSSASH) && opponent.hp==opponent.totalhp
                opponent.damagestate.focussash=true
                damage=damage-1
                PBDebug.log("[Item triggered] #{opponent.pbThis}'s Focus Sash")
              elsif opponent.hasWorkingItem(:FOCUSBAND) && @battle.pbRandom(10)==0
                opponent.damagestate.focusband=true
                damage=damage-1
                PBDebug.log("[Item triggered] #{opponent.pbThis}'s Focus Band")
              end
            end

    Note, however, that abilities like this still leave the Pokemon vulnerable to certain things that can kill them:
    - Poison damage, unless the Pokemon is Poison type and was not poisoned by a Pokemon with the ability Corrosion
    - Burn damage, unless the Pokemon is Fire type
    - Nightmare damage
    - hail damage, unless the Pokemon is Ice or Steel type
    - sandstorm damage, unless the Pokemon is Rock, Ground, or Steel type
    - Shadow Sky damage, unless the Pokemon is a Shadow Pokemon.
     
    Last edited:
    That was much easier than I thought. Wow.
    Thank you, I will do the rest by my own :)
     
    Back
    Top