• 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] New ability for v19

5
Posts
11
Years
    • Seen Jan 8, 2023
    Hi,
    I'm trying to make an ability that on switch in check the opponent's stats like Download does, but I wanted to make it so that if the user is faster than the opponent they get a stat boost. I'm struggling to figure out how to get the ability to check the Pokemon's speed stats and determine who is faster. I have the code to raise the stat (it's just Intrepid Sword at this point) but I just wanted the condition on it. Would love any help. Thanks.

    BattleHandlers::AbilityOnSwitchIn.add(:JUSTIFICATION,
    proc { |ability,battler,battle|
    battler.pbRaiseStatStageByAbility(:ATTACK,1,battler)
    }
    )
     

    StCooler

    Mayst thou thy peace discover.
    9,295
    Posts
    4
    Years
    • Seen yesterday
    Hi,
    I'm trying to make an ability that on switch in check the opponent's stats like Download does, but I wanted to make it so that if the user is faster than the opponent they get a stat boost. I'm struggling to figure out how to get the ability to check the Pokemon's speed stats and determine who is faster. I have the code to raise the stat (it's just Intrepid Sword at this point) but I just wanted the condition on it. Would love any help. Thanks.

    BattleHandlers::AbilityOnSwitchIn.add(:JUSTIFICATION,
    proc { |ability,battler,battle|
    battler.pbRaiseStatStageByAbility(:ATTACK,1,battler)
    }
    )

    Hi, if it's "like Download" then try to adapt the code for Download ^^
    I am not sure I understand you ability though. The user gets a boost if it is faster than the opponent? Or maybe you mean "slower"?

    Code:
    BattleHandlers::AbilityOnSwitchIn.add(:JUSTIFICATION,
      proc { |ability,battler,battle|
        battle.eachOtherSideBattler(battler.index) do |b|
          # Raises speed once if one opponent has a higher speed.
          next if battler.speed > b.speed
          battler.pbRaiseStatStageByAbility(:SPEED,1,battler)
          break 
        end
      }
    )

    The idea is: check the speed of all the opponents; if one is faster than the holder of the ability, then boost its speed just once.
     
    5
    Posts
    11
    Years
    • Seen Jan 8, 2023
    Yeah, I realize that I wasn't super clear with what my idea was. But the code you have was the idea, though it would raise attack if the user was slower (I changed that my self). Code is working, didn't realize it was as simple as "next if battler.speed > b.speed". I keep trying to over complicate the code and that never ends up working.
    Thanks!
     
    Back
    Top