• 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.

Weather Inducing Move Wrong Somewhere?

220
Posts
13
Years
  • Seen Nov 29, 2021
Uncompiling Moves

Spoiler:

Okay, four moves that share similar code, all of which crash. Something is wrong with them but what?
Code:
class PokeBattle_Move_135 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561&&564&&576&&591)
        multiplier = 2
      end
       return basedmg*multiplier
     end
     
def pbAdditionalEffect(attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561 && 564 && 576 && 591)
      multiplier = 2
    end
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanParalyze?(false)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
        return true
    end
    return false
  end
Code:
class PokeBattle_Move_136 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561&&564&&576&&591)
        multiplier = 2
      end
       return basedmg*multiplier
     end
     
def pbAdditionalEffect(attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561 && 564 && 576 && 591)
      multiplier = 2
    end
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanBurn?(false)
        opponent.pbBurn(attacker)
        @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
        return true
    end
    return false
  end
Code:
class PokeBattle_Move_137 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561&&564&&576&&591)
        multiplier = 2
      end
       return basedmg*multiplier
     end
     
def pbAdditionalEffect(attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561 && 564 && 576 && 591)
      multiplier = 2
    end
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanPoison?(false)
        opponent.pbPosion(attacker)
        @battle.pbDisplay(_INTL("{1} was poisoned!",opponent.pbThis))
        return true
    end
    return false
  end
Code:
class PokeBattle_Move_138 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561&&564&&576&&591)
        multiplier = 2
      end
       return basedmg*multiplier
     end
     
def pbAdditionalEffect(attacker,opponent)
    multiplier = 1
    moveIDs = Array.new
    moveIDs << attacker.moves[0].id
    moveIDs << attacker.moves[1].id
    moveIDs << attacker.moves[2].id
    moveIDs << attacker.moves[3].id
    if (moveIDs.include? 561 && 564 && 576 && 591)
      multiplier = 2
    end
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanConfuse?(false)
        opponent.effects[PBEffects::Confusion][email protected](4)
        @battle.pbCommonAnimation("Confusion",attacker,opponent)
        @battle.pbDisplay(_INTL("{1} became confused!",opponent.pbThis))
        return true
    end
    return false
  end
 
Last edited:

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
So I implimented a new weather type, which compiles nicely. However, the inducing move causes an error an compile attempt. What am I doing wrong?
Code:
class PokeBattle_Move_140 < PokeBattle_Move
  def pbEffect(attacker,opponent)
    if @battle.weather==PBWeather::DARKNESS
      @battle.pbDisplay(_INTL("But it failed!"))
      return -1
    [COLOR=Red]els[/COLOR]if @battle.weather==PBWeather::GENTLEBREEZE
      @battle.pbDisplay(_INTL("{1} Does not want to disrupt the Gentle Breeze", attacker.pbThis))
      return -1
    else
      @battle.weather=PBWeather::DARKNESS
      @battle.weatherduration=5
      @battle.pbDisplay(_INTL("Darkness descended upon the field!"))
      return 0
    end
  end
end
Three little missing letters.
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
It's best not to edit earlier posts, because people aren't likely to notice. It's especially pointless if you make a new post anyway, because you can/should just put your new question in your new post instead.

Anyway, that include? business looks wrong. Replace every instance of this:

Code:
moveIDs = Array.new
moveIDs << attacker.moves[0].id
moveIDs << attacker.moves[1].id
moveIDs << attacker.moves[2].id
moveIDs << attacker.moves[3].id
if (moveIDs.include? 561&&564&&576&&591)
  multiplier = 2
end
...with this:

Code:
multiplier=2 if pbHasMove?(attacker,:TACKLE) &&
                pbHasMove?(attacker,:SANDATTACK) &&
                pbHasMove?(attacker,:TAILWHIP) &&
                pbHasMove?(attacker,:GROWL)
Simpler, more readable, and it works.

I swear I've answered this question before, many months ago. The same misuse of include?, the multiple moves with the same problem, everything.
 
220
Posts
13
Years
  • Seen Nov 29, 2021
Yes it was the effect portion of the moves. I guess that's what I get from basing my work on other people (it was a previous programmer who left :/ ).

So I tried:
Code:
class PokeBattle_Move_135 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    multiplier=2 if pbHasMove?(attacker,:ALPHASHOCK) &&
                    pbHasMove?(attacker,:BETAFLAME) &&
                    pbHasMove?(attacker,:GAMMASPORE) &&
                    pbHasMove?(attacker,:DELTAWAVE)
    else multiplier=1
    return basedmg*multiplier
  end
     
def pbAdditionalEffect(attacker,opponent)
    multiplier=2 if pbHasMove?(attacker,:ALPHASHOCK) &&
                    pbHasMove?(attacker,:BETAFLAME) &&
                    pbHasMove?(attacker,:GAMMASPORE) &&
                    pbHasMove?(attacker,:DELTAWAVE)
    else multiplier=1
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanParalyze?(false)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
        return true
    end
    return false
  end

But that doesn't work. :S What's wrong with it?
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
What's wrong is the part where you didn't do as I said. I told you which specific lines to replace, yet you also deleted an extra one and added an (incorrect) extra one.

Code:
class PokeBattle_Move_135 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    [COLOR=Green]multiplier=1[/COLOR]
    multiplier=2 if pbHasMove?(attacker,:ALPHASHOCK) &&
                    pbHasMove?(attacker,:BETAFLAME) &&
                    pbHasMove?(attacker,:GAMMASPORE) &&
                    pbHasMove?(attacker,:DELTAWAVE)
    [COLOR=Red]else multiplier=1[/COLOR]
    return basedmg*multiplier
  end
     
def pbAdditionalEffect(attacker,opponent)
    [COLOR=Green]multiplier=1[/COLOR]
    multiplier=2 if pbHasMove?(attacker,:ALPHASHOCK) &&
                    pbHasMove?(attacker,:BETAFLAME) &&
                    pbHasMove?(attacker,:GAMMASPORE) &&
                    pbHasMove?(attacker,:DELTAWAVE)
    [COLOR=Red]else multiplier=1[/COLOR]
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanParalyze?(false)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
        return true
    end
    return false
  end
Delete the red lines, and add the green lines back in.
 
220
Posts
13
Years
  • Seen Nov 29, 2021
this also errors:
Code:
class PokeBattle_Move_135 < PokeBattle_Move
  def pbBaseDamage(basedmg,attacker,opponent)
    multiplier=1
    multiplier=2 if pbHasMove?(attacker,:ALPHASHOCK) &&
                    pbHasMove?(attacker,:BETAFLAME) &&
                    pbHasMove?(attacker,:GAMMASPORE) &&
                    pbHasMove?(attacker,:DELTAWAVE)
    return basedmg*multiplier
  end
     
def pbAdditionalEffect(attacker,opponent)
    multiplier=1
    multiplier=2 if pbHasMove?(attacker,:ALPHASHOCK) &&
                    pbHasMove?(attacker,:BETAFLAME) &&
                    pbHasMove?(attacker,:GAMMASPORE) &&
                    pbHasMove?(attacker,:DELTAWAVE)
    [email protected](10/multiplier)
    case rnd
      when 0
        return false if !opponent.pbCanParalyze?(false)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
        return true
    end
    return false
  end
:S

EDIT: Just noticed a new version was released. I think this is in V8 (the 15/5/12 release at least), could that be the cause? If so, is there an easy way to port from one to the other?
 
Last edited:

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
Make sure you've got enough ends in there. The code you've provided is missing one at the bottom of it to close off the class (that applies to each of the four lots of code you provided).

In future, try telling us what the problem actually is, rather than saying it's an "error". We figured that part out already. There will always be some kind of message that pops up telling you something's gone wrong, and the trick is to read it and tell us what it said.

What do you mean, patronising? :cheeky:
 
220
Posts
13
Years
  • Seen Nov 29, 2021
Oh that explains it! I thought it was odd that I kept pointing to the last line of the entire script each time >.<

EDIT: Thanks, that works now!
 
220
Posts
13
Years
  • Seen Nov 29, 2021
Okay, it seems the weather is having problems somewhere. When the weather is in effect, moves that target others don't work, it just says "X used Y." and moves on.
This is what's under pbAccuracyCheck (literally right under):
Code:
    if @battle.pbWeather==PBWeather::DARKNESS &&
       !attacker.pbHasType(:DARK) && !attacker.pbHasType(:LIGHT) &&
       !isConst?(attacker.ability,PBAbilities,:NIGHTVISION)
      accuracy=(accuracy*9/10).floor
    elsif @battle.pbWeather==PBWeather::DARKNESS &&
       isConst?(attacker.ability,PBAbilities,:NIGHTVISION)
      accuracy=(accuracy*1.3).floor
    end

I think that's the culprit, but if not say and I'll root through for the other darkness-related stuff.
 
220
Posts
13
Years
  • Seen Nov 29, 2021
So this is one of my earlier moves that will probably make a lot of people cringe. Problem is, when used ingame, it doesn't appear to raise stats. It's supposed to raise all stats then have to recharge.
Code:
class PokeBattle_Move_141 < PokeBattle_Move
  def pbEffect(attacker,opponent)
    ret=super(attacker,opponent)
    if opponent.damagestate.calcdamage>0
      attacker.effects[PBEffects::HyperBeam]=2
      attacker.currentMove=@id
    end
    return ret
    if !attacker.pbTooHigh?(PBStats::ATTACK)
      attacker.stages[PBStats::ATTACK]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Attack rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::DEFENSE)
      attacker.stages[PBStats::DEFENSE]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPEED)
      attacker.stages[PBStats::SPEED]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Speed rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPATK)
      attacker.stages[PBStats::SPATK]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Special Attack rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPDEF)
      attacker.stages[PBStats::SPDEF]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::ACCURACY)
      attacker.stages[PBStats::ACCURACY]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Accuracy rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::EVASION)
      attacker.stages[PBStats::EVASION]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Evasion rose!",attacker.pbThis))
    end
    return true
  end
end

EDIT: Grr, this one won't work either. It's *supposed* to inflict a random status ailment.
Code:
class PokeBattle_Move_148 < PokeBattle_Move
  def pbAdditionalEffect(attacker,opponent)
    [email protected](10)
    case rnd
      when 0
        return false if !opponent.pbCanBurn?(true)
        opponent.pbBurn(attacker)
        @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
      when 1
        return false if !opponent.pbCanFreeze?(true)
        opponent.pbFreeze
        @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
      when 2
        return false if !opponent.pbCanParalyze?(true)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
      when 3
        return false if !opponent.pbCanPoison?(true)
        opponent.pbPoison(attacker)
        @battle.pb.Display(_INTL("{1} was poisoned!",opponent.pbThis))
      when 4
        return false if !opponent.pbCanSleep?(true)
        opponent.pbSleep
        @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
      when 5
        return false if !opponent.pbCanBurn?(true)
        opponent.pbBurn(attacker)
        @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
      when 6
        return false if !opponent.pbCanSleep?(true)
        opponent.pbSleep
        @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
      when 7
        return false if !opponent.pbCanParalyze?(true)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
      when 8
        return false if !opponent.pbCanPoison?(true)
        opponent.pbPoison(attacker)
        @battle.pb.Display(_INTL("{1} was poisoned!",opponent.pbThis))
      when 9
        return false if !opponent.pbCanSleep?(true)
        opponent.pbSleep
        @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
    end
    return true
  end
end
 
Last edited:

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
Code:
class PokeBattle_Move_141 < PokeBattle_Move
  def pbEffect(attacker,opponent)
    ret=super(attacker,opponent)
    if opponent.damagestate.calcdamage>0
      attacker.effects[PBEffects::HyperBeam]=2
      attacker.currentMove=@id
    end
    [COLOR=Red]return ret[/COLOR]
    [COLOR=Green]haveanim=false[/COLOR]
    if !attacker.pbTooHigh?(PBStats::ATTACK)
      attacker.stages[PBStats::ATTACK]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Attack rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::DEFENSE)
      attacker.stages[PBStats::DEFENSE]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPEED)
      attacker.stages[PBStats::SPEED]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Speed rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPATK)
      attacker.stages[PBStats::SPATK]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Special Attack rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::SPDEF)
      attacker.stages[PBStats::SPDEF]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::ACCURACY)
      attacker.stages[PBStats::ACCURACY]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Accuracy rose!",attacker.pbThis))
    end
    if !attacker.pbTooHigh?(PBStats::EVASION)
      attacker.stages[PBStats::EVASION]+=1
      @battle.pbCommonAnimation("StatUp",attacker,nil) if !haveanim; haveanim=true
      @battle.pbDisplay(_INTL("{1}'s Evasion rose!",attacker.pbThis))
    end
    return true
  end
end
Delete the red line, add the green line.


Code:
class PokeBattle_Move_148 < PokeBattle_Move
  def pbAdditionalEffect(attacker,opponent)
    [email protected](10)
    case rnd
      when 0
        return false if !opponent.pbCanBurn?(true)
        opponent.pbBurn(attacker)
        @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
      when 1
        return false if !opponent.pbCanFreeze?(true)
        opponent.pbFreeze
        @battle.pbDisplay(_INTL("{1} was frozen solid!",opponent.pbThis))
      when 2
        return false if !opponent.pbCanParalyze?(true)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
      when 3
        return false if !opponent.pbCanPoison?(true)
        opponent.pbPoison(attacker)
        @battle.[COLOR=Red]pb.Display[/COLOR](_INTL("{1} was poisoned!",opponent.pbThis))
      when 4
        return false if !opponent.pbCanSleep?(true)
        opponent.pbSleep
        @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
      when 5
        return false if !opponent.pbCanBurn?(true)
        opponent.pbBurn(attacker)
        @battle.pbDisplay(_INTL("{1} was burned!",opponent.pbThis))
      when 6
        return false if !opponent.pbCanSleep?(true)
        opponent.pbSleep
        @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
      when 7
        return false if !opponent.pbCanParalyze?(true)
        opponent.pbParalyze(attacker)
        @battle.pbDisplay(_INTL("{1} is paralyzed!  It may be unable to move!",opponent.pbThis))
      when 8
        return false if !opponent.pbCanPoison?(true)
        opponent.pbPoison(attacker)
        @battle.pb.Display(_INTL("{1} was poisoned!",opponent.pbThis))
      when 9
        return false if !opponent.pbCanSleep?(true)
        opponent.pbSleep
        @battle.pbDisplay(_INTL("{1} went to sleep!",opponent.pbThis))
    end
    return true
  end
end
Fix the extraneous dot in the red part. Other than that, though, the code itself is correct. Make sure the move as defined in moves.txt has an additional effect probability of [whatever] rather than 0 (maybe 30?).
 
Back
Top