• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

v21.1 Mid battle dialogue for v20+ 3.0

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21.1 ✅
This is an upgraded version of Mid battle dialogue for the newests versions of Essentials.
It is only maintained for the last version of essentials even if old version are kept in case you need it.
Simply paste what's inside the folder in the root folder of your game to install it.
if you need the v18 version, it's here. (only the last version, v21 here, is updated!)

If you are using Essentials Deluxe and its associated plugins, use their mid battle functionnalites instead of this one.

A limited SOS battle plugin is provided with this plugin. Remove it if you are already using the official one.

A bossprotect effect have been added in this script. If you already have custom effects, you should copy their initialization in the init_effect file (or the opposite).
It creates a mist and a safeguard effect +prevents OHKO and such things to happen.
I also removed the 255 cap in pokémon basestats to make huge bosses.

How it works

Making mid battle dialogue require two things: what you are doing and when you are doing it.

Conditions

  • "battleStart" => for changing the "X would like to battle!" text
  • "turnStartX" => triggered at the start of turn X of the battle
  • "turnEndX" => triggered at the end of turn X of the battle
  • "randX" => triggered at the end of a turn with the chance of 1 in X
  • "last" => triggered when player sends out their last battler
  • "lastOpp" => triggered when opponent sends out their last battler
  • "item" => triggered when player uses item
  • "itemOpp" => triggered when opponent uses item
  • "mega" => triggered when player Mega Evolves battler
  • "megaopp" => triggered when opponent Mega Evolves battler
  • "recall" => triggered when player recalls battler
  • "recallOpp" => triggered when opponent recalls battler
  • "lowHP" => triggered when player's battler HP reduced to below 25%
  • "lowHPOpp" => triggered when opponent's battler HP reduced to below 25%
  • "halfHP" => triggered when player's battler HP reduced to below 50%
  • "halfHPOpp" => triggered when opponent's battler HP reduced to below 50%
  • "highHP" => triggered when player's battler HP reduced to below 75%
  • "highHPOpp" => triggered when opponent's battler HP reduced to below 75%
  • "bigDamage" => triggered when player's battler receives over 60% damage from move
  • "bigDamageOpp" => triggered when opponent's battler receives over 60% damage from move
  • "smlDamage" => triggered when player's battler receives less than 30% damage from move
  • "smlDamageOpp" => triggered when opponent's battler receives less than 30% damage from move
  • "fainted" => triggered when player's battler faints
  • "faintedOpp" => triggered when opponent's battler faints
  • "attack" => triggered when player performs their 1st attack
  • "attackOpp" => triggered when opponent performs their 1st attack attack
  • "loss" => triggered when player loses battle
  • "endspeech" => triggers when player wins Battle
  • "sendoutX" => triggers when player sends out the Xth Pokemon in their party (doesn't apply for last member)
  • "sendoutXOpp" => triggers when opponent sends out the Xth Pokemon in their party (doesn't apply for last member)
For each of these conditions, you can add a ,Z to denote the dialogue to play on the Zth instance of the condition. So you could do:
BattleScripting.set("recall","Whoa! Nice save!")
BattleScripting.set("recall,2","Whoa! Nice save again!")

Note: For the conditions,
Code:
Expand Collapse Copy
"lowHP","lowHPOpp","halfHP","halfHPOpp","bigDamage","bigDamageOpp","smlDamage","smlDamageOpp","attack","attackOpp","superEff","superEffOpp","notEff","notEffOpp","fainted","faintedOpp
the Zth instance means the Zth Pokemon sent out. So bigDamageOpp,2 will play when the 2nd Pokemon in the opponents party is hit with an attack that takes it down 60% of it's HP.

Other features:

Code:
Expand Collapse Copy
BattleScripting.setTrainerOrder([0,2,3,4,5,1])
gives the order in which the trainer will send his pokémons. It has to start by 0 (his first pokemon).
By default, v20 always sends the ace in last position, this code allows you to change that if you want.

Once you made your choice you need to add this command in the battle event before the fight like this:

View: https://imgur.com/a/g6RCCDa


Use extendtext.exe that is in your root folder to avoid synthax errors.
So here I'm executing the function Tdamage at the end of the first turn (yes the first turn is turn 0).
But we still need to define Tdamage.

Creating the scripts
Open the data file inside the MBD plugin (a text editor like Notepad++ is required).
Every function should look like that:

Code:
Expand Collapse Copy
 Tdamage= Proc.new{|battle|
      do what you want
      }

If you want to have something proc x turn after your first action, do
Code:
Expand Collapse Copy
  Init= Proc.new{|battle|
            do what you want the first time it's triggered
            BattleScripting.set("turnStart#{battle.turnCount+x}",Proc.new{|battle|
                    do what you want x turns after the trigger
            })
      }

To have something happen every turn, use
Code:
Expand Collapse Copy
  Init= Proc.new{|battle|
       for i in 0...50  #make the things below proc during 50 turns
            BattleScripting.set("turnStart#{battle.turnCount+i}",Proc.new{|battle|
                    do what you want
            })
       end
      }
Warning! If you have 2 things happening at the same time, one of them won't trigger.
So if you always use TurnEnd as a time condition for your effects and you want something to trigger one turn after, make it happen at turnStart +2 instead to avoid the problem.

Effects examples
Here are the things you can put in the do what you want part in the section above.

Code:
Expand Collapse Copy
# For Opponent Sprite to Slide into Battle
battle.scene.pbShowOpponent(0,true) #0 is Index of Trainer. It can be 1 in a double battle if you want to show the 2nd Trainer. The "true" is if you want the Trainer to appear in front of their Pokemon
battle.scene.pbHideOpponent

# For changing Trainer Sprites. Works with any sprite in the Trainers Folder
TrainerDialogue.changeTrainerSprite("BEAUTY",battle.scene)

# For showing the SwSh styled animation for Dialogue
battle.scene.disappearDatabox
battle.scene.appearBar
#{Dialogue Stuff}
battle.scene.disappearBar
battle.scene.appearDatabox
# Note that the Black Bars are drawn above the Battle UI so you'd wanna hide the bars before proceeding with any Battle Animations and All

#change bgm
pbBGMPlay("Surfing")

# Dialogue
pbMessage("\\f[IintroOak]\\c[2]OK \\PN, let's see if you can beat this Pikachu!") #Remember that \f is the command to display a picture.
# Yes/No
pbConfirmMessage("Are you sad?")

# Choices
cmd= battle.pbShowCommands("Tell me what you want!",["A pizza!","Cheese!","nothing."])
#cmd is the index of the choice you made, so 0 for a pizza, 1 for cheese...

# Battle Text
battle.pbDisplay("It's stats rose!")

# Raising and Lowering Stats
battle.battlers[1].pbResetStatStages #reset (the opponent's) stat stage to 0

battle.battlers[1].pbRaiseStatStage(:ATTACK,2,battle.battlers[1])#if battle.battlers[1].pbCanRaiseStatStage?(:ATTACK)
 #raise (the opponent's) attack by 2 stages, the if part comes if you can reach the maximum

battle.battlers[0].pbLowerStatStage(:ATTACK,2,battle.battlers[0])#if battle.battlers[1].pbCanLowerStatStage?(:ATTACK)
#lower (your) attack by 2 stages. If you are using the boss protect effect (see below) don't put the if part or it won't do anything as you are shrouded by a mist.

# Displaying Common Animations
battle.pbCommonAnimation("Sky Attack charging",nil,nil)
battle.pbCommonAnimation("StatUp",nil,nil)

# Setting Weather
battle.pbStartWeather(battle.battlers[1],:Sandstorm)

# Setting Terrain
battle.pbStartTerrain(battle.battlers[1], :Electric)

# Forcefully Ending Battle
battle.scene.pbRecall(0)
battle.scene.pbRecall(2)
battle.pbCommonAnimation("MegaEvolution",nil,nil)
battle.decision=2 # Lost Battle
battle.decision=3# Flee
battle.decision=1# Won

#Recovering HP
battle.battlers[1].pbRecoverHP(amount) #amount is something like battle.battlers[1].totalhp/2

# Reducing HP of Pokemon
battle.pbLowerHP(battle.battlers[0],4) #Removes 1/4 of its total hp

# Setting Status
battle.pbAnimation(:DARKVOID,battle.battlers[1],battle.battlers[0]) #to have a nice anim coming from the opponent
battle.battlers[2].pbSleep if battle.battlers[2].pbCanSleep?(battle.battlers[1],false)
battle.battlers[0].pbSleep if battle.battlers[0].pbCanSleep?(battle.battlers[1],false)
#Remove the if part if you are using a safeguard or bossprotect effect and still want to set a status

# Setting up Effects on the opposing Side of Field
battle.pbAnimation(:STEALTHROCK,battle.battlers[1],battle.battlers[0])
battle.battlers[1].pbOpposingSide.effects[PBEffects::StealthRock]=true

battle.pbAnimation(:BARRIER,battle.battlers[1],nil)
battle.battlers[1].effects[PBEffects::BossProtect] = true
pbMessage("The enemy team is cloaked in a mystical veil.")

#changing Pokémon form (you can make a fake uncatchable form for a Pokémon if
#you want to make it evolve mid battle)
battle.scene.appearBar
battle.pbCommonAnimation("MegaEvolution",battle.battlers[1],nil)
battle.battlers[1].pbChangeForm(1,"idc")
battle.battlers[1].name="BIG BOY" #if you need to change their name, do it here
pbMessage("The boss reached their final form!")
battle.scene.pbRefresh
battle.scene.disappearBar

#changing pokemon moves
battler=battle.battlers[1]
pkmn=battler.pokemon
pkmn.moves[0] = Pokemon::Move.new(:DOOMDESIRE)   # Replaces current/total PP
battler.moves[0] = Battle::Move.from_pokemon_move(battle, pkmn.moves[0])

#forcing a move
$PokemonTemp.nextturnmoves=[nil,[1,0],nil,nil,nil,nil,0]
#the last number is the turn when the move is forced
#each other part is a battler. To force a move you need to input an array at the right place
#here we add the array in the second place, meaning it affects battler 1 (first opponent).
#the first number in this array is the move slot (here it's 1 so it's using the second move (it starts at 0))
#the second number is the target, so here 0 is my first pokemon.
#you should call this in a turn start proc

#exclude a battler from the low hp and co triggers
$PokemonTemp.excludedialogue=[3,5]
# you can now lower the health of battlers 3 and 5 without proccing low hp conditions

#if you have the SOS battle plugin,  you can make the pokemon call for an ally
#define what they call in the SOS battle script, don't forget to put the rate of this mon to 100 or it can fail.
#from an array:
battle.pbCallForHelp(battle.battlers[1])
battle.pbCallForHelp(battle.battlers[1],false) #the pokemon doesn't move the first turn

#calling a specific species
battle.pbCallally(battle.battlers[1],:REGICE,60)

#setting up and removing a HP threshold
battle.battlers[1].effects[PBEffects::Midhp] = true   #prevent the enemy to fall below 50/25/75% maxHP while it's active
battle.battlers[1].effects[PBEffects::Lowhp] = true   #don't forget to remove it later
battle.battlers[1].effects[PBEffects::Highhp] = true  #it prevents the boss from dying too fast
Credits
Mid battle Dialogue
Golisopod User (creator)
Luka SJ
Grogro for v20/v21 changes

SOS battles
thatonekriegerwriter
Vendily (For Original Script)
SoloReprise (for v19 Update)
  • 1673024498199.png
    1673024498199.png
    86.9 KB · Views: 5,948
Author
grogro
Downloads
1,649
Views
11,834
First release
Last update

Ratings

5.00 star(s) 1 ratings

More resources from grogro

Latest updates

  1. synchro bugfix

    Fixed a copy paste mistake. if you see an error message saying user is undefined for something...
  2. same problem

    another solution
  3. perish song fixed

    Fixed a mistake in the boss protection perish song code

Latest reviews

This is really cool but I don't understand how to do things like change battle music mid battle. Please help!
Back
Top