• 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] Haze... but as an ability

Pokeminer20

PDM20, Coder of Chaos!
412
Posts
10
Years
  • I'm trying to make an ability that has the same effect as Haze. my trigger is when the foe raises any of their stats. I've tried this but it doesn't trigger.

    Code:
           if self.hasWorkingAbility(:TORRENT)
      def pbEffect(opponent,hitnum=0,alltargets=nil)
        for i in 0...3
         if @battle.battlers[i].stages[PBStats::ATTACK]   >= 1 ||
            @battle.battlers[i].stages[PBStats::DEFENSE]  >= 1 ||
            @battle.battlers[i].stages[PBStats::SPEED]    >= 1 ||
            @battle.battlers[i].stages[PBStats::SPATK]    >= 1 ||
            @battle.battlers[i].stages[PBStats::SPDEF]    >= 1 ||
            @battle.battlers[i].stages[PBStats::ACCURACY] >= 1 ||
            @battle.battlers[i].stages[PBStats::EVASION]  >= 1
        @battle.pbDisplay(_INTL("Stat Change Detected"))
          @battle.battlers[i].stages[PBStats::ATTACK]   = 0
          @battle.battlers[i].stages[PBStats::DEFENSE]  = 0
          @battle.battlers[i].stages[PBStats::SPEED]    = 0
          @battle.battlers[i].stages[PBStats::SPATK]    = 0
          @battle.battlers[i].stages[PBStats::SPDEF]    = 0
          @battle.battlers[i].stages[PBStats::ACCURACY] = 0
          @battle.battlers[i].stages[PBStats::EVASION]  = 0
        end
      end
        @battle.pbDisplay(_INTL("The Foe's Stats have been Reset"))
        return 0
      end
    end
     
    Last edited:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I haven't read it much, but you definitely don't want to put a def inside your if.
     

    Pokeminer20

    PDM20, Coder of Chaos!
    412
    Posts
    10
    Years
  • I haven't read it much, but you definitely don't want to put a def inside your if.

    even with the def outside the if I can get my mon to +6 stats and the ability doesn't trigger. either my trigger is scuffed or my code is scuffed, and I don't know which it is.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Your code is scuffed. Moving the def line around isn't going to help because it's the fact that you're defining a function that's causing the code not to run. I'd recommend you read a Ruby tutorial so that you can better internalize the difference between what:
    Code:
    p "Hello World!"
    Code:
    def hello
      p "Hello World!"
    end
    and
    Code:
    def hello
      p "Hello World!"
    end
    
    hello
    do.
     
    Last edited:

    WolfPP

    Spriter/ Pixel Artist
    1,309
    Posts
    5
    Years
  • Also to recognize who is the opponent you can check how Destint Bond move or Intimidate ability works.
     
    Last edited:

    HM100

    HM100 the Techno
    113
    Posts
    7
    Years
    • Seen Apr 27, 2024
    I have even transformed Destiny Bond as ability as well, under the name of Herbalility
     
    Back
    Top