- Pokémon Essentials Version
- v17.2 ➖
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)
- Change the HP, set status conditions or completely heal your Pokémon
- Let the battler faint
- Alter the move set and set PP
- Look at the opponents summary screen
- Skip Turn and do literally nothing
- Force Opponent to switch out
- Set the weather and it’s duration
- Alter Field Effects such as Grassy Terrain
- Alter the effects that apply to a side
- Alter the effects that apply to a battler
- Change the battlers typing
- Force Mega Evolution
Also here is a short list of functions I want to add:
- Maybe some more stuff for ability testing (with a big question mark as there might be not much more I can do)
- Make it so that the next move will hit (skip accuracy check)
- Make it possible to choose which Mega Form will be used
As you can see the list is really short. So if you have any ideas what could be added as a function please write it here. I’ll put it on the list if I feel like this could work.
Screenshots can be found here.
For questions and bug reports visit our Discord channel https://discord.gg/7msDPaN or post them here.
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)
- Change the HP, set status conditions or completely heal your Pokémon
- Let the battler faint
- Alter the move set and set PP
- Look at the opponents summary screen
- Skip Turn and do literally nothing
- Force Opponent to switch out
- Set the weather and it’s duration
- Alter Field Effects such as Grassy Terrain
- Alter the effects that apply to a side
- Alter the effects that apply to a battler
- Change the battlers typing
- Force Mega Evolution
Also here is a short list of functions I want to add:
- Maybe some more stuff for ability testing (with a big question mark as there might be not much more I can do)
- Make it so that the next move will hit (skip accuracy check)
- Make it possible to choose which Mega Form will be used
As you can see the list is really short. So if you have any ideas what could be added as a function please write it here. I’ll put it on the list if I feel like this could work.
Screenshots can be found here.
Copy this into a new script section right under Debug_Pokemon and name it Debug_Battler:
in PokeBattle_Battle replace the whole def pbCommandPhase with this (becareful if you changed anything here)
in PokeBattle_Scene after
add
in Pokemon_MegaEvolution replace the whole def getMegaForm(itemonly=false) with this (becareful if you have changed anything)
Ruby:
module BattlerDebugMixin
#===============================================================================
# Settings
#===============================================================================
#===============================================================================
# # Field Effects
#===============================================================================
# These effects apply to the battle (i.e. both sides)
# Format: ["Name to be shown in Menu",PBEffects::Effect,"type of effect (integer or switch)",(only if "int")min value of integer, (only if "int")max value of integer]
FIELD_EFFECTS=[
["Electric Terrain",PBEffects::ElectricTerrain,"int",0,99],
["Fairy Lock",PBEffects::FairyLock,"switch"],
["Fusion Bolt",PBEffects::FusionBolt,"int",0,99],
["Fusion Flare",PBEffects::FusionFlare,"int",0,99],
["Grassy Terrain",PBEffects::GrassyTerrain,"int",0,99],
["Gravity",PBEffects::Gravity,"int",0,99],
["Ion Deluge",PBEffects::IonDeluge,"switch",0,99],
["Magic Room",PBEffects::MagicRoom,"int",0,99],
["Misty Terrain",PBEffects::MistyTerrain,"int",0,99],
["Mud Sport Field",PBEffects::MudSportField,"int",0,99],
["Trick Room",PBEffects::TrickRoom,"int",0,99],
["Water Sport Field",PBEffects::WaterSportField,"int",0,99],
["Wonder Room",PBEffects::WonderRoom,"int",0,99],
["Cancel",nil,nil]]
# Format: ["Name to be shown in Menu",PBWeather::Weather]
WEATHER=[
["Sunny",PBWeather::SUNNYDAY],
["Rain",PBWeather::RAINDANCE],
["Sandstorm",PBWeather::SANDSTORM],
["Hail",PBWeather::HAIL],
["Harsh Sun",PBWeather::HARSHSUN],
["Heavy Rain",PBWeather::HEAVYRAIN],
["Strong Winds",PBWeather::STRONGWINDS],
["None",0],
["Cancel",nil]]
# These effects apply to a side
# Format: ["Name to be shown in Menu",PBEffects::Effect,"type of effect (integer or switch)",(only if "int")min value of integer, (only if "int")max value of integer]
SIDE_EFFECTS=[
["Crafty Shield",PBEffects::CraftyShield,"switch"],
["Echoed Voice Counter",PBEffects::EchoedVoiceCounter,"int",0,99],
["Echoed Voice Used",PBEffects::EchoedVoiceUsed,"switch"],
["Last Round Fainted",PBEffects::LastRoundFainted,"int",0,99],
["Light Screen",PBEffects::LightScreen,"int",0,99],
["Lucky Chant",PBEffects::LuckyChant,"int",0,99],
["Mat Block",PBEffects::MatBlock,"switch"],
["Mist",PBEffects::Mist,"int",0,99],
["Quick Guard",PBEffects::QuickGuard,"switch"],
["Rainbow",PBEffects::Rainbow,"int",0,99],
["Reflect",PBEffects::Reflect,"int",0,99],
["Round",PBEffects::Round,"int",0,99],
["Safeguard",PBEffects::Safeguard,"int",0,99],
["Sea Of Fire",PBEffects::SeaOfFire,"int",0,99],
["Spikes",PBEffects::Spikes,"int",0,3],
["Stealth Rock",PBEffects::StealthRock,"switch"],
["Sticky Web",PBEffects::StickyWeb,"switch"],
["Swamp",PBEffects::Swamp,"int",0,99],
["Tailwind",PBEffects::Tailwind,"int",0,99],
["Toxic Spikes",PBEffects::ToxicSpikes,"int",0,3],
["Wide Guard",PBEffects::WideGuard,"switch"],
["Cancel",nil,nil]]
# These effects apply to a battler
# "int",min value,max value -> positiv integer
# "nint",min value,max value -> negativ and positiv integer
# "switch" -> simple on/off switch
# "partyindex" -> index of party member
# "type" -> type (e.g. Electric, Ghost, Normal, etc.)
# "moveindex" -> index of a move
# "movefunction" -> function code of a move
# "moveID" -> ID of a move
# "opposingindex" -> index of battler (preferably opposing side, atm same as battlerindex)
# "battlerindex" -> index of battler
# "playerindex" -> index of battler (preferably player side, atm same as battlerindex)
# "array",["bool"],["int"] -> array of settings, supports boolean value (true/false) and integers (not used)
# Format: ["Name to be shown in Menu",PBEffects::Effect,"type of effect (see above)",type specific parameters (see above)]
BATTLER_EFFECTS=[
["Aqua Ring",PBEffects::AquaRing,"switch"],
["Attract",PBEffects::Attract,"battlerindex"],
["Baton Pass",PBEffects::BatonPass,"switch"],
["Bide",PBEffects::Bide,"int",0,99],
["Bide Damage",PBEffects::BideDamage,"int",0,999],
["Bide Target",PBEffects::BideTarget,"battlerindex"],
["Charge",PBEffects::Charge,"int",0,99],
["Choice Band",PBEffects::ChoiceBand,"moveid"],
["Confusion",PBEffects::Confusion,"int",0,99],
["Counter",PBEffects::Counter,"int",0,999],
["Counter Target",PBEffects::CounterTarget,"battlerindex"],
["Curse",PBEffects::Curse,"switch"],
["Defense Curl",PBEffects::DefenseCurl,"switch"],
["Destiny Bond",PBEffects::DestinyBond,"switch"],
["Disable",PBEffects::Disable,"int",0,99],
["Disable Move",PBEffects::DisableMove,"moveid"],
["Electrify",PBEffects::Electrify,"switch"],
["Embargo",PBEffects::Embargo,"int",0,99],
["Encore",PBEffects::Encore,"int",0,99],
["EncoreIndex",PBEffects::EncoreIndex,"moveindex"],
["Encore Move",PBEffects::EncoreMove,"moveid"],
["Endure",PBEffects::Endure,"switch"],
["First Pledge",PBEffects::FirstPledge,"movefunction"],
["FlashFire",PBEffects::FlashFire,"switch"],
["Flinch",PBEffects::Flinch,"switch"],
["Focus Energy",PBEffects::FocusEnergy,"int",0,2],
["Follow Me",PBEffects::FollowMe,"int",0,1],
["Foresight",PBEffects::Foresight,"switch"],
["Fury Cutter",PBEffects::FuryCutter,"int",0,4],
["Future Sight",PBEffects::FutureSight,"int",0,99],
["Future Sight Move",PBEffects::FutureSightMove,"moveID"],
["Future Sight User",PBEffects::FutureSightUser,"partyindex"],
["Future Sight User Pos",PBEffects::FutureSightUserPos,"battlerindex"],
["Gastro Acid",PBEffects::GastroAcid,"switch"],
["Grudge",PBEffects::Grudge,"switch"],
["Heal Block",PBEffects::HealBlock,"int",0,99],
["Healing Wish",PBEffects::HealingWish,"switch"],
["Helping Hand",PBEffects::HelpingHand,"switch"],
["Hyper Beam",PBEffects::HyperBeam,"int",0,99],
["Illusion",PBEffects::Illusion,"partyindex"],
["Imprison",PBEffects::Imprison,"switch"],
["Ingrain",PBEffects::Ingrain,"switch"],
["Kings Shield",PBEffects::KingsShield,"switch"],
["LeechSeed",PBEffects::LeechSeed,"battlerindex"],
["Life Orb",PBEffects::LifeOrb,"switch"],
["Lock On",PBEffects::LockOn,"int",0,99],
["Lock On Pos",PBEffects::LockOnPos,"battlerindex"],
["Lunar Dance",PBEffects::LunarDance,"switch"],
["Magic Coat",PBEffects::MagicCoat,"switch"],
["MagnetRise",PBEffects::MagnetRise,"int",0,99],
["Mean Look",PBEffects::MeanLook,"opposingindex"],
["Me First",PBEffects::MeFirst,"switch"],
["Metronome",PBEffects::Metronome,"int",0,99],
["Micle Berry",PBEffects::MicleBerry,"switch"],
["Minimize",PBEffects::Minimize,"switch"],
["Miracle Eye",PBEffects::MiracleEye,"switch"],
["Mirror Coat",PBEffects::MirrorCoat,"int",0,999],
["Mirror Coat Target",PBEffects::MirrorCoatTarget,"battlerindex"],
["Move Next",PBEffects::MoveNext,"switch"],
["Mud Sport",PBEffects::MudSport,"switch"],
["Multi Turn",PBEffects::MultiTurn,"int",0,99],
["Multi Turn Attack",PBEffects::MultiTurnAttack,"moveid"],
["Multi Turn User",PBEffects::MultiTurnUser,"battlerindex"],
["Nightmare",PBEffects::Nightmare,"switch"],
["Outrage",PBEffects::Outrage,"int",0,99],
["Parental Bond",PBEffects::ParentalBond,"int",0,3],
["Perish Song",PBEffects::PerishSong,"int",0,99],
["Perish Song User",PBEffects::PerishSongUser,"battlerindex"],
["Pickup Item",PBEffects::PickupItem,"int",0,99],
["Pickup Use",PBEffects::PickupUse,"int",0,99],
["Pinch",PBEffects::Pinch,"switch"],
["Powder",PBEffects::Powder,"switch"],
["Power Trick",PBEffects::PowerTrick,"switch"],
["Protect",PBEffects::Protect,"switch"],
["Protect Negation",PBEffects::ProtectNegation,"switch"],
["Protect Rate",PBEffects::ProtectRate,"int",0,99],
["Pursuit",PBEffects::Pursuit,"switch"],
["Quash",PBEffects::Quash,"switch"],
["Rage",PBEffects::Rage,"switch"],
["Revenge",PBEffects::Revenge,"int",0,99],
["Roar",PBEffects::Roar,"switch"],
["Rollout",PBEffects::Rollout,"int",0,99],
["Roost",PBEffects::Roost,"int",0,99],
["Skip Turn",PBEffects::SkipTurn,"switch"],
["Sky Drop",PBEffects::SkyDrop,"switch"],
["Smack Down",PBEffects::SmackDown,"switch"],
["Snatch",PBEffects::Snatch,"switch"],
["Spiky Shield",PBEffects::SpikyShield,"switch"],
["Stockpile",PBEffects::Stockpile,"int",0,3],
["Stockpile Def",PBEffects::StockpileDef,"int",0,3],
["Stockpile SpDef",PBEffects::StockpileSpDef,"int",0,3],
["Substitute",PBEffects::Substitute,"int",0,999],
["Taunt",PBEffects::Taunt,"int",0,99],
["Telekinesis",PBEffects::Telekinesis,"int",0,99],
["Torment",PBEffects::Torment,"switch"],
["Toxic",PBEffects::Toxic,"int",0,15],
["Transform",PBEffects::Transform,"switch"],
["Truant",PBEffects::Truant,"switch"],
["Two Turn Attack",PBEffects::TwoTurnAttack,"moveid"],
["Type3",PBEffects::Type3,"type"],
["Unburden",PBEffects::Unburden,"switch"],
["Uproar",PBEffects::Uproar,"int",0,99],
["Uturn",PBEffects::Uturn,"switch"],
["WaterSport",PBEffects::WaterSport,"switch"],
["WeightChange",PBEffects::WeightChange,"nint",-9999,9999],
["Wish",PBEffects::Wish,"int",0,99],
["WishAmount",PBEffects::WishAmount,"int",0,999],
["WishMaker",PBEffects::WishMaker,"partyindexindex"],
["Yawn",PBEffects::Yawn,"int",0,99],
["Cancel",nil,nil]]
#===============================================================================
# Codes
#===============================================================================
def pbBattlerDebugCommands(target)
commands = CommandMenuList.new
# Main Commands
commands.add("main","battleroptions",_INTL("Battler Options"))
commands.add("main","choiceoptions",_INTL("Choice Options"))
commands.add("main","field/side",_INTL("Field Options"))
# Battler Options
commands.add("battleroptions","ability",_INTL("Ability"))
commands.add("battleroptions","hpstatusmenu",_INTL("HP/Status"))
commands.add("battleroptions","type",_INTL("Type"))
commands.add("battleroptions","moves",_INTL("Moves"))
commands.add("battleroptions","items",_INTL("Item"))
commands.add("battleroptions","summary",_INTL("Summary"))
commands.add("battleroptions","stats",_INTL("Set Stat Changes"))
commands.add("battleroptions","battlereffects",_INTL("Set Battler Effects"))
commands.add("battleroptions","megaevo",_INTL("Force Mega Evolution")) if target.hasMegaForm?
# Choice Options
commands.add("choiceoptions","skipturn",_INTL("Skip turn"))
commands.add("choiceoptions","switch",_INTL("Force switching")) if target.index==1 || target.index==2
# Field Options
commands.add("field/side","setweather",_INTL("Set Weather"))
commands.add("field/side","setfieldeffect",_INTL("Set Field Effects"))
# Ability
commands.add("ability","setability",_INTL("Set Ability"))
commands.add("ability","abilitytrigger1",_INTL("Trigger Abilities On Active"))
# HP / Status
commands.add("hpstatusmenu","sethp",_INTL("Set HP"))
commands.add("hpstatusmenu","setstatus",_INTL("Set status"))
commands.add("hpstatusmenu","fullheal",_INTL("Fully heal"))
commands.add("hpstatusmenu","makefainted",_INTL("Make fainted"))
# Moves
commands.add("moves","setpp",_INTL("Set PP"))
commands.add("moves","setmove",_INTL("Set Move"))
# Items
commands.add("items","giveitem",_INTL("Give Item"))
commands.add("items","removeitem",_INTL("Remove Item"))
return commands
end
#===============================================================================
#
#===============================================================================
def pbBattlerDebugActions(command,target)
pokemon = target
case command
#===========================================================================
when "stats"
changeStatStages(pokemon)
scene.pbRefresh
pokemon.pbUpdateDebug(true)
#===========================================================================
when "battlereffects"
setBattlerEffects(pokemon,BATTLER_EFFECTS)
scene.pbRefresh
#===========================================================================
when "abilitytrigger1"
pokemon.pbAbilitiesOnSwitchIn(true)
return
#===========================================================================
when "abilitytrigger2"
params = ChooseNumberParams.new
moves=[]
cmd=[]
for i in pokemon.moves
moves.push(i)
end
for i in moves
cmd.push(i.name) if i.name!=""
end
move=pbShowCommandsLeft(cmd,0,4)
if move==4
return
end
pbEffectsAfterHit(pokemon,pokemon.pbOpposing1,pokemon.moves[move],@turneffects)
return
#===========================================================================
when "abilitytrigger3"
pokemon.pbAbilitiesOnSwitchIn(true)
return
#===========================================================================
when "fullheal"
pokemon.hp=pokemon.totalhp
pokemon.status=0
pokemon.statusCount=0
pokemon.effects[PBEffects::Confusion]=0
for i in 0...pokemon.moves.length
pbRestorePP(pokemon,i,80)
end
scene.pbRefresh
pokemon.pbUpdateDebug(true)
#===========================================================================
when "setability"
abil=pbChooseAbilityList(pokemon.ability)
pokemon.ability=abil
scene.pbRefresh
pokemon.pbUpdateDebug(true)
#===========================================================================
when "sethp"
changePPHP(pokemon,"hp")
pokemon.pbUpdateDebug(false)
scene.pbRefresh
#===========================================================================
when "setstatus"
cmd = 0
loop do
cmd = pbShowCommandsRight(["[Cure]","Sleep","Poison","Burn","Paralysis","Frozen"],cmd,-1)
break if cmd<0
case cmd
when 0 # Cure
pokemon.status = 0
pokemon.statusCount = 0
pbDisplay(_INTL("{1}'s status was cured.",pokemon.name))
pokemon.pbUpdateDebug(false)
scene.pbRefresh
else # Give status problem
count = 0
cancel = false
if cmd==PBStatuses::SLEEP
params = ChooseNumberParams.new
params.setRange(0,9)
params.setDefaultValue(3)
count = Kernel.pbMessageChooseNumber(
_INTL("Set the Pokémon's sleep count."),params)
cancel = true if count<=0
end
if !cancel
pokemon.status = cmd
pokemon.statusCount = count
pokemon.pbUpdateDebug(false)
scene.pbRefresh
end
end
end
#===========================================================================
when "makefainted"
pokemon.hp=0
pokemon.pbFaint
pbEndOfRoundPhase if !((pokemon.index&1)==0)
@turncount+=1
return
#===========================================================================
when "setpp"
changePPHP(pokemon,"pp")
pokemon.pbUpdateDebug(false)
scene.pbRefresh
#===========================================================================
when "setmove"
changeMove(pokemon)
pokemon.pbUpdateDebug(true)
scene.pbRefresh
#===========================================================================
when "type"
changeType(pokemon)
pokemon.pbUpdateDebug(true)
scene.pbRefresh
#===========================================================================
when "summary"
party=pbParty(pokemon.index)
index=1
for i in 0...party.length
index = i if i == pokemon.pokemonIndex
end
pbSummary(party,index)
pokemon.pbUpdateDebug(true)
#===========================================================================
when "switch"
party=pbParty(pokemon.index)
switchable=false
if !@forceSwitching
for i in 0...party.length
switchable=true if pbCanSwitch?(pokemon.index,i,false)
end
@forceSwitching=true if switchable
Kernel.pbMessage("The opponent can't switch!") if !switchable
return if switchable
else
@forceSwitching=false
Kernel.pbMessage("The opponent won't be forced to switch!")
end
#===========================================================================
when "megaevo"
side=(pbIsOpposing?(pokemon.index)) ? 1 : 0
owner=pbGetOwnerIndex(pokemon.index)
if @megaEvolution[side][owner]==-1
@megaEvolution[side][owner]=pokemon.index
Kernel.pbMessage("#{pokemon.name} will Mega Evolve!")
$forceMegaEvo=true
else
@megaEvolution[side][owner]=-1
Kernel.pbMessage("#{pokemon.name} will not Mega Evolve!")
end
return
#===========================================================================
when "skipturn"
@skipturn=((pokemon.index&1)==0) ? false : true # Player / Opponent
pokemon.effects[PBEffects::SkipTurn]=((pokemon.index&1)==0) ? true : false
return
#===========================================================================
when "setweather"
setWeather(WEATHER)
scene.pbRefresh
#===========================================================================
when "setfieldeffect"
setFieldEffects(FIELD_EFFECTS)
scene.pbRefresh
#===========================================================================
when "side"
setSideEffect(pokemon,SIDE_EFFECTS)
scene.pbRefresh
#===========================================================================
when "giveitem"
pbListScreenBlock(_INTL("GIVE ITEM"),ItemLister.new(0)){|button,item|
if button==Input::C && item && item>0
pokemon.item=item
Kernel.pbMessage("#{pokemon.name} is now holding #{PBItems.getName(item)}!")
end
}
pokemon.pbUpdateDebug(true)
scene.pbRefresh
#===========================================================================
when "removeitem"
Kernel.pbMessage("#{pokemon.name}'s #{PBItems.getName(pokemon.item)} was removed!") if pokemon.item>0
Kernel.pbMessage("#{pokemon.name} is not holding an item!") if pokemon.item<=0
pokemon.item=0
pokemon.pbUpdateDebug(true)
scene.pbRefresh
#===========================================================================
end
return true
end
#===============================================================================
#
#===============================================================================
def pbBattlerDebug
scene=BattlerDebug_Scene.new
target=nil
cmdTar=0
battlertargets=[]
for i in 0...@battlers.length
battlertargets.push(@battlers[i].name) if @battlers[i].name!=""
end
cmdTar = pbShowCommandsRight(battlertargets,cmdTar,-1)
case cmdTar
when 0,1,2,3
target=@battlers[cmdTar]
commands = pbBattlerDebugCommands(target)
command = 0
text=@battlers[cmdTar].name
window=Window_AdvancedTextPokemon.new(text)
window.z=99999
window.resizeToFit(text)#198
window.y=0
window.x=Graphics.width-window.width
loop do
command = scene.pbShowCommands(commands.list,command)
if command<0
parent = commands.getParent
if parent #checks wether to break out of loop and close commands or just return to previous
commands.currentList = parent[0]
command = parent[1]
else
break
end
else
cmd = commands.getCommand(command)
if commands.hasSubMenu?(cmd)
commands.currentList = cmd
command = 0
else
cont = pbBattlerDebugActions(cmd,target)
break if !cont
end
end
end
window.dispose
end
end
#===============================================================================
# Battler related methods
#===============================================================================
# changes the typing
def changeType(pokemon)
params = ChooseNumberParams.new
params.setRange(1,2)
params.setCancelValue(1)
params.setInitialValue(1)
number=Kernel.pbMessageChooseNumber(_INTL("Set which type?"),params)
type=pbChooseTypeList
pokemon.type1=type if number==1 && type!=0
pokemon.type2=type if number==2 && type!=0
#pokemon.type2=pokemon.type1 if number==2 && type==0
end
#-------------------------------------------------------------------------------
# shows the options for stat stage changes
def changeStatStages(pokemon)
text=updateStatInfo(pokemon)
window=Window_AdvancedTextPokemon.new(text)
window.z=99999
window.width=198
window.y=0
window.x=Graphics.width-window.width
pbPlayDecisionSE()
command=0
params = ChooseNumberParams.new
params.setRange(-6,6)
params.setNegativesAllowed(true)
cmd=["Atk","Def","Speed","Sp.Atk","Sp.Def","Evasion","Accuracy","Cancel"]
loop do
Graphics.update
Input.update
window.update
text=updateStatInfo(pokemon)
window.text=text
command=pbShowCommandsLeft(cmd,command,7)
stat=cmd[command]
if Input.trigger?(Input::B)
break
end
case stat
when "Atk"
params.setInitialValue(pokemon.stages[PBStats::ATTACK])
params.setCancelValue(pokemon.stages[PBStats::ATTACK])
pokemon.stages[PBStats::ATTACK]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Def"
params.setInitialValue(pokemon.stages[PBStats::DEFENSE])
params.setCancelValue(pokemon.stages[PBStats::DEFENSE])
pokemon.stages[PBStats::DEFENSE]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Speed"
params.setInitialValue(pokemon.stages[PBStats::SPEED])
params.setCancelValue(pokemon.stages[PBStats::SPEED])
pokemon.stages[PBStats::SPEED]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Sp.Atk"
params.setInitialValue(pokemon.stages[PBStats::SPATK])
params.setCancelValue(pokemon.stages[PBStats::SPATK])
pokemon.stages[PBStats::SPATK]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Sp.Def"
params.setInitialValue(pokemon.stages[PBStats::SPDEF])
params.setCancelValue(pokemon.stages[PBStats::SPDEF])
pokemon.stages[PBStats::SPDEF]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Evasion"
params.setInitialValue(pokemon.stages[PBStats::EVASION])
params.setCancelValue(pokemon.stages[PBStats::EVASION])
pokemon.stages[PBStats::EVASION]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Accuracy"
params.setInitialValue(pokemon.stages[PBStats::ACCURACY])
params.setCancelValue(pokemon.stages[PBStats::ACCURACY])
pokemon.stages[PBStats::ACCURACY]=Kernel.pbMessageChooseNumber(_INTL("Set Stage"),params)
when "Cancel"
break
end
end
window.dispose
end
# updates the stat stage changes
def updateStatInfo(pokemon)
return _INTL("Attack<r>{1}\r\nDefense<r>{2}\r\nSpeed<r>{3}\r\nSP.ATK<r>{4}\r\nSP.DEF<r>{5}\r\nEvasion<r>{6}\r\nAccuracy<r>{7}",pokemon.stages[PBStats::ATTACK],
pokemon.stages[PBStats::DEFENSE],
pokemon.stages[PBStats::SPEED],
pokemon.stages[PBStats::SPATK],
pokemon.stages[PBStats::SPDEF],
pokemon.stages[PBStats::EVASION],
pokemon.stages[PBStats::ACCURACY])
end
#-------------------------------------------------------------------------------
# shows the options for stat stage changes
def changePPHP(pokemon,pphp)
pbPlayDecisionSE()
case pphp
when "hp"
params = ChooseNumberParams.new
params.setRange(0,pokemon.totalhp)
params.setInitialValue(pokemon.hp)
params.setCancelValue(pokemon.hp)
pokemon.hp=Kernel.pbMessageChooseNumber(_INTL("Set HP"),params)
when "pp"
params = ChooseNumberParams.new
moves=[]
cmd=[]
move=0
for i in pokemon.moves
moves.push(i)
end
for i in moves
cmd.push(i.name) if i.name!=""
end
move=pbShowCommandsLeft(cmd,move,4)
if move==4
return
end
params.setRange(0,moves[move].totalpp)
params.setInitialValue(moves[move].pp)
params.setCancelValue(moves[move].pp)
pokemon.moves[move].pp=Kernel.pbMessageChooseNumber(_INTL("Set PP"),params)
end
end
#-------------------------------------------------------------------------------
# change move
def changeMove(pokemon)
moves=[]
cmd=[]
move=0
for i in pokemon.moves
moves.push(i)
end
for i in moves
cmd.push(i.name) if i.name!=""
cmd.push("empty") if i.name==""
end
move=pbShowCommandsLeft(cmd,move,4)
if move==4
return
else
newmove=pbChooseMoveList
if newmove!=0
pokemon.moves[move]=PBMove.new(newmove)
pokemon.moves[move]=PokeBattle_Move.pbFromPBMove(self,pokemon.moves[move])
else
return
end
end
end
#===============================================================================
# Field
#===============================================================================
# set Weather
def setWeather(effects)
pbPlayDecisionSE()
text=getCurrentWeather
window=Window_AdvancedTextPokemon.new(text)
window.z=99999
window.width=198
window.y=0
window.x=Graphics.width-window.width
params = ChooseNumberParams.new
params.setRange(0,99)
params.setInitialValue(weatherduration)
params.setCancelValue(weatherduration)
index=0
command=0
cmd=[]
for i in effects
cmd.push(i[0])
end
loop do
Graphics.update
Input.update
window.update
text=getCurrentWeather
window.text=text
index=pbShowCommandsLeft(cmd,index,effects.length-1)
weather=effects[index]
if weather[1]!=nil
@weather=weather[1]
@weatherduration= weather[1]==0 ? 0 : Kernel.pbMessageChooseNumber(_INTL("Set weather duration"),params)
elsif weather[1]==nil
break
end
end
window.dispose
end
def getCurrentWeather
ret= "None"
ret= "Sunny" if @weather==PBWeather::SUNNYDAY
ret= "Rain" if @weather==PBWeather::RAINDANCE
ret= "Sandstorm" if @weather==PBWeather::SANDSTORM
ret= "Hail" if @weather==PBWeather::HAIL
ret= "Harsh Sun" if @weather==PBWeather::HARSHSUN
ret= "Heavy Rain" if @weather==PBWeather::HEAVYRAIN
ret= "Strong Winds" if @weather==PBWeather::STRONGWINDS
return ret + " / " + @weatherduration.to_s
end
#set Field Effects
def setFieldEffects(effects)
pbPlayDecisionSE()
params = ChooseNumberParams.new
index=0
command=0
cmd=[]
for i in effects
cmd.push(i[0])
end
loop do
Graphics.update
Input.update
index=pbShowCommandsLeft(cmd,index,effects.length-1)
command=effects[index]
case command[2]
when "int"
params.setRange(command[3],command[4])
params.setInitialValue(field.effects[command[1]])
params.setCancelValue(field.effects[command[1]])
field.effects[command[1]]=Kernel.pbMessageChooseNumber(_INTL("Enter value"),params)
when "switch"
field.effects[command[1]]=pbFlipSwitch(command[0],field.effects[command[1]])
when nil
break
end
end
end
#set Side Effects
def setSideEffect(pokemon,effects)
pbPlayDecisionSE()
params = ChooseNumberParams.new
index=0
command=0
side= pokemon.pbOwnSide
cmd=[]
for i in effects
cmd.push(i[0])
end
loop do
Graphics.update
Input.update
index=pbShowCommandsLeft(cmd,index,effects.length-1)
command=effects[index]
case command[2]
when "int"
params.setRange(command[3],command[4])
params.setInitialValue(side.effects[command[1]])
params.setCancelValue(side.effects[command[1]])
side.effects[command[1]]=Kernel.pbMessageChooseNumber(_INTL("Enter value"),params)
when "switch"
side.effects[command[1]]=pbFlipSwitch(command[0],side.effects[command[1]])
when nil
break
end
end
end
#===============================================================================
# Battler Effects
#===============================================================================
# "int"
# "nint"
# "switch"
# "partyindex"
# "type"
# "moveindex"
# "movefunction"
# "opposingindex"
# "battlerindex"
# "playerindex"
# "array",["bool"],["int"]
def setBattlerEffects(pokemon,effects)
pbPlayDecisionSE()
params = ChooseNumberParams.new
index=0
command=[]
window=Window_AdvancedTextPokemon.new("")
window.z=99999
window.y=0
window.x=0
window.visible=false
cmd=[]
for i in effects
cmd.push(i[0])
end
loop do
Graphics.update
Input.update
index=pbShowCommandsLeft(cmd,index,effects.length-1)
command=effects[index]
case command[2]
when "int","nint"
params.setRange(command[3],command[4])
params.setInitialValue(pokemon.effects[command[1]])
params.setCancelValue(pokemon.effects[command[1]])
params.setNegativesAllowed(true) if command[2]=="nint"
pokemon.effects[command[1]]=Kernel.pbMessageChooseNumber(_INTL("Enter value"),params)
when "switch"
pokemon.effects[command[1]]=pbFlipSwitch(command[0],pokemon.effects[command[1]])
when "partyindex"
party=pbParty(pokemon.index)
partytargets=[]
cmdTar=0
for i in 0...party.length
partytargets.push(party[i].name) if party[i].name!=""
end
cmdTar = pbShowCommandsRight(partytargets,cmdTar,-1)
pokemon.effects[command[1]]=cmdTar
when "type"
typeindex=pokemon.effects[command[1]]
current= (pokemon.effects[command[1]] != -1) ? getConstantName(PBTypes,typeindex.to_i) : "none"
text="Current: #{current}"
window.text=text
window.resizeToFit(text)
window.x=Graphics.width-window.width
window.visible=true
pokemon.effects[command[1]]=pbChooseTypeList
window.visible=false
return
when "moveid","movefunction"
current=pokemon.effects[command[1]]
text="Current: #{current}"
window.text=text
window.resizeToFit(text)
window.x=Graphics.width-window.width
window.visible=true
moves=[]
cmd=[]
move=pbChooseMoveList
movedata=PBMoveData.new(move)
if move!=0
if command[2]=="moveid"
pokemon.effects[command[1]]=move
elsif command[2]=="movefunction"
pokemon.effects[command[1]]=movedata.function
end
else
pokemon.effects[command[1]]= 0
end
window.visible=false
return
when "moveindex"
current=pokemon.effects[command[1]]
text="Current: #{current}"
window.text=text
window.resizeToFit(text)
window.x=Graphics.width-window.width
window.visible=true
cmd=[]
move=0
moves=[]
for i in pokemon.moves
moves.push(i)
end
for i in moves
cmd.push(i.name) if i.name!=""
end
move=pbShowCommandsLeft(cmd,move,4)
if move==4
return
elsif command[2]=="moveindex"
pokemon.effects[command[1]]=move
end
window.visible=false
return
when "opposingindex","battlerindex","playerindex"
cmd=[]
battlertargets=[]
bindex=0
for i in 0...@battlers.length
battlertargets.push(@battlers[i].name) if @battlers[i].name!=""
battlertargets.push("-") if @battlers[i].name==""
end
currentindex=pokemon.effects[command[1]]
current= currentindex!=-1 ? @battlers[currentindex.to_i].name : "none"
text="Current: #{current}"
window.text=text
window.resizeToFit(text)
window.visible=true
bindex = pbShowCommandsLeft(battlertargets,bindex,-1)
if bindex==-1
window.dispose
break
else
pokemon.effects[command[1]]=bindex
window.dispose
return
end
when "array"
for i in 3...command.length
pos= i-3
case command[i][0]
when "bool"
pokemon.effects[command[1]][pos]=pbFlipSwitch(command[0],pokemon.effects[command[1]][pos])
when "int"
params.setRange(command[i][1],command[i][2])
params.setInitialValue(pokemon.effects[command[1]][pos])
params.setCancelValue(pokemon.effects[command[1][pos]])
pokemon.effects[command[1][pos]]=Kernel.pbMessageChooseNumber(_INTL("Enter value"),params)
end
end
return
when nil
break
end
end
end
#===============================================================================
# other helper functions
#===============================================================================
# shows the command window on the left (instead of right)
def pbShowCommandsLeft(commands,index,default)
ret = -1
using(cmdwindow = Window_CommandPokemonColor.new(commands)) {
cmdwindow.z = 99999
cmdwindow.index = index
pbBottomLeft(cmdwindow)
loop do
Graphics.update
Input.update
cmdwindow.update
if Input.trigger?(Input::B)
pbPlayCancelSE
ret = default
break
elsif Input.trigger?(Input::C)
pbPlayDecisionSE
ret = cmdwindow.index
ret=default if commands[cmdwindow.index]=="-"
break
end
end
}
return ret
end
# shows the command window on the right (alternative to class method)
def pbShowCommandsRight(commands,index,default)
ret = -1
using(cmdwindow = Window_CommandPokemonColor.new(commands)) {
cmdwindow.z = 99999
cmdwindow.index = index
pbBottomRight(cmdwindow)
loop do
Graphics.update
Input.update
cmdwindow.update
if Input.trigger?(Input::B)
pbPlayCancelSE
ret = default
break
elsif Input.trigger?(Input::C)
pbPlayDecisionSE
ret = cmdwindow.index
ret=default if commands[cmdwindow.index]=="-"
break
end
end
}
return ret
end
def pbFlipSwitch(switchname,switch)
state=switch==true ? "<c3=007c06,c9d1c9>ON</c3>" : "<c3=e00808,d0c8c8>OFF</c3>"
message=_INTL("#{switchname} is turned #{state}!")
return (Kernel.pbMessage(message,[_INTL("ON"),_INTL("OFF")],2)==0)
end
end
#===============================================================================
# Battler Debug Class
#===============================================================================
class BattlerDebug_Scene
def initialize(starthelptext="Which Pokemon?")
@sprites = {}
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 99999
@sprites["helpwindow"] = Window_UnformattedTextPokemon.new(starthelptext)
@sprites["helpwindow"].viewport = @viewport
@sprites["helpwindow"].visible = false
pbBottomLeftLines(@sprites["helpwindow"],1)
end
# shows the Debug Commands
def pbShowCommands(commands,index=0)
ret = -1
using(cmdwindow = Window_CommandPokemonColor.new(commands)) {
cmdwindow.z = @viewport.z+1
cmdwindow.index = index
pbBottomRight(cmdwindow)
loop do
Graphics.update
Input.update
cmdwindow.update
if Input.trigger?(Input::B)
pbPlayCancelSE
ret = -1
break
elsif Input.trigger?(Input::C)
pbPlayDecisionSE
ret = cmdwindow.index
break
end
end
}
return ret
end
def update
pbUpdateSpriteHash(@sprites)
end
end
#===============================================================================
# Including Statements
#===============================================================================
class PokeBattle_Battle
include BattlerDebugMixin
def pbSummary(party,pkmnid)
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
screen.pbStartScreen(party,pkmnid)
end
end
class PokeBattle_Battler
include BattlerDebugMixin
# Returns the list of abilities this Pokémon can have.
def getAbilityList
abils=[]; ret=[]
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,self.fSpecies,2)
abils.push(dexdata.fgetw)
abils.push(dexdata.fgetw)
pbDexDataOffset(dexdata,self.fSpecies,40)
abils.push(dexdata.fgetw)
abils.push(dexdata.fgetw)
abils.push(dexdata.fgetw)
abils.push(dexdata.fgetw)
dexdata.close
for i in 0...abils.length
next if !abils[i] || abils[i]<=0
ret.push([abils[i],i])
end
return ret
end
def hasMegaForm?
mf = self.getMegaForm
return mf>0 && mf!=self.species
end
def getMegaForm(itemonly=false)
formdata = pbLoadFormsData
return 0 if !formdata[@species] || formdata[@species].length==0
ret = 0
dexdata = pbOpenDexData
for i in formdata[@species]
next if !i || i<=0
pbDexDataOffset(dexdata,i,29)
megastone = dexdata.fgetw
if megastone>0
ret = i; break
end
if !itemonly
pbDexDataOffset(dexdata,i,56)
megamove = dexdata.fgetw
if megamove>0
ret = i; break
end
end
end
dexdata.close
return ret # fSpecies or 0
end
def form
return @forcedForm if @forcedForm!=nil
v=MultipleForms.call("getForm",self)
if v!=nil
self.form=v if !@form || v!=@form
return v
end
return @form || 0
end
def fSpecies
return pbGetFSpeciesFromForm(@species,self.form)
end
def pbUpdateDebug(fullchange=false,newSpecies=false)
@pokemon.calcStats
@level = @pokemon.level
@hp = @pokemon.hp
@totalhp = @pokemon.totalhp
if fullchange
@form = @pokemon.form
@ability = @pokemon.ability if newSpecies
@type1 = @pokemon.type1 if newSpecies
@type2 = @pokemon.type2 if newSpecies
@item = @pokemon.item
@attack = @pokemon.attack
@defense = @pokemon.defense
@speed = @pokemon.speed
@spatk = @pokemon.spatk
@spdef = @pokemon.spdef
end
end
end
class BattlerDebug_Scene
include BattlerDebugMixin
end
class PokeBattle_Pokemon
include BattlerDebugMixin
end
in PokeBattle_Battle replace the whole def pbCommandPhase with this (becareful if you changed anything here)
Ruby:
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].isFainted?
@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...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
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
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
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
# 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
in PokeBattle_Scene after
Ruby:
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
pbPlayDecis
Ruby:
elsif Input.trigger?(Input::R) # is the same as S
pbPlayDecisionSE
return 5
in Pokemon_MegaEvolution replace the whole def getMegaForm(itemonly=false) with this (becareful if you have changed anything)
Ruby:
def getMegaForm(itemonly=false)
formdata = pbLoadFormsData
return 0 if !formdata[@species] || formdata[@species].length==0
ret = 0
dexdata = pbOpenDexData
for i in formdata[@species]
next if !i || i<=0
pbDexDataOffset(dexdata,i,29)
megastone = dexdata.fgetw
if megastone>0 && (self.hasItem?(megastone) || $forceMegaEvo)
ret = i; break
end
if !itemonly
pbDexDataOffset(dexdata,i,56)
megamove = dexdata.fgetw
if megamove>0 && (self.hasMove?(megamove) || $forceMegaEvo)
ret = i; break
end
end
end
dexdata.close
return ret # fSpecies or 0
end
For questions and bug reports visit our Discord channel https://discord.gg/7msDPaN or post them here.
- Credits
- Credits go to the whole Pokemon Essentials Team which already made almost all the functions I used here!
Check it out here: https://pokemonessentials.wikia.com/wiki/Pokémon_Essentials_Wiki
You need to find this in EBS Scripts:
[CODE=ruby]alias pbCommandMenuEx_ebs pbCommandMenuEx unless self.method_defined?(:pbCommandMenuEx_ebs)
def pbCommandMenuEx(index,texts,mode=0)[/CODE]
and in this def after
[CODE=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[/CODE]
add
[CODE=ruby]elsif Input.trigger?(Input::R) # is the same as S
pbPlayDecisionSE
@ret= 5
break[/CODE]
I haven't tested it much so there might be cases where it doesn't work correctly. This script was not made with EBS in mind but should work nontheless.