Advertiser Content

Scripting Question Haze... but as an ability

Started by Pokeminer20 September 1st, 2019 10:18 PM
  • 1210 views
  • 5 replies

Pokeminer20

Team Ningo

Male
On Earth
Seen 3 Hours Ago
Posted 1 Week Ago
108 posts
5.6 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.

       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
Proud developer of Project Angel Links

Pokeminer20

Team Ningo

Male
On Earth
Seen 3 Hours Ago
Posted 1 Week Ago
108 posts
5.6 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.
Proud developer of Project Angel Links

mgriffin

Seen 2 Hours Ago
Posted 11 Hours Ago
770 posts
5.6 Years
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:
p "Hello World!"
def hello
  p "Hello World!"
end
and
def hello
  p "Hello World!"
end

hello
do.
Non-binary
Seen 1 Day Ago
Posted 1 Day Ago
70 posts
3 Years
I have even transformed Destiny Bond as ability as well, under the name of Herbalility
ΚΟΡΑ ΚΟΡΕ RPG MAKER XP
http://el.poke-kore.wikia.com/wiki/Qora#Λήψη - Download
http://el.poke-kore.wikia.com/wiki/Qora or just read the greek documentation (Note: May require google translator to read this in English)

My favorite Pokémon from the official games are Alcremie and Keklneon.

My favorite own self made Pokémon are Wikimedia and Frikipaideia
Advertiser Content