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

[Error] Does anyone understand this error?

57
Posts
4
Years
    • Seen Apr 17, 2022
    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:

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

    Boonzeet

    Pokémon Secrets of the Ages Developer
    188
    Posts
    15
    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
     
    57
    Posts
    4
    Years
    • Seen Apr 17, 2022
    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
    Code:
    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
     
    285
    Posts
    5
    Years
    • Seen Oct 1, 2023
    I am missing the
    Code:
    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:
    Code:
      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
    [B]    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[/B]
        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
     
    57
    Posts
    4
    Years
    • Seen Apr 17, 2022
    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:
    Code:
      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
    [B]    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[/B]
        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:
     

    Boonzeet

    Pokémon Secrets of the Ages Developer
    188
    Posts
    15
    Years
  • In class PokeBattle_ActiveField, inside def initialize, have you initalized @effects[PBEffects::PsychicTerrain] ?

    You'll need to add this:
    @effects[PBEffects::PsychicTerrain] = 0
     
    57
    Posts
    4
    Years
    • Seen Apr 17, 2022
    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.
     
    Back
    Top