• 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] Abilities

3
Posts
3
Years
    • Seen Oct 19, 2020
    Hello, I was working in making some abilities and I wondered if there was a way to make a poison touch kind of ability but for special moves, instead of having to make contact.
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    If you CTRL + Shift + F search for "POISONTOUCH", you'll find its code in PokeBattle_Battler, under the function "pbEffectsOnDealingDamage". The entire function is split into two parts - abilities that only activate on contact moves, and abilities that don't care. Poison Touch is in the section for contact moves, so if you want to make an ability that doesn't care, then you need to put it in the other section. For example, you could put it under the code for Weak Armor, like so:
    Code:
    if target.hasWorkingAbility(:WEAKARMOR) && move.pbIsPhysical?(movetype)
      if target.pbReduceStatWithCause(PBStats::DEFENSE,1,target,PBAbilities.getName(target.ability))
        PBDebug.log("[Ability triggered] #{target.pbThis}'s Weak Armor (lower Defense)")
      end
      if target.pbIncreaseStatWithCause(PBStats::SPEED,1,target,PBAbilities.getName(target.ability))
        PBDebug.log("[Ability triggered] #{target.pbThis}'s Weak Armor (raise Speed)")
      end
    end
    # Find the code above, add the code below
    if user.hasWorkingAbility(:NEWABILITY,true) && move.pbIsSpecial?(movetype) &&
               target.pbCanPoison?(nil,false) && @battle.pbRandom(10)<3
      PBDebug.log("[Ability triggered] #{user.pbThis}'s NEW ABILITY")
      target.pbPoison(user,_INTL("{1}'s {2} poisoned {3}!",user.pbThis,
      PBAbilities.getName(user.ability),target.pbThis(true)))
    end
     
    Back
    Top