• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

[Question] Help Coding Ability that reduce Priority before turn order calculation

  • 10
    Posts
    11
    Years
    • Seen Apr 23, 2022
    I'm trying to program an ability that will treat all incoming increased priority moves as 0 priority, as long as the move is targeting the Pokemon with this ability.
    So say if Kadabra has this ability, is faster and wants to use Signal Beam while Sneasel wants to use Sucker Punch or Quick Attack, Kadabra will use Signal Beam before Sucker Punch or Quick Attack.

    I've tried this but it does not work as expected.

    My Script:
    Code:
    BattleHandlers::PriorityChangeAbility.add(:SUDDENREFLEX,
      proc { |ability,battler,move,pri|
        if move.damagingMove?
          pri = 0 if pri > 0
        end
      }
    )

    Should I implement new ability handlers not part of Essentials code? Or can it be done upon existing codebase?
     
    Unsure if this is the problem, but try adding "next" (without quotation marks) before
    Code:
    pri = 0 if pri > 0
    so that you'd have
    Code:
    next pri = 0 if pri > 0
     
    Unsure if this is the problem, but try adding "next" (without quotation marks) before
    Code:
    pri = 0 if pri > 0
    so that you'd have
    Code:
    next pri = 0 if pri > 0

    Didn't work. The problem appears to be, event handler is triggering for the Pokemon WITH the ability, not for the Pokemon OPPOSING the ability.
    So move and pri belongs to Kadabra (the one with the ability), not Sneasel (the one who's priority should be reduced).

    I need to trigger an event for a pokemon when facing a certain ability.
     
    Sorry, I'll check back later because my PC is very good at finding problems it hadn't had

    Edit: I have looked for a bit, but I have found nothing regarding the enemy pokémon's moves' priority. I'm afraid I can't help
     
    Last edited:
    Back
    Top