• 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] Defense curl in the ability?

  • 44
    Posts
    7
    Years
    Hi everyone!
    I'm new to Essentials and i am still trying to learn some basics.
    I am trying to write an ability that does:
    -increase defense by one upon entering into battle.
    -set the [PBEffects::DefenseCurl] to true

    In practice: the pokemon casts defense curl upon switching in. (useful for pokémon with rollout or ice ball like Spheal evolution line).
    The code is the following:

    # Iron Curl
    if self.hasWorkingAbility(:IRONCURL) && onactive
    self.effects[PBEffects::DefenseCurl]=true
    if pbIncreaseStatWithCause(PBStats::DEFENSE,1,self,PBAbilities.getName(ability))
    PBDebug.log("[Ability triggered] #{pbThis}'s Iron curl raises Defense")
    end
    end

    The increase of defense works fine (at least the animation works, i am not sure if the defense really grows). BUT the defense curl doesn't seem to work!
    I really don't know why.. Anyone got an idea?
     
    Last edited:
    There's a mechanic where if you use defense curl and then Rollout or Ice ball, the damage is doubled. It was implemented with the second/third generation.
    The [PBEffects::DefenseCurl] doesn't work properly with this ability because the damage of rollout (or ice ball) doesn't double when I test it.
     
    ok so my knowledge on moves is a little lacking but
    under PokeBattle_MoveEffects
    find shift+=1 if attacker.effects[PBEffects::DefenseCurl]
    and change to
    shift+=1 if attacker.effects[PBEffects::DefenseCurl] || attacker.effects[PBEffects::IronCurl]

    no clue if it'll work but worth a try
     
    You gave me the perfect hint! It was kinda what you said but using attacker.hasWorkingAbility(:IRONCURL) instead. Thanks a lot!
    If someone is interested, here it is the code.
    Insert this in pokebattle_battler (near intimidate or download)
    Code:
    # Iron Curl
        if self.hasWorkingAbility(:IRONCURL) && onactive
          if pbIncreaseStatWithCause(PBStats::DEFENSE,1,self,PBAbilities.getName(ability))
              PBDebug.log("[Ability triggered] #{pbThis}'s Iron curl raises Defense")
          end
        end
    and add the Bold thing in pokebattle_moveeffects:
    Code:
    class PokeBattle_Move_0D3 < PokeBattle_Move
      def pbBaseDamage(basedmg,attacker,opponent)
        shift=(4-attacker.effects[PBEffects::Rollout]) # from 0 through 4, 0 is most powerful
        shift+=1 if attacker.effects[PBEffects::DefenseCurl] [B]|| attacker.hasWorkingAbility(:IRONCURL)[/B]
    ...
    (if you have pokemon elite system, add in EliteBattle_0 the Bold thing)
    Code:
    if self.checkForAbilities(:FRISK,:FOREWARN,:BADDREAMS,:MOODY,:HARVEST,:TRACE,:INTIMIDATE,:[B]IRONCURL[/B])
     
    Last edited:
    Back
    Top