Preparing your files

Please wait until the download is ready.

Elite Battle: DX

Elite Battle: DX

by Luka S.J.

Take your battles to the next level with the ultimate Battle System skin!

Scripted Battles

For Wild and Trainer battles, the brand new feature is having more control over what you can do during these battles. EBDX allows for scripted battles, where you can run basic speech, Common Events or entire code during certain phases of the battle. Keep in mind that battle speech will only be applicable for trainer battles.

EliteBattle.set(:nextBattleScript, { options })
# Where options would be in the format: "option" => (Type)
# If (Type) is a (String): basic text will be displayed
# If (Type) is a (Numeric): Common Event of that value will be triggered
# If (Type) is a (Proc): the code block will be evaluated
# If (Type) is a (Array): display text one by one from the array of strings

# Specific options. Replace "X" with a numeric value
"turnStartX" => triggered at the beginning of turn, turncount X
"turnEndX"   => triggered at the end of turn, turncount X
"randX"      => random chance of triggering, higher value of X means lower chance

# Generic options. Can append numeric value for multiple instances
"beforeLast"      => triggered before player sends out their last battler
"beforeLastOpp"   => triggered before opponent sends out their last battler
"afterLast"       => triggered after player sends out their last battler
"afterLastOpp"    => triggered after opponent sends out their last battler
"item"            => triggered when player uses item
"itemOpp"         => triggered when opponent uses item
"beforeThrowBall" => triggered before player attempts capture
"afterThrowBall"  => triggered after player attempts capture
"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 30%
"lowHPOpp"        => triggered when opponent's battler HP reduced to below 30%
"halfHP"          => triggered when player's battler HP reduced to below 50%
"halfHPOpp"       => triggered when opponent's battler HP reduced to below 50%
"damage"          => triggered when player's battler receives over 60% damage from move
"damageOpp"       => triggered when opponent's battler receives over 60% damage from move
"resist"          => triggered when player's battler receives under 10% damage from move
"resistOpp"       => triggered when opponent's battler receives under 10% damage from move
"fainted"         => triggered when player's battler faints
"faintedOpp"      => triggered when opponent's battler faints
"attack"          => triggered after player performs an attack
"attackOpp"       => triggered after opponent performs an attack
"turnAttack"      => triggered before entering the attack phase
"loss"            => triggered when player loses battle
"endspeech"       => triggers speech when player wins battle (can be omitted if defined in the trainer battle call)

(Type) can also be split into a Hash containing { :text => value, :bgm => value, :file => value }
Where assigning a (String) to the :bgm would trigger a BGM switch during the battle when the "option" is triggered,
And :file allows you to manually assign the trainer graphic of the shown opponent.
In this case, :text would follow the same behaviour for Numeric, String, Proc, Array as shown above.

Some example uses can be seen below:

EliteBattle.set(:nextBattleScript, {
  # set trainer Speech and BGM changes during battle
  "turnStart0" => "Time to set this battle into motion!",
  "damageOpp" => "Woah! A powerful move!",
  "lastOpp" => {
    :text => "This is it! Let's make it count!",
    :bgm => "lastBattle.ogg"
  },
  "lowHPOpp" => "Hang in there!",
  "attack" => "Whatever you throw at me, my team can take it!",
  "attackOpp" => "How about you try this one on for size!",
  "fainted" => "That's how we do it in this gym!",
  "faintedOpp" => "Arghh. You did well my friend...",
  "loss" => "You can come back and challenge me any time you want."
})
EliteBattle.set(:nextBattleScript, { 
  # run proc at turn 0 to reconfigure
  # battle scene components
  "turnStart0" => proc do
    @sprites["battlebg"].reconfigure(:DISCO)
  end
  # additionally, in a Proc for scripted battles, the system exposes additional
  # system variables to easily use within the code block
  #   @scene      => Main `PokeBattle_Scene` object
  #   @battle     => Main `PokeBattle_Battle` object
  #   @battlers   => Array containing all the `PokeBattle_Battlers`
  #   @opponent   => Array of opposing trainers
  #   @viewport   => Main scene viewport
  #   @sprites    => Entire scene sprite hash
  #   @vector     => Main scene vector
})

For ease of use, you can also define the entire scripted battle as a constant in the Plugins/Elite Battle DX/[003] Config/Battle Scripts.rb file, and later reference it through its symbolic name. You can see an example below:

module BattleScripts
  DIALGA = {
    "turnStart0" => proc do
      # hide databoxes
      @scene.pbHideAllDataboxes
      # show flavor text
      @scene.pbDisplay("The ruler of time itself; Dialga starts to radiate tremendous amounts of energy!")
      @scene.pbDisplay("Something is about to happen ...")
      # play common animation
      EliteBattle.playCommonAnimation(:ROAR, @scene, 1)
      @scene.pbDisplay("Dialga's roar is pressurizing the air around you! You feel its intensity!")
      # change the battle environment (use animation to transition)
      @sprites["battlebg"].reconfigure(:DIMENSION, :DISTORTION)
      @scene.pbDisplay("Its roar distorted the dimensions!")
      @scene.pbDisplay("Dialga is controlling the domain.")
      # show databoxes
      @scene.pbShowAllDataboxes
    end
  } 
end

Then you simply queue up the battle script like this:

EliteBattle.set(:nextBattleScript, :DIALGA)