• 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!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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!
  • 409
    Posts
    11
    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:
    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.
     
    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:
    Also to recognize who is the opponent you can check how Destint Bond move or Intimidate ability works.
     
    Last edited:
    I have even transformed Destiny Bond as ability as well, under the name of Herbalility
     
    Back
    Top