Seen 10 Hours Ago
Posted 4 Days Ago
37 posts
1.1 Years
Hey, I have been having problems installing the 6-8 gen Abilities, but I have already managed to fix many errors. But there is one that I don't understand. Is this:
Spoiler:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for nil:NilClass
PokeBattle_Battler:2703:in `pbSuccessCheck'
PokeBattle_Battler:3085:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:3081:in `each'
PokeBattle_Battler:3081:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:3625:in `pbUseMove'
PokeBattle_Battler:3605:in `loop'
PokeBattle_Battler:3628:in `pbUseMove'
PokeBattle_Battler:3828:in `pbProcessTurn'
PokeBattle_Battler:3827:in `logonerr'
PokeBattle_Battler:3827:in `pbProcessTurn'
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `>' for nil:NilClass
PokeBattle_Battle:3638:in `__clauses__pbEndOfRoundPhase'
PokeBattle_Battle:3637:in `each'
PokeBattle_Battle:3637:in `__clauses__pbEndOfRoundPhase'
PokeBattle_Clauses:42:in `pbEndOfRoundPhase'
PokeBattle_Battle:2599:in `pbStartBattleCore'
PokeBattle_Battle:2598:in `logonerr'
PokeBattle_Battle:2598:in `pbStartBattleCore'
PokeBattle_Battle:2580:in `loop'
PokeBattle_Battle:2603:in `pbStartBattleCore'
PokeBattle_Battle:2401:in `pbStartBattle'

Does anyone know why it occurs?
Here I leave the part of the code that is indicated in the error.
Spoiler:

PokeBattle_Battler
   if @battle.field.effects[PBEffects::PsychicTerrain]>0 && p>0 && !target.isAirborne?
      @battle.pbDisplay(_INTL("{1} surrounds itself with psychic terrain!",target.pbThis))
      PBDebug.log("[Move failed] Psychic Terrain stopped the attack")
      return false
    end
 def pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,nocheck=false,alltargets=nil,showanimation=true,danced=false)
    realnumhits=0
    totaldamage=0
    destinybond=false
    for i in 0...numhits <--------------Line 3081
      target.damagestate.reset
      # Check success (accuracy/evasion calculation)
      if !nocheck &&
         !pbSuccessCheck(thismove,user,target,turneffects,i==0 || thismove.successCheckPerHit?)<------------Line 3085
        if thismove.function==0xBF && realnumhits>0   # Triple Kick
          break   # Considered a success if Triple Kick hits at least once
        elsif thismove.function==0x10B   # Hi Jump Kick, Jump Kick
          if !user.hasWorkingAbility(:MAGICGUARD)
            PBDebug.log("[Move effect triggered] #{user.pbThis} took crash damage")
            # TODO: Not shown if message is "It doesn't affect XXX..."
            @battle.pbDisplay(_INTL("{1} kept going and crashed!",user.pbThis))
            damage=(user.totalhp/2).floor
            if damage>0
              @battle.scene.pbDamageAnimation(user,0)
              user.pbReduceHP(damage)
            end
            user.pbFaint if user.isFainted?
          end
        end
 # For each target in turn
      i=0; loop do break if i>=targets.length<------------Line 3605
        # Get next target
        userandtarget=[user,targets[i]]
        success=pbChangeTarget(thismove,userandtarget,targets)
        user=userandtarget[0]
        target=userandtarget[1]
        if i==0 && thismove.target==PBTargets::AllOpposing
          # Add target's partner to list of targets
          pbAddTarget(targets,target.pbPartner)
        end
        # If couldn't get the next target
        if !success
          i+=1
          next
        end
        # Get the number of hits
        numhits=thismove.pbNumHits(user)
        # Reset damage state, set Focus Band/Focus Sash to available
        target.damagestate.reset
        # Use move against the current target
        pbProcessMoveAgainstTarget(thismove,user,target,numhits,turneffects,false,alltargets,showanimation,danced)<------------Line 3625
        showanimation=false
        i+=1
      end<------------Line 3628
    end
   # Use the move
#   @battle.pbDisplayPaused("Before: [#{@lastMoveUsedSketch},#{@lastMoveUsed}]")
    PBDebug.log("#{pbThis} used #{choice[2].name}")
    PBDebug.logonerr{<--------------------------------------------------------Line 3627
       pbUseMove(choice,choice[2][email protected])<------------Line 3828
    }
#   @battle.pbDisplayPaused("After: [#{@lastMoveUsedSketch},#{@lastMoveUsed}]")
    return true
  end
end
PokeBattle_Battle
    # Aurora Veil # changed added
    for i in 0...2<---------------------------------------------------------Line 3637
      if sides[i].effects[PBEffects::AuroraVeil]>0<------------Line 3638
        sides[i].effects[PBEffects::AuroraVeil]-=1
        if sides[i].effects[PBEffects::AuroraVeil]==0
          pbDisplay(_INTL("Your team's Aurora Veil wore off!")) if i==0
          pbDisplay(_INTL("The opposing team's Aurora Veil wore off!")) if i==1
          PBDebug.log("[End of effect] Aurora Veil ended on the player's side") if i==0
          PBDebug.log("[End of effect] Aurora Veil ended on the opponent's side") if i==1
        end
      end
    end
PokeBattle_Clauses
  def pbEndOfRoundPhase()
    __clauses__pbEndOfRoundPhase()<------------Line 42
    if @rules["suddendeath"] && @decision==0
      if pbPokemonCount(@party1)>pbPokemonCount(@party2)
        @decision=1 # loss
      elsif pbPokemonCount(@party1)<pbPokemonCount(@party2)
        @decision=2 # win
      end
    end
  end
end
PokeBattle_Battle
 pbOnActiveAll   # Abilities
    @turncount=0
    loop do   # Now begin the battle loop<------------Line 2580
      PBDebug.log("")
      PBDebug.log("***Round #{@turncount+1}***")
      if @debug && @turncount>=100
        @decision=pbDecisionOnTime()
        PBDebug.log("")
        PBDebug.log("***Undecided after 100 rounds, aborting***")
        pbAbort
        break
      end
      PBDebug.logonerr{
         pbCommandPhase
      }
      break if @decision>0
      PBDebug.logonerr{
         pbAttackPhase
      }
      break if @decision>0
      PBDebug.logonerr{<------------Line 2598
         pbEndOfRoundPhase<------------Line 2599
      }
      break if @decision>0
      @turncount+=1
    end<------------Line 2603
    return pbEndOfBattle(canlose)
  end
def pbStartBattle(canlose=false)
    PBDebug.log("")
    PBDebug.log("******************************************")
    begin
      pbStartBattleCore(canlose)<------------Line 2401
    rescue BattleAbortedException
      @decision=0
      @scene.pbEndBattle(@decision)
    end
    return @decision
  end

Boonzeet

Pokémon Secrets of the Ages Developer

Male
United Kingdom
Seen 2 Hours Ago
Posted 1 Day Ago
152 posts
11.2 Years
Ernnn, what is 'p>0'? It supposed to be 'p=thismove.priority'.
In this if statement it's checking if the moves' priority is greater than 0. P should be defined earlier, but p>0 is right in this location.

Hey, I have been having problems installing the 6-8 gen Abilities
As said above, p in that if statement p is coming up as nil (nonexistent). It should be set to the moves priority, so leave it in but ensure at some point about
p=thismove.priority
is placed
Seen 10 Hours Ago
Posted 4 Days Ago
37 posts
1.1 Years
In this if statement it's checking if the moves' priority is greater than 0. P should be defined earlier, but p>0 is right in this location.



As said above, p in that if statement p is coming up as nil (nonexistent). It should be set to the moves priority, so leave it in but ensure at some point about
p=thismove.priority
is placed
I am missing the
p=thismove.priority
in the code. But I don't know where it should go. Where in Poke_Battler should it go? I'm pretty new to ruby and I have a hard time doing these kinds of things.

Thanks to both
Male
New York
Seen 3 Hours Ago
Posted 10 Hours Ago
67 posts
1.9 Years
I am missing the
p=thismove.priority
in the code. But I don't know where it should go. Where in Poke_Battler should it go? I'm pretty new to ruby and I have a hard time doing these kinds of things.

Thanks to both
I think your problem is where you put this code for Psychic Terrain. I believe this section should go under the code for Quick Guard in Pokebattle_Battler under 'def pbSuccessCheck' so that it looks like this:
  def pbSuccessCheck(thismove,user,target,turneffects,accuracy=true)
    if user.effects[PBEffects::TwoTurnAttack]>0
      return true
    end
    # TODO: "Before Protect" applies to Counter/Mirror Coat
    if thismove.function==0xDE && target.status!=PBStatuses::SLEEP # Dream Eater
      @battle.pbDisplay(_INTL("{1} wasn't affected!",target.pbThis))
      PBDebug.log("[Move failed] #{user.pbThis}'s Dream Eater's target isn't asleep")
      return false
    end
    if thismove.function==0x113 && user.effects[PBEffects::Stockpile]==0 # Spit Up
      @battle.pbDisplay(_INTL("But it failed to spit up a thing!"))
      PBDebug.log("[Move failed] #{user.pbThis}'s Spit Up did nothing as Stockpile's count is 0")
      return false
    end
    if target.effects[PBEffects::Protect] && thismove.canProtectAgainst? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis))
      @battle.successStates[user.index].protected=true
      PBDebug.log("[Move failed] #{target.pbThis}'s Protect stopped the attack")
      return false
    end
    p=thismove.priority
    if USENEWBATTLEMECHANICS
      p+=1 if user.hasWorkingAbility(:PRANKSTER) && thismove.pbIsStatus?
      p+=1 if user.hasWorkingAbility(:GALEWINGS) && isConst?(thismove.type,PBTypes,:FLYING)
    end
    if target.pbOwnSide.effects[PBEffects::QuickGuard] && thismove.canProtectAgainst? &&
       p>0 && !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} was protected by Quick Guard!",target.pbThis))
      PBDebug.log("[Move failed] The opposing side's Quick Guard stopped the attack")
      return false
    end
    if @battle.field.effects[PBEffects::PsychicTerrain] > 0 && p>0 && !target.isAirborne?
      @battle.pbDisplay(_INTL("The Psychic Terrain protected {1}!",target.pbThis))
      PBDebug.log("[Move failed] Psychic Terrain stopped the attack")
      return false
    end
    if target.pbOwnSide.effects[PBEffects::WideGuard] &&
       PBTargets.hasMultipleTargets?(thismove) && !thismove.pbIsStatus? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} was protected by Wide Guard!",target.pbThis))
      PBDebug.log("[Move failed] The opposing side's Wide Guard stopped the attack")
      return false
    end
Currently developing Pokemon Vengeance
Seen 10 Hours Ago
Posted 4 Days Ago
37 posts
1.1 Years
I think your problem is where you put this code for Psychic Terrain. I believe this section should go under the code for Quick Guard in Pokebattle_Battler under 'def pbSuccessCheck' so that it looks like this:
  def pbSuccessCheck(thismove,user,target,turneffects,accuracy=true)
    if user.effects[PBEffects::TwoTurnAttack]>0
      return true
    end
    # TODO: "Before Protect" applies to Counter/Mirror Coat
    if thismove.function==0xDE && target.status!=PBStatuses::SLEEP # Dream Eater
      @battle.pbDisplay(_INTL("{1} wasn't affected!",target.pbThis))
      PBDebug.log("[Move failed] #{user.pbThis}'s Dream Eater's target isn't asleep")
      return false
    end
    if thismove.function==0x113 && user.effects[PBEffects::Stockpile]==0 # Spit Up
      @battle.pbDisplay(_INTL("But it failed to spit up a thing!"))
      PBDebug.log("[Move failed] #{user.pbThis}'s Spit Up did nothing as Stockpile's count is 0")
      return false
    end
    if target.effects[PBEffects::Protect] && thismove.canProtectAgainst? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis))
      @battle.successStates[user.index].protected=true
      PBDebug.log("[Move failed] #{target.pbThis}'s Protect stopped the attack")
      return false
    end
    p=thismove.priority
    if USENEWBATTLEMECHANICS
      p+=1 if user.hasWorkingAbility(:PRANKSTER) && thismove.pbIsStatus?
      p+=1 if user.hasWorkingAbility(:GALEWINGS) && isConst?(thismove.type,PBTypes,:FLYING)
    end
    if target.pbOwnSide.effects[PBEffects::QuickGuard] && thismove.canProtectAgainst? &&
       p>0 && !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} was protected by Quick Guard!",target.pbThis))
      PBDebug.log("[Move failed] The opposing side's Quick Guard stopped the attack")
      return false
    end
    if @battle.field.effects[PBEffects::PsychicTerrain] > 0 && p>0 && !target.isAirborne?
      @battle.pbDisplay(_INTL("The Psychic Terrain protected {1}!",target.pbThis))
      PBDebug.log("[Move failed] Psychic Terrain stopped the attack")
      return false
    end
    if target.pbOwnSide.effects[PBEffects::WideGuard] &&
       PBTargets.hasMultipleTargets?(thismove) && !thismove.pbIsStatus? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} was protected by Wide Guard!",target.pbThis))
      PBDebug.log("[Move failed] The opposing side's Wide Guard stopped the attack")
      return false
    end
I made the change, but it seems to still not work, it produces the same error.
I attach the part of the code, to see if I'm wrong.
And if you still want to help me, I also send you the PokeBattle_Battler code, in case it's another error sooner or later. Sorry to bother you, but I appreciate your help.

Thanks in advance.

CODE: PokeBattle_Battler (before the change)
CODE: PokeBattle_Battler (after the change)

Spoiler:
def pbSuccessCheck(thismove,user,target,turneffects,accuracy=true)
    if user.effects[PBEffects::TwoTurnAttack]>0
      return true
    end
    # TODO: "Before Protect" applies to Counter/Mirror Coat
    if thismove.function==0xDE &&
       ((target.status!=PBStatuses::SLEEP && !target.hasWorkingAbility(:COMATOSE)) ||
       !(user.effects[PBEffects::HealBlock]==0))  # Dream Eater
      @battle.pbDisplay(_INTL("{1} wasn't affected!",target.pbThis))
      PBDebug.log("[Move failed] #{user.pbThis}'s Dream Eater's target isn't asleep")
      return false
    end
    if thismove.function==0x113 && user.effects[PBEffects::Stockpile]==0 # Spit Up
      @battle.pbDisplay(_INTL("But it failed to spit up a thing!"))
      PBDebug.log("[Move failed] #{user.pbThis}'s Spit Up did nothing as Stockpile's count is 0")
      return false
    end
    if target.effects[PBEffects::Protect] && thismove.canProtectAgainst? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} protected itself!",target.pbThis))
      @battle.successStates[user.index].protected=true
      PBDebug.log("[Move failed] #{target.pbThis}'s Protect stopped the attack")
      return false
    end
    p=thismove.priority
    if USENEWBATTLEMECHANICS
      p+=1 if user.hasWorkingAbility(:PRANKSTER) && thismove.pbIsStatus?
      p+=1 if user.hasWorkingAbility(:GALEWINGS) && isConst?(thismove.type,PBTypes,:FLYING)
    end
    if target.pbOwnSide.effects[PBEffects::QuickGuard] && thismove.canProtectAgainst? &&
       p>0 && !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} was protected by Quick Guard!",target.pbThis))
      PBDebug.log("[Move failed] The opposing side's Quick Guard stopped the attack")
      return false
    end
    # Changed added Psychic Terrain
    if @battle.field.effects[PBEffects::PsychicTerrain] > 0 && p>0 && !target.isAirborne?
      @battle.pbDisplay(_INTL("The Psychic Terrain protected {1}!",target.pbThis))
      PBDebug.log("[Move failed] Psychic Terrain stopped the attack")
      return false
    end
    if target.pbOwnSide.effects[PBEffects::WideGuard] &&
       PBTargets.hasMultipleTargets?(thismove) && !thismove.pbIsStatus? &&
       !target.effects[PBEffects::ProtectNegation]
      @battle.pbDisplay(_INTL("{1} was protected by Wide Guard!",target.pbThis))
      PBDebug.log("[Move failed] The opposing side's Wide Guard stopped the attack")
      return false
    end

Boonzeet

Pokémon Secrets of the Ages Developer

Male
United Kingdom
Seen 2 Hours Ago
Posted 1 Day Ago
152 posts
11.2 Years
In class PokeBattle_ActiveField, inside def initialize, have you initalized @effects[PBEffects::PsychicTerrain] ?

You'll need to add this:
@effects[PBEffects::PsychicTerrain] = 0
Seen 10 Hours Ago
Posted 4 Days Ago
37 posts
1.1 Years
In class PokeBattle_ActiveField, inside def initialize, have you initalized @effects[PBEffects::PsychicTerrain] ?

You'll need to add this:
@effects[PBEffects::PsychicTerrain] = 0
Thanks I have worked the error has disappeared. I still get some bugs with abilities like the RKS SYSTEM, which doesn't change type after combat, or Mimikyu's Disguise, which becomes invulnerable when entering its vulnerable form, but I'll try to fix it myself. If I have a problem that I cannot solve, I suppose I will ask again.

Thanks to all three, without you I would not have fixed it. You clearly go to the credits.