Resource icon

Resource Battle Debug Menu [BDM] for Essentials v.17-v.17.2

Hollow_Ego

Novice
Member
Posts
44
#1
Hollow_Ego submitted a new resource:

Battle Debug Menu [BDM] for Essentials v.17-v.17.2 - Adding Debug Functionality into Battles

Battle Debug Menu [BDM] for Essentials v.17+ (Preview)

Hi everybody,

some of you might have already thought of this while debugging their game: a debug menu that you can use in battle.

Now you can finally use it! This version might still have bugs. It allows for a wide variety of debuging so use it cautiously!

Functionality:
- Set stat changes reaching from -6 to 6
- Change the battlers ability to any implemented one
- Trigger On-Active Abilities (like Intimidate)...
Read more about this resource...
 

Michael

That One Guy
Member
Posts
31
#2
maybe you could add an in battle positioner so that pokemon sprites could be repositioned right there without having to go into the menus.
 

Hollow_Ego

Novice
Member
Posts
44
#4
For EBS you do everything as you would normally, except for the button input.
You need to find this in EBS Scripts:
Ruby:
alias pbCommandMenuEx_ebs pbCommandMenuEx unless self.method_defined?(:pbCommandMenuEx_ebs)
  def pbCommandMenuEx(index,texts,mode=0)
and in this def after
Ruby:
if Input.trigger?(Input::C) || (defined?($mouse) && cw.mouseOver? && $mouse.leftClick?)  # Confirm choice
        pbSEPlay("SE_Select2")
        @ret=cw.index
        @inCMx=false if @battle.doublebattle && !USEBATTLEBASES && @ret > 0
        @lastcmd[index]=@ret
        break
add

Ruby:
elsif Input.trigger?(Input::R) # is the same as S
        pbPlayDecisionSE
        @ret= 5
        break
I haven't tested it much so there might be case where it doesn't work correctly. This script was not made with EBS in mind but should work nontheless.
 

Krahssen

Novice
Member
Posts
12
#5
For EBS you do everything as you would normally, except for the button input.
You need to find this in EBS Scripts:
Ruby:
alias pbCommandMenuEx_ebs pbCommandMenuEx unless self.method_defined?(:pbCommandMenuEx_ebs)
  def pbCommandMenuEx(index,texts,mode=0)
and in this def after
Ruby:
if Input.trigger?(Input::C) || (defined?($mouse) && cw.mouseOver? && $mouse.leftClick?)  # Confirm choice
        pbSEPlay("SE_Select2")
        @ret=cw.index
        @inCMx=false if @battle.doublebattle && !USEBATTLEBASES && @ret > 0
        @lastcmd[index]=@ret
        break
add

Ruby:
elsif Input.trigger?(Input::R) # is the same as S
        pbPlayDecisionSE
        @ret= 5
        break
I haven't tested it much so there might be case where it doesn't work correctly. This script was not made with EBS in mind but should work nontheless.
Yes, that worked perfectly.

Thank you so much!
 

WolfPP

Novice
Member
Posts
12
#6
Oh God, so nice to test battles!
But, i put everything and doenst show the screen when press R or S buttoms.
What could be?

EDIT: im usin v17.2 and ive Zmove scripts

Code:
  def pbCommandPhase
    @scene.pbBeginCommandPhase
#    @scene.pbResetCommandIndices
    for i in 0...4   # Reset choices if commands can be shown
      @battlers[i].effects[PBEffects::SkipTurn]=false
      if pbCanShowCommands?(i) || @battlers[i].fainted?
        @choices[i][0]=0
        @choices[i][1]=0
        @choices[i][2]=nil
        @choices[i][3]=-1
      else
        unless !@doublebattle && pbIsDoubleBattler?(i)
          PBDebug.log("[Reusing commands] #{@battlers[i].pbThis(true)}")
        end
      end
    end
    # Reset choices to perform Mega Evolution if it wasn't done somehow
    if !$forceMegaEvo
      for i in 0...2
        for j in 0...@megaEvolution[i].length
          @megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
        end
      end
    end
      for i in 0...@zMove[0].length
        @zMove[0][i]=-1 if @zMove[0][i]>=0
      end
      for i in 0...@zMove[1].length
        @zMove[1][i]=-1 if @zMove[1][i]>=0
      end     
    for i in 0...4
      break if @decision!=0
      next if @choices[i][0]!=0
      if !pbOwnedByPlayer?(i) || @controlPlayer
        if !@battlers[i].isFainted? && pbCanShowCommands?(i)
          @scene.pbChooseEnemyCommand(i) if !@forceSwitching && !@skipturn
          pbEnemyShouldWithdrawEx?(i,true) if @forceSwitching
        end
      else
        commandDone=false
        commandEnd=false
        if pbCanShowCommands?(i)
          loop do
            cmd=pbCommandMenu(i)
            if cmd==0 # Fight
              if pbCanShowFightMenu?(i)
                commandDone=true if pbAutoFightMenu(i)
                until commandDone
                  index=@scene.pbFightMenu(i)
                  if index<0
                    side=(pbIsOpposing?(i)) ? 1 : 0
                    owner=pbGetOwnerIndex(i)
                    if @megaEvolution[side][owner]==i
                      @megaEvolution[side][owner]=-1
                    end
                    if @zMove[side][owner]==i
                      @zMove[side][owner]=-1
                    end                      
                    break
                  end
                  next if !pbRegisterMove(i,index)
                  if @doublebattle
                    thismove=@battlers[i].moves[index]
                    target=@battlers[i].pbTarget(thismove)
                    if target==PBTargets::SingleNonUser # single non-user
                      target=@scene.pbChooseTarget(i,target)
                      next if target<0
                      pbRegisterTarget(i,target)
                    elsif target==PBTargets::UserOrPartner # Acupressure
                      target=@scene.pbChooseTarget(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[i].effects[PBEffects::SkyDrop]
              pbDisplay(_INTL("Sky Drop won't let {1} go!",@battlers[i].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][owner]==i
                  @megaEvolution[side][owner]=-1
                end
                if @zMove[side][owner]==i
                  @zMove[side][owner]=-1
                end                  
              end
            elsif cmd==4   # Call
              thispkmn=@battlers[i]
              @choices[i][0]=4   # "Call Pokémon"
              @choices[i][1]=0
              @choices[i][2]=nil
              side=(pbIsOpposing?(i)) ? 1 : 0
              owner=pbGetOwnerIndex(i)
              if @megaEvolution[side][owner]==i
                @megaEvolution[side][owner]=-1
              end
              if @zMove[side][owner]==i
                @zMove[side][owner]=-1
              end   
              commandDone=true
              
            elsif cmd==5 # Debug
              pbBattlerDebug
              commandDone=true if (@battlers[i].effects[PBEffects::SkipTurn])
            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
Input R:
Code:
      if Input.trigger?(Input::C)   # Confirm choice
        pbPlayDecisionSE
        ret=cw.index
        @lastcmd[index]=ret
        return ret
      elsif Input.trigger?(Input::B) && index==2 && @lastcmd[0]!=2 # Cancel
        pbPlayDecisionSE
      elsif Input.trigger?(Input::R) # is the same as S
        pbPlayDecisionSE
        return 5
      end
    end 
  end
 

Hollow_Ego

Novice
Member
Posts
44
#7
Oh God, so nice to test battles!
But, i put everything and doenst show the screen when press R or S buttoms.
What could be?

EDIT: im usin v17.2 and ive Zmove scripts

Code:
  def pbCommandPhase
    @scene.pbBeginCommandPhase
#    @scene.pbResetCommandIndices
    for i in 0...4   # Reset choices if commands can be shown
      @battlers[i].effects[PBEffects::SkipTurn]=false
      if pbCanShowCommands?(i) || @battlers[i].fainted?
        @choices[i][0]=0
        @choices[i][1]=0
        @choices[i][2]=nil
        @choices[i][3]=-1
      else
        unless !@doublebattle && pbIsDoubleBattler?(i)
          PBDebug.log("[Reusing commands] #{@battlers[i].pbThis(true)}")
        end
      end
    end
    # Reset choices to perform Mega Evolution if it wasn't done somehow
    if !$forceMegaEvo
      for i in 0...2
        for j in 0...@megaEvolution[i].length
          @megaEvolution[i][j]=-1 if @megaEvolution[i][j]>=0
        end
      end
    end
      for i in 0...@zMove[0].length
        @zMove[0][i]=-1 if @zMove[0][i]>=0
      end
      for i in 0...@zMove[1].length
        @zMove[1][i]=-1 if @zMove[1][i]>=0
      end    
    for i in 0...4
      break if @decision!=0
      next if @choices[i][0]!=0
      if !pbOwnedByPlayer?(i) || @controlPlayer
        if !@battlers[i].isFainted? && pbCanShowCommands?(i)
          @scene.pbChooseEnemyCommand(i) if !@forceSwitching && !@skipturn
          pbEnemyShouldWithdrawEx?(i,true) if @forceSwitching
        end
      else
        commandDone=false
        commandEnd=false
        if pbCanShowCommands?(i)
          loop do
            cmd=pbCommandMenu(i)
            if cmd==0 # Fight
              if pbCanShowFightMenu?(i)
                commandDone=true if pbAutoFightMenu(i)
                until commandDone
                  index=@scene.pbFightMenu(i)
                  if index<0
                    side=(pbIsOpposing?(i)) ? 1 : 0
                    owner=pbGetOwnerIndex(i)
                    if @megaEvolution[side][owner]==i
                      @megaEvolution[side][owner]=-1
                    end
                    if @zMove[side][owner]==i
                      @zMove[side][owner]=-1
                    end                     
                    break
                  end
                  next if !pbRegisterMove(i,index)
                  if @doublebattle
                    thismove=@battlers[i].moves[index]
                    target=@battlers[i].pbTarget(thismove)
                    if target==PBTargets::SingleNonUser # single non-user
                      target=@scene.pbChooseTarget(i,target)
                      next if target<0
                      pbRegisterTarget(i,target)
                    elsif target==PBTargets::UserOrPartner # Acupressure
                      target=@scene.pbChooseTarget(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[i].effects[PBEffects::SkyDrop]
              pbDisplay(_INTL("Sky Drop won't let {1} go!",@battlers[i].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][owner]==i
                  @megaEvolution[side][owner]=-1
                end
                if @zMove[side][owner]==i
                  @zMove[side][owner]=-1
                end                 
              end
            elsif cmd==4   # Call
              thispkmn=@battlers[i]
              @choices[i][0]=4   # "Call Pokémon"
              @choices[i][1]=0
              @choices[i][2]=nil
              side=(pbIsOpposing?(i)) ? 1 : 0
              owner=pbGetOwnerIndex(i)
              if @megaEvolution[side][owner]==i
                @megaEvolution[side][owner]=-1
              end
              if @zMove[side][owner]==i
                @zMove[side][owner]=-1
              end  
              commandDone=true
             
            elsif cmd==5 # Debug
              pbBattlerDebug
              commandDone=true if (@battlers[i].effects[PBEffects::SkipTurn])
            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
Input R:
Code:
      if Input.trigger?(Input::C)   # Confirm choice
        pbPlayDecisionSE
        ret=cw.index
        @lastcmd[index]=ret
        return ret
      elsif Input.trigger?(Input::B) && index==2 && @lastcmd[0]!=2 # Cancel
        pbPlayDecisionSE
      elsif Input.trigger?(Input::R) # is the same as S
        pbPlayDecisionSE
        return 5
      end
    end
  end
Are the Z-Move Scripts using the same button perhaps? Try defining a diferent button for the menu
 

Hollow_Ego

Novice
Member
Posts
44
#9
You have to define new buttons. I personally use Q as well.
Either look up how to implement new buttons or wait till I get to it :)
 

Hollow_Ego

Novice
Member
Posts
44
#10
How to add a button shown by adding Q

in PSystem_Controls under module Input add
Ruby:
Q      = 38
38 is to be replaced with the lowest unused number. So if your last button is defined with 31 then you would set Q equal to 32.

under def self.buttonToKey(button), before else; return [] add
when Input::Q; return [0x51] #Q
Check if this key is double assigned by looking for 0x51 in that part. By default Input::L contains A, Q, Page Up. Be aware of that when assigning your input.
 

WolfPP

Novice
Member
Posts
12
#11
How to add a button shown by adding Q

in PSystem_Controls under module Input add
Ruby:
Q      = 38
38 is to be replaced with the lowest unused number. So if your last button is defined with 31 then you would set Q equal to 32.

under def self.buttonToKey(button), before else; return [] add


Check if this key is double assigned by looking for 0x51 in that part. By default Input::L contains A, Q, Page Up. Be aware of that when assigning your input.
Oh my God. Eu te amo!

I got it <3

Ty ty!

EDIT: Hmmm, now when force MegaEvo to foe, give me that:
Code:
---------------------------
Pokemon Essentials
---------------------------
[Pokémon Essentials version 17.2]

Exception: NoMethodError

Message: undefined method `fullname' for nil:NilClass

PokeBattle_Battle:1760:in `pbMegaEvolve'

PokeBattle_Battle:2873:in `pbAttackPhase'

PokeBattle_Battle:2868:in `each'

PokeBattle_Battle:2868:in `pbAttackPhase'

PokeBattle_Battle:2659:in `pbStartBattleCore'

PokeBattle_Battle:2658:in `logonerr'

PokeBattle_Battle:2658:in `pbStartBattleCore'

PokeBattle_Battle:2644:in `loop'

PokeBattle_Battle:2667:in `pbStartBattleCore'

PokeBattle_Battle:2467:in `pbStartBattle'
And when battle to a Wild Mega Charizard, hes back to normal Charizard :/ (same to Primal Kyogre). I use that script to wild megas and primal:
https://www.pokecommunity.com/showthread.php?t=360545

Ty ty!
 
Last edited:
Posts
44
#12
Oh my God. Eu te amo!

I got it <3

Ty ty!

EDIT: Hmmm, now when force MegaEvo to foe, give me that:
Code:
---------------------------
Pokemon Essentials
---------------------------
[Pokémon Essentials version 17.2]

Exception: NoMethodError

Message: undefined method `fullname' for nil:NilClass

PokeBattle_Battle:1760:in `pbMegaEvolve'

PokeBattle_Battle:2873:in `pbAttackPhase'

PokeBattle_Battle:2868:in `each'

PokeBattle_Battle:2868:in `pbAttackPhase'

PokeBattle_Battle:2659:in `pbStartBattleCore'

PokeBattle_Battle:2658:in `logonerr'

PokeBattle_Battle:2658:in `pbStartBattleCore'

PokeBattle_Battle:2644:in `loop'

PokeBattle_Battle:2667:in `pbStartBattleCore'

PokeBattle_Battle:2467:in `pbStartBattle'
And when battle to a Wild Mega Charizard, hes back to normal Charizard :/ (same to Primal Kyogre). I use that script to wild megas and primal:
https://www.pokecommunity.com/showthread.php?t=360545

Ty ty!
From what I can tell this is a problem with the fact that a wild Pokemon doesn't have a traine. That'S why it's throwing this error. What you need to do is implement a check for wild Pokes in pbMegaEvolve. Similar to what Rot8er_ConeX posted there as a fix
 
Top