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

Shinies in Safari Zone error, and NoMethodError

78
Posts
10
Years
    • Seen Sep 7, 2015
    Hey,
    I'm encountering two script errors in my game:

    1. When you're in the safari zone, and you encounter a shiny pokemon it gives this error:
    Exception: NoMethodError
    Message: undefined method `battlescene' for #<PokeBattle_SafariZone:0xa9f61c8>
    PokeBattle_Scene:2305:in `pbStartBattle'
    PokeBattle_SafariZone:112:in `pbStartBattle'
    PBattle_Safari:114:in `pbSafariBattle'
    PBattle_Safari:113:in `pbSceneStandby'
    PBattle_Safari:115:in `pbSafariBattle'
    PBattle_Safari:112:in `pbBattleAnimation'
    PBattle_Safari:112:in `pbSafariBattle'
    PBattle_Safari:102
    PBattle_Safari:96:in `call'
    Event:54:in `trigger'
    2.When you use certain moves in a double battle, it gives a error like this:
    Exception: NoMethodError
    Message: undefined method `isOpposing?' for #<PokeBattle_Battle:0xb1a8a20>
    PokeBattle_MoveEffects:3169:in `pbEffect'
    PokeBattle_Battler:3128:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3086:in `each'
    PokeBattle_Battler:3086:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3499:in `pbUseMove'
    PokeBattle_Battler:3473:in `loop'
    PokeBattle_Battler:3502:in `pbUseMove'
    PokeBattle_Battler:3705:in `pbProcessTurn'
    PokeBattle_Battler:3704:in `logonerr'
    PokeBattle_Battler:3704:in `pbProcessTurn
     

    Zeak6464

    Zeak #3205 - Discord
    1,101
    Posts
    11
    Years
  • Hey,
    I'm encountering two script errors in my game:

    1. When you're in the safari zone, and you encounter a shiny pokemon it gives this error:
    Exception: NoMethodError
    Message: undefined method `battlescene' for #<PokeBattle_SafariZone:0xa9f61c8>
    PokeBattle_Scene:2305:in `pbStartBattle'
    PokeBattle_SafariZone:112:in `pbStartBattle'
    PBattle_Safari:114:in `pbSafariBattle'
    PBattle_Safari:113:in `pbSceneStandby'
    PBattle_Safari:115:in `pbSafariBattle'
    PBattle_Safari:112:in `pbBattleAnimation'
    PBattle_Safari:112:in `pbSafariBattle'
    PBattle_Safari:102
    PBattle_Safari:96:in `call'
    Event:54:in `trigger'
    2.When you use certain moves in a double battle, it gives a error like this:
    Exception: NoMethodError
    Message: undefined method `isOpposing?' for #<PokeBattle_Battle:0xb1a8a20>
    PokeBattle_MoveEffects:3169:in `pbEffect'
    PokeBattle_Battler:3128:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3086:in `each'
    PokeBattle_Battler:3086:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3499:in `pbUseMove'
    PokeBattle_Battler:3473:in `loop'
    PokeBattle_Battler:3502:in `pbUseMove'
    PokeBattle_Battler:3705:in `pbProcessTurn'
    PokeBattle_Battler:3704:in `logonerr'
    PokeBattle_Battler:3704:in `pbProcessTurn

    You need to fix these

    PokeBattle_Scene:2305:in `pbStartBattle'

    PokeBattle_MoveEffects:3169:in `pbEffect'
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Now try saying what changes you've made to the scripts.
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    I didn't really change anything just using the script I got from the Gen 6 addition if anything.
     
    824
    Posts
    8
    Years
  • Actually, even though you might not have changed anything to do with the Safari Zone directly, you could have changed something. I've had two different instances - first when I added the stat modifier display that I was having viewport problems with, second when I added a mode that allowed any Mega Stone to work on any Pokemon - where I'd change the battle system and end up breaking the safari zone because I'd add an accessor to battlers but not to fake battlers (which are what the Safari Zone uses).
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    Actually, even though you might not have changed anything to do with the Safari Zone directly, you could have changed something. I've had two different instances - first when I added the stat modifier display that I was having viewport problems with, second when I added a mode that allowed any Mega Stone to work on any Pokemon - where I'd change the battle system and end up breaking the safari zone because I'd add an accessor to battlers but not to fake battlers (which are what the Safari Zone uses).

    Going along that line, to try to make this easier to look at here are the two scripts in their entirety:
    # Show shiny animation for wild Pokémon
    if @battle.party2[0].isShiny? && @battle.battlescene
    pbCommonAnimation("Shiny",@battle.battlers[1],nil)
    end
    if @battle.party2.length==2
    if @battle.party2[1].isShiny? && @battle.battlescene
    pbCommonAnimation("Shiny",@battle.battlers[3],nil)
    end
    end
    end
    and for the other one:
    ################################################################################
    # The target's ally loses 1/16 of its max HP.
    ################################################################################
    class PokeBattle_Move_074 < PokeBattle_Move
    def pbEffect(attacker,opponent,hitnum=0,alltargets=nil,showanimation=true)
    ret=super(attacker,opponent,hitnum,alltargets,showanimation)
    if opponent.pbPartner && !opponent.pbPartner.isFainted? && !opponent.pbPartner.hasWorkingAbility(:MAGICGUARD)
    opponent.pbPartner.pbReduceHP(opponent.pbPartner.totalhp/16)
    if @battle.IsOpposing?(opponent.pbPartner.index)
    @battle.pbDisplay(_INTL("The bursting flame hit the opposing {2}!",opponent.pbPartner.pbThis))
    else
    @battle.pbDisplay(_INTL("The bursting flame hit {2}!",opponent.pbPartner.pbThis(true)))
    end
    end
    return ret
    end
    end
    I didnt edit anything else about these scripts... hope this helps.
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    I'm still struggling with the whole safari script, I've tried changing it but it still.won't work.
     
    Last edited:
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    Now try saying what changes you've made to the scripts.
    # Show shiny animation for wild Pokémon
    if @battle.party2[0].isShiny? && @battle.battlescene
    pbCommonAnimation("Shiny",@battle.battlers[1],nil)
    end
    if @battle.party2.length==2
    if @battle.party2[1].isShiny? && @battle.battlescene
    pbCommonAnimation("Shiny",@battle.battlers[3],nil)
    end
    end
    end
    I didnt change any of the scripts, it came that way.
    Also, this is urgent issue for the game to work correctly.....Just Saying.
     
    Last edited:
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    This issue is making the game to work correctly so I'm trying to get someone's attention to assist me in fixing it, if someone can.
     
    91
    Posts
    14
    Years
    • Seen Sep 5, 2015
    In my PokeBattle_Safari there isn't any "battlescene". Have you tried replacing that script with a fresh one from a clean project?
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    In my PokeBattle_Safari there isn't any "battlescene". Have you tried replacing that script with a fresh one from a clean project?
    The shiny issue resides in the PokeBattle_Scene not the PokeBattle_Safari section....
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    Hey,
    I'm encountering two script errors in my game:

    1. When you're in the safari zone, and you encounter a shiny pokemon it gives this error:
    Exception: NoMethodError
    Message: undefined method `battlescene' for #<PokeBattle_SafariZone:0xa9f61c8>
    PokeBattle_Scene:2305:in `pbStartBattle'
    PokeBattle_SafariZone:112:in `pbStartBattle'
    PBattle_Safari:114:in `pbSafariBattle'
    PBattle_Safari:113:in `pbSceneStandby'
    PBattle_Safari:115:in `pbSafariBattle'
    PBattle_Safari:112:in `pbBattleAnimation'
    PBattle_Safari:112:in `pbSafariBattle'
    PBattle_Safari:102
    PBattle_Safari:96:in `call'
    Event:54:in `trigger'
    2.When you use certain moves in a double battle, it gives a error like this:
    Exception: NoMethodError
    Message: undefined method `isOpposing?' for #<PokeBattle_Battle:0xb1a8a20>
    PokeBattle_MoveEffects:3169:in `pbEffect'
    PokeBattle_Battler:3128:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3086:in `each'
    PokeBattle_Battler:3086:in `pbProcessMoveAgainstTarget'
    PokeBattle_Battler:3499:in `pbUseMove'
    PokeBattle_Battler:3473:in `loop'
    PokeBattle_Battler:3502:in `pbUseMove'
    PokeBattle_Battler:3705:in `pbProcessTurn'
    PokeBattle_Battler:3704:in `logonerr'
    PokeBattle_Battler:3704:in `pbProcessTurn
    1. Your problem:
    Code:
          if @battle.party2[0].isShiny? && [COLOR=Red][B]@battle.battlescene[/B][/COLOR]
            pbCommonAnimation("Shiny",@battle.battlers[1],nil)
          end
          if @battle.party2.length==2
            if @battle.party2[1].isShiny? && @battle.battlescene
              pbCommonAnimation("Shiny",@battle.battlers[3],nil)
            end
    So look in:
    Code:
    class [COLOR=Red]PokeBattle_Battle[/COLOR]
      attr_reader(:scene)             # Scene object for this battle
      attr_accessor(:decision)        # Decision: 0=undecided; 1=win; 2=loss; 3=escaped; 4=caught
      attr_accessor(:internalbattle)  # Internal battle flag
      attr_accessor(:doublebattle)    # Double battle flag
      attr_accessor(:cantescape)      # True if player can't escape
      attr_accessor(:shiftStyle)      # Shift/Set "battle style" option
     [B][COLOR=Red] attr_accessor(:battlescene)     # "Battle scene" option[/COLOR][/B]
      attr_accessor(:debug)           # Debug flag
    Check that battlescene exists. The clue is in the error.
    On a side note, any script that calls @battle will refer to scripts within PokeBattle_Battle, any script that calls @scene, refers to scripts within PokeBattle_Scene.

    2. isOpposing? is not a real method. Change it to pbIsOpposing?.
     
    Last edited:
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    1. Your problem:
    Code:
          if @battle.party2[0].isShiny? && [COLOR=Red][B]@battle.battlescene[/B][/COLOR]
            pbCommonAnimation("Shiny",@battle.battlers[1],nil)
          end
          if @battle.party2.length==2
            if @battle.party2[1].isShiny? && @battle.battlescene
              pbCommonAnimation("Shiny",@battle.battlers[3],nil)
            end
    So look in:
    Code:
    class [COLOR=Red]PokeBattle_Battle[/COLOR]
      attr_reader(:scene)             # Scene object for this battle
      attr_accessor(:decision)        # Decision: 0=undecided; 1=win; 2=loss; 3=escaped; 4=caught
      attr_accessor(:internalbattle)  # Internal battle flag
      attr_accessor(:doublebattle)    # Double battle flag
      attr_accessor(:cantescape)      # True if player can't escape
      attr_accessor(:shiftStyle)      # Shift/Set "battle style" option
     [B][COLOR=Red] attr_accessor(:battlescene)     # "Battle scene" option[/COLOR][/B]
      attr_accessor(:debug)           # Debug flag
    Check that battlescene exists. The clue is in the error.
    On a side note, any script that calls @battle will refer to scripts within PokeBattle_Battle, any script that calls @scene, refers to scripts within PokeBattle_Scene.

    2. isOpposing? is not a real method. Change it to pbIsOpposing?.

    Thank you so much for the help :)
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    1. Your problem:
    Code:
          if @battle.party2[0].isShiny? && [COLOR=Red][B]@battle.battlescene[/B][/COLOR]
            pbCommonAnimation("Shiny",@battle.battlers[1],nil)
          end
          if @battle.party2.length==2
            if @battle.party2[1].isShiny? && @battle.battlescene
              pbCommonAnimation("Shiny",@battle.battlers[3],nil)
            end
    So look in:
    Code:
    class [COLOR=Red]PokeBattle_Battle[/COLOR]
      attr_reader(:scene)             # Scene object for this battle
      attr_accessor(:decision)        # Decision: 0=undecided; 1=win; 2=loss; 3=escaped; 4=caught
      attr_accessor(:internalbattle)  # Internal battle flag
      attr_accessor(:doublebattle)    # Double battle flag
      attr_accessor(:cantescape)      # True if player can't escape
      attr_accessor(:shiftStyle)      # Shift/Set "battle style" option
     [B][COLOR=Red] attr_accessor(:battlescene)     # "Battle scene" option[/COLOR][/B]
      attr_accessor(:debug)           # Debug flag
    Check that battlescene exists. The clue is in the error.
    On a side note, any script that calls @battle will refer to scripts within PokeBattle_Battle, any script that calls @scene, refers to scripts within PokeBattle_Scene.

    2. isOpposing? is not a real method. Change it to pbIsOpposing?.
    So if I change the @battle.battlescene to @scene.battlescene it should work? I already defined the battlescene in my PokeBattle_Battle. But the same error came up.
     

    Nickalooose

    --------------------
    1,309
    Posts
    16
    Years
    • Seen Dec 28, 2023
    No you're missing the point here, any script that has @scene will refer to PokeBattle_Scene, @battle refers to PokeBattle_Battle... And your problem is within @battle (PokeBattle_Battle), it's called, reading between the lines.

    Just make sure you have the 'accessor' for battlescene and it should work, don't change anything except the pbIsOpposite? bit.

    Unfortunately, without knowing the changes you've made, I can't help much more than that, because you're the only one having this problem and many have downloaded the Gen VI Add-On... I downloaded it today and all seems fine except that pbIsOpposite? thing, which is nothing to do with me so the owner will have to fix that properly, which you're welcome to post in that thread.
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    No you're missing the point here, any script that has @scene will refer to PokeBattle_Scene, @battle refers to PokeBattle_Battle... And your problem is within @battle (PokeBattle_Battle), it's called, reading between the lines.

    Just make sure you have the 'accessor' for battlescene and it should work, don't change anything except the pbIsOpposite? bit.

    Unfortunately, without knowing the changes you've made, I can't help much more than that, because you're the only one having this problem and many have downloaded the Gen VI Add-On... I downloaded it today and all seems fine except that pbIsOpposite? thing, which is nothing to do with me so the owner will have to fix that properly, which you're welcome to post in that thread.

    Sorry if I'm reading this wrong, but it seems that you're also getting frustrated with this issue. I am also getting burnt out with this issue at hand. I'm a newb to Essentials,Scripting, and making a game. That's why I often post questions that I have on the Essentials Thread. I know for a fact that I only changed minor things like an function error here or there with the help of the people here on the Community. The only reason I keep working towards this issue is because of the fact that if I release the game I'm making with the issue in the game, it would result in people losing progress that they made during the game. That (in my own experience) was a real letdown when I played someones game, and I lost progress because of an error similar to this one.Also, sometimes I'm not the best at reading between the lines, so yeah. The only part I'm confused about now is the fact that here (And your problem is within @battle (PokeBattle_Battle), it's called, reading between the lines.) What I get from that is that there's some type of error with the PokeBattle_Battle script, but I fixed the part for the Acessor by adding it into the PokeBattle_Battle script. I looked all around the Gen VI thread,but I couldn't find a thing to help. So as of right now, I'm stuck. (Also, If you want to see the full script in a PM or on the thread, I can provide that for you.)
     
    Last edited:

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Exception: NoMethodError
    Message: undefined method `battlescene' for #<PokeBattle_SafariZone:0xa9f61c8>
    The error message is in English, and if you can't understand what it's saying, then I don't think you should be trying to make a game. (I'm not saying I think you're too stupid to understand it; I'm just making a general comment that some people can't, and since you really should be understanding what you're doing rather than just blindly following instructions - and messing them up, most likely - and then complaining blindly again once it still doesn't work, well, figuring out what an error message in plain English is saying is quite paramount.)

    This is an error in Essentials. It is a known error, and there's probably already been a solution posted if you cared to look for it - searching for the key word "battlescene" would have been a smart idea.

    This error occurs at the start of Safari battles only, as has been observed, when a shiny Pokémon appears. It's caused by the scripts wanting to see if it should show the shiny sparkle animation (you can disable them in the Options menu), but the variable which says whether the animation should be shown (called battlescene) is not accessible in the battle class (which is PokeBattle_SafariZone in this case). Since the variable is being accessed from outside the battle class (it's a method in class PokeBattle_Scene that wants it, because Scene is all about the visual stuff and a shiny sparkly animation is a visual thing), you need a method which can access this variable... and this method doesn't exist.

    Go into the script section PokeBattle_SafariZone, and find the start of class PokeBattle_SafariZone (about line 33). Amongst the other lines that say attr_accessor :somethingorother, add a line that says attr_accessor :battlescene.

    attr_accessor (and attr_reader and attr_writer) are shorthand ways of making a method that allows a particular variable to be accessed from outside the class it's in. attr_accessor is actually shorthand for both attr_reader (lets you look at the variable) and attr_writer (lets you change the variable). So with a bit of logic, we can see how adding the line I mentioned in the previous paragraph will now give access to the battlescene variable from outside that class, which is what we want.

    But wait! We may now be able to look at the variable, but it's got nothing in it. It'll be nil, but it should be either true or false (so many colours...). It needs a value. Thinking about it, there aren't really any animations that need disabling in a Safari battle - there's only the shiny one and the Safari Ball's BallBurst one when it absorbs the Pokémon. The variable might as well always be true, rather than depend on what the player selected in the Options menu. So we need to make battlescene true. How?

    Go into the script section PokeBattle_SafariZone, and find class PokeBattle_SafariZone (starting at about line 33). There'll be a def initialize in there, and in that, a line that says @decision=0. Insert a new line there, that says @battlescene=true.

    So now we're able to access the variable from the place we want to access it from, and it's the value it should be. Done. Perhaps this explanation of what was going on helped. If it did, then I'd rather it inspire you to figure further things out for yourself, rather than expect more such explanations from me in future.

    Exception: NoMethodError
    Message: undefined method `isOpposing?' for #<PokeBattle_Battle:0xb1a8a20>
    This is an error with the effect of the move Flame Burst, which was added in the Gen 6 pack. In this case, an appropriate method does already exist, but it has a slightly different name. This is just a typo. Find the single line of code which contains .isOpposing? (include the full stop before it when searching to make it easier) and rename that to what it should be. You've been told what it should be.

    2.When you use certain moves in a double battle, it gives a error like this:
    Incidentally, you really could/should have been more helpful with this. If you're aware that it only happens for "certain" moves, say which one(s) they are. Even if you think it could happen for more moves than just the one(s) you know about, you should still list the one(s) you know about. Give all the information you can, which includes what you were doing at the time the error occurred.
     
    78
    Posts
    10
    Years
    • Seen Sep 7, 2015
    The error message is in English, and if you can't understand what it's saying, then I don't think you should be trying to make a game. (I'm not saying I think you're too stupid to understand it; I'm just making a general comment that some people can't, and since you really should be understanding what you're doing rather than just blindly following instructions - and messing them up, most likely - and then complaining blindly again once it still doesn't work, well, figuring out what an error message in plain English is saying is quite paramount.)

    This is an error in Essentials. It is a known error, and there's probably already been a solution posted if you cared to look for it - searching for the key word "battlescene" would have been a smart idea.

    This error occurs at the start of Safari battles only, as has been observed, when a shiny Pokémon appears. It's caused by the scripts wanting to see if it should show the shiny sparkle animation (you can disable them in the Options menu), but the variable which says whether the animation should be shown (called battlescene) is not accessible in the battle class (which is PokeBattle_SafariZone in this case). Since the variable is being accessed from outside the battle class (it's a method in class PokeBattle_Scene that wants it, because Scene is all about the visual stuff and a shiny sparkly animation is a visual thing), you need a method which can access this variable... and this method doesn't exist.

    Go into the script section PokeBattle_SafariZone, and find the start of class PokeBattle_SafariZone (about line 33). Amongst the other lines that say attr_accessor :somethingorother, add a line that says attr_accessor :battlescene.

    attr_accessor (and attr_reader and attr_writer) are shorthand ways of making a method that allows a particular variable to be accessed from outside the class it's in. attr_accessor is actually shorthand for both attr_reader (lets you look at the variable) and attr_writer (lets you change the variable). So with a bit of logic, we can see how adding the line I mentioned in the previous paragraph will now give access to the battlescene variable from outside that class, which is what we want.

    But wait! We may now be able to look at the variable, but it's got nothing in it. It'll be nil, but it should be either true or false (so many colours...). It needs a value. Thinking about it, there aren't really any animations that need disabling in a Safari battle - there's only the shiny one and the Safari Ball's BallBurst one when it absorbs the Pokémon. The variable might as well always be true, rather than depend on what the player selected in the Options menu. So we need to make battlescene true. How?

    Go into the script section PokeBattle_SafariZone, and find class PokeBattle_SafariZone (starting at about line 33). There'll be a def initialize in there, and in that, a line that says @decision=0. Insert a new line there, that says @battlescene=true.

    So now we're able to access the variable from the place we want to access it from, and it's the value it should be. Done. Perhaps this explanation of what was going on helped. If it did, then I'd rather it inspire you to figure further things out for yourself, rather than expect more such explanations from me in future.


    This is an error with the effect of the move Flame Burst, which was added in the Gen 6 pack. In this case, an appropriate method does already exist, but it has a slightly different name. This is just a typo. Find the single line of code which contains .isOpposing? (include the full stop before it when searching to make it easier) and rename that to what it should be. You've been told what it should be.


    Incidentally, you really could/should have been more helpful with this. If you're aware that it only happens for "certain" moves, say which one(s) they are. Even if you think it could happen for more moves than just the one(s) you know about, you should still list the one(s) you know about. Give all the information you can, which includes what you were doing at the time the error occurred.

    Thanks for the advice ,and the support. :)
     
    Back
    Top