• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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] Problems with z move addon

  • 87
    Posts
    5
    Years
    Hi, I'm entering the code for the addon script manually (I'm using the version adapted for 17.2) but it gives me an error in this line:

    side=(pbIsOpposing?(self.index)) ? 1 : 0


    It's in PokeBattle_Battler


    Plz help me
     
    You need to post your entire error to us.
     
    side=(pbIsOpposing?(self.index)) ? 1 : 0
    [email protected](self.index)
    if @battle.zMove[side]==self.index && (move.pbIsPhysical?(move.type) || move.pbIsSpecial?(move.type))
    target=PBTargets::SingleNonUser
    end
     
    You didn't show to us what I asked. We need your errorlog.txt. Example:
    Code:
    [Pokémon Essentials version 17.2]
    Exception: NameError
    Message: undefined local variable or method `thismove' for #<PokeBattle_Battler:0x9a841c8>
    PokeBattle_Battler:3291:in `pbDancerMoveCheck'
    PokeBattle_Battler:3283:in `each'
    PokeBattle_Battler:3283:in `pbDancerMoveCheck'
    PokeBattle_Battler:3281:in `each'
    PokeBattle_Battler:3281:in `pbDancerMoveCheck'
    PokeBattle_Battler:3536:in `pbUseMove'
    PokeBattle_Battler:3775:in `pbProcessTurn'
    PokeBattle_Battler:3774:in `logonerr'
    PokeBattle_Battler:3774:in `pbProcessTurn'
    PokeBattle_Battle:2914:in `pbAttackPhase'

    But here what I have:
    Code:
      def pbTarget(move)
        target=move.target
        if move.function==0x10D && pbHasType?(:GHOST); target=PBTargets::OppositeOpposing; end # Curse
        side=(pbIsOpposing?(self.index)) ? 1 : 0; [email protected](self.index)
        if @battle.zMove[side][owner]==self.index && (move.pbIsPhysical?(move.type) || move.pbIsSpecial?(move.type))
          target=PBTargets::SingleNonUser
        end        
        return target
      end

    Maybe you didn't paste correctly. Also, other code than I have and can help you:
    Code:
      def pbUseMoveSimple(moveid,index=-1,target=-1)
        choice=[]
        choice[0]=1       # "Use move"
        choice[1]=index   # Index of move to be used in user's moveset
        choice[2]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(moveid)) # PokeBattle_Move object of the move
        choice[2].pp=-1
        choice[3]=target  # Target (-1 means no target yet)
        if index>=0
          @battle.choices[@index][1]=index
        end
        PBDebug.log("#{pbThis} used simple move #{choice[2].name}")
        side=(@battle.pbIsOpposing?(self.index)) ? 1 : 0
        [email protected](self.index)
        if @battle.zMove[side][owner]==self.index
          crystal = pbZCrystalFromType(choice[2].type)
          PokeBattle_ZMoves.new(@battle,self,choice[2],crystal,choice)
        else
          pbUseMove(choice,true)
        end    
        return
      end
     
    Sorry i'm a noob XD this is the errorlog:

    Script 'PokeBattle_Battler' line 2658 NoMethodError occured.

    undefined method 'index' for PokeBattle_Battler:Class
     
    You didn't show to us what I asked. We need your errorlog.txt. Example:
    Code:
    [Pokémon Essentials version 17.2]
    Exception: NameError
    Message: undefined local variable or method `thismove' for #<PokeBattle_Battler:0x9a841c8>
    PokeBattle_Battler:3291:in `pbDancerMoveCheck'
    PokeBattle_Battler:3283:in `each'
    PokeBattle_Battler:3283:in `pbDancerMoveCheck'
    PokeBattle_Battler:3281:in `each'
    PokeBattle_Battler:3281:in `pbDancerMoveCheck'
    PokeBattle_Battler:3536:in `pbUseMove'
    PokeBattle_Battler:3775:in `pbProcessTurn'
    PokeBattle_Battler:3774:in `logonerr'
    PokeBattle_Battler:3774:in `pbProcessTurn'
    PokeBattle_Battle:2914:in `pbAttackPhase'

    But here what I have:
    Code:
      def pbTarget(move)
        target=move.target
        if move.function==0x10D && pbHasType?(:GHOST); target=PBTargets::OppositeOpposing; end # Curse
        side=(pbIsOpposing?(self.index)) ? 1 : 0; [email protected](self.index)
        if @battle.zMove[side][owner]==self.index && (move.pbIsPhysical?(move.type) || move.pbIsSpecial?(move.type))
          target=PBTargets::SingleNonUser
        end        
        return target
      end

    Maybe you didn't paste correctly. Also, other code than I have and can help you:
    Code:
      def pbUseMoveSimple(moveid,index=-1,target=-1)
        choice=[]
        choice[0]=1       # "Use move"
        choice[1]=index   # Index of move to be used in user's moveset
        choice[2]=PokeBattle_Move.pbFromPBMove(@battle,PBMove.new(moveid)) # PokeBattle_Move object of the move
        choice[2].pp=-1
        choice[3]=target  # Target (-1 means no target yet)
        if index>=0
          @battle.choices[@index][1]=index
        end
        PBDebug.log("#{pbThis} used simple move #{choice[2].name}")
        side=(@battle.pbIsOpposing?(self.index)) ? 1 : 0
        [email protected](self.index)
        if @battle.zMove[side][owner]==self.index
          crystal = pbZCrystalFromType(choice[2].type)
          PokeBattle_ZMoves.new(@battle,self,choice[2],crystal,choice)
        else
          pbUseMove(choice,true)
        end    
        return
      end

    OK, but where I paste it?
     
    So I need to replace this?:

    def pbTarget(move)
    target=move.target
    if move.function==0x10D && pbHasType?(:GHOST) # Curse
    target=PBTargets::OppositeOpposing
    end
    return target
    end
    side=(pbIsOpposing?(self.index)) ? 1 : 0
    [email protected](self.index)
    if @battle.zMove[side]==self.index && (move.pbIsPhysical?(move.type) || move.pbIsSpecial?(move.type))
    target=PBTargets::SingleNonUser
    end
     
    I solved it but i have another problem: when I use a normal move the game tells me this but it keeps going on:

    Exeption: NoMethodError
    Message: undefined method 'zmove' for

    and after that there are a lot of lines
     
    I think he doesn't recognizes the method, but I don't know how to make them calculate it

    But I will follow your advice

    The error is in Pokebattle_battle but I copied everything right

    So the error is that doesn't recognizes the method

    (The 'z move' method)

    The error is in Pokebattle_battle but I copied everything right

    So the error is that doesn't recognizes the method

    (The 'z move' method)
     
    Last edited by a moderator:
    Anyway this is the error image:

    And that are the codes:(sorry if too long)


    From line 313 to line 323:

    @zMove = []
    if @player.is_a?(Array)
    @zMove[0]=[-1]*@player.length
    else
    @zMove[0]=[-1]
    end
    if @opponent.is_a?(Array)
    @zMove[1]=[-1]*@opponent.length
    else
    @zMove[1]=[-1]
    end

    Line 461:

    return true if pbIsZCrystal?(item)

    From line 558 to line 566:

    def pbHasZRing(battlerIndex)
    return true if !pbBelongsToPlayer?(battlerIndex)
    for i in MEGARINGS
    next if !hasConst?(PBItems,i)
    return true if $PokemonBag.pbQuantity(i)>0
    end
    return false
    end


    From line 813 at line 816:

    def zMove
    return @zMove
    end

    From line 1057 at line 1059:

    if @choices[2].zmove && (@choices[2].pbIsPhysical?(@choices[2].type) || @choices[2].pbIsSpecial?(@choices[2].type))
    pri=0
    end

    From line 1238 at line1240:

    if @zMove[side]==idxPokemon
    @zMove[side]=-1
    end

    From line 1516 at line 1518:

    if @zMove[side]==idxPokemon
    @zMove[side]=-1
    end

    From line 1777 at line 1810:


    ################################################################################
    # Use Z-Move.
    ################################################################################
    def pbCanZMove?(index)
    return false if $game_switches[NO_Z_MOVE]
    return false if !@battlers[index].hasZMove?
    return false if !pbHasZRing(index)
    side=(pbIsOpposing?(index)) ? 1 : 0
    owner=pbGetOwnerIndex(index)
    return false if @zMove[side]!=-1
    return true
    end

    def pbRegisterZMove(index)
    side=(pbIsOpposing?(index)) ? 1 : 0
    owner=pbGetOwnerIndex(index)
    @zMove[side]=index
    end

    def pbUseZMove(index,move,crystal)
    return if !@battlers[index] || !@battlers[index].pokemon
    return if !(@battlers[index].hasZMove? rescue false)
    ownername=pbGetOwner(index).fullname
    ownername=pbGetOwner(index).name if pbBelongsToPlayer?(index)
    pbDisplay(_INTL("{1} surrounded itself with its Z-Power!",@battlers[index].pbThis))
    pbCommonAnimation("ZPower",@battlers[index],nil)
    PokeBattle_ZMoves.new(self,@battlers[index],move,crystal)
    side=(pbIsOpposing?(index)) ? 1 : 0
    owner=pbGetOwnerIndex(index)
    @zMove[side]=-2
    end


    From line 2649 at line 2654:

    for i in 0...@zMove[0].length
    @zMove[0]=-1 if @zMove[0]>=0
    end
    for i in 0...@zMove[1].length
    @zMove[1]=-1 if @zMove[1]>=0
    end

    In this see the red codes:

    if @zMove[side]==i
    @zMove[side]=-1
    end

    break
    end
    next if !pbRegisterMove(i,index)
    if @doublebattle
    thismove=@battlers.moves[index]
    target=@battlers.pbTarget(thismove)
    if target==PBTargets::SingleNonUser # single non-user
    [email protected](i,target)
    next if target<0
    pbRegisterTarget(i,target)
    elsif target==PBTargets::UserOrPartner # Acupressure
    [email protected](i,target)
    next if target<0 || (target&1)==1
    pbRegisterTarget(i,target)
    end
    end
    commandDone=true
    end
    else
    pbAutoChooseMove(i)
    commandDone=true
    end
    elsif cmd!=0 && @battlers.effects[PBEffects::SkyDrop]
    pbDisplay(_INTL("Sky Drop won't let {1} go!",@battlers.pbThis(true)))
    elsif cmd==1 # Bag
    if !@internalbattle
    if pbOwnedByPlayer?(i)
    pbDisplay(_INTL("Items can't be used here."))
    end
    else
    item=pbItemMenu(i)
    if item[0]>0
    if pbRegisterItem(i,item[0],item[1])
    commandDone=true
    end
    end
    end
    elsif cmd==2 # Pokémon
    pkmn=pbSwitchPlayer(i,false,true)
    if pkmn>=0
    commandDone=true if pbRegisterSwitch(i,pkmn)
    end
    elsif cmd==3 # Run
    run=pbRun(i)
    if run>0
    commandDone=true
    return
    elsif run<0
    commandDone=true
    side=(pbIsOpposing?(i)) ? 1 : 0
    owner=pbGetOwnerIndex(i)
    if @megaEvolution[side]==i
    @megaEvolution[side]=-1
    end
    if @zMove[side]==i
    @zMove[side]=-1
    end

    end
    elsif cmd==4 # Call
    thispkmn=@battlers
    @choices[0]=4 # "Call Pokémon"
    @choices[1]=0
    @choices[2]=nil
    side=(pbIsOpposing?(i)) ? 1 : 0
    owner=pbGetOwnerIndex(i)
    if @megaEvolution[side]==i
    @megaEvolution[side]=-1
    end
    if @zMove[side]==i
    @zMove[side]=-1
    end

    commandDone=true
    elsif cmd==-1 # Go back to first battler's choice
    @megaEvolution[0][0]=-1 if @megaEvolution[0][0]>=0
    @megaEvolution[1][0]=-1 if @megaEvolution[1][0]>=0
    @zMove[0][0]=-1 if @zMove[0][0]>=0
    @zMove[1][0]=-1 if @zMove[1][0]>=0

    # Restore the item the player's first Pokémon was due to use
    if @choices[0][0]==3 && $PokemonBag && $PokemonBag.pbCanStore?(@choices[0][1])
    $PokemonBag.pbStoreItem(@choices[0][1])
    end
    pbCommandPhase
    return
    end
    break if commandDone
    end
    end
    end
    end
    end

    ################################################################################
    # Attack phase.
    ################################################################################
    def pbAttackPhase
    @scene.pbBeginAttackPhase
    for i in 0...4
    @successStates.clear
    if @choices[0]!=1 && @choices[0]!=2
    @battlers.effects[PBEffects::DestinyBond]=false
    @battlers.effects[PBEffects::Grudge]=false
    end
    @battlers.turncount+=1 if !@battlers.fainted?
    @battlers.effects[PBEffects::Rage]=false if !pbChoseMove?(i,:RAGE)
    end
    # Prepare for Z Moves
    for i in 0..3
    next if @choices[0]!=1
    side=(pbIsOpposing?(i)) ? 1 : 0
    owner=pbGetOwnerIndex(i)
    if @zMove[side]==i
    @choices[2].zmove=true
    end
    end


     

    Attachments

    • [PokeCommunity.com] Problems with z move addon
      Errorlog.png
      20.5 KB · Views: 12
    Last edited:
    The error is in line 1057 (I think, because I changed that line and the error message changed):


    if @choices[2].zmove && (@choices[2].pbIsPhysical?(@choices[2].type) || @choices[2].pbIsSpecial?(@choices[2].type))


    p.s.: The red word is where I think the error is
     
    Last edited:
    Yes, you're right about where the error is. The PokeBattle_Move class seems not to have one of: attr_reader :zmove, attr_writer :zmove, or def zmove. Unfortunately that's not enough information to know how to fix it—if you added one of those you'd still need to actually set zmove to something. I assume the problem here is that you were supposed to make changes in PokeBattle_Move but have either forgotten to, or accidentally made them somewhere else.
     
    Back
    Top