📒
Deluxe Battle Kit Tutorial
  • Deluxe Battle Kit for v21.1
    • Deluxe Animations
      • Animation: Databoxes
      • Animation: Item Usage
      • Animation: Fleeing Pokemon
      • Animation: Mega Evolution
      • Animation: Primal Reversion
      • Animation: Shadow Pokemon
    • Deluxe Battle Rules
      • Rules: Battle Modes
      • Rules: Battle Visuals
      • Rules: Battle Audio
      • Rules: Editing the Player
      • Rules: Mega Evolution
      • Rules: Capturing Pokemon
      • Rules: Editing Wild Pokemon
    • Wild Boss Attributes
      • Attribute: Boosted HP
      • Attribute: Immunities
    • Mid-Battle Scripting
      • Trigger Keys
        • Triggers: Round Phases
        • Triggers: Battler Turns
        • Triggers: Item Usage
        • Triggers: Wild Capture
        • Triggers: Switching
        • Triggers: Megas & Primals
        • Triggers: Move Usage
        • Triggers: Damage Results
        • Triggers: Battler Condition
        • Triggers: End of Effects
        • Triggers: End of Battle
        • Triggers: Variable
        • Triggers: Choices
        • Triggers: Extensions
          • Extensions: User
          • Extensions: Frequency
      • Command Keys
        • Commands: Text & Speech
        • Commands: Audio & Animation
        • Commands: Utilities
        • Commands: Battle Mechanics
        • Commands: Battler Attributes
        • Commands: Battlefield Conditions
        • Commands: Extensions
      • Advanced Scripting
        • Advanced: Speech Utilities
          • Speech: General
          • Speech: Choices
          • Speech: Speakers
        • Advanced: Variable Utilities
        • Advanced: Storing Scripts
        • Advanced: Hardcoding
        • Advanced: Global Scripts
    • Example Battles
      • Examples: Wild Battles
      • Examples: Trainer Battles
    • Miscellaneous Utilities
    • Add-On Tutorials
      • Enhanced Battle UI
        • UI: Battler Info
        • UI: Poke Ball Shortcut
        • UI: Move Info
      • SOS Battles
        • SOS: Plugin Overview
        • SOS: PBS Data
        • SOS: Battle Rules
        • SOS: Mid-Battle Scripting
      • Raid Battles
      • Z-Power
        • Z-Power: Z-Moves
        • Z-Power: Ultra Burst
        • Z-Power: Animations
        • Z-Power: Battle Rules
        • Z-Power: Mid-Battle Scripting
      • Dynamax
        • Dynamax: Properties
        • Dynamax: Move Data
        • Dynamax: Form Data
        • Dynamax: Animations
        • Dynamax: Battle Rules
        • Dynamax: Mid-Battle Scripting
      • Terastallization
        • Terastal: Tera Types
        • Terastal: Tera Forms
        • Terastal: Animations
        • Terastal: Battle Rules
        • Terastal: Mid-Battle Scripting
      • Improved Item AI
        • Item AI: Handlers
      • Wonder Launcher
        • Launcher: Plugin Overview
        • Launcher: PBS Data
        • Launcher: Battle Rules
        • Launcher: Mid-Battle Scripting
      • Animated Pokemon System
        • Animated: Pokemon Sprites
        • Animated: Dynamic Sprite Effects
        • Animated: UI Sprites
        • Animated: Sprite Editor
        • Animated: Mid-Battle Scripting
      • Animated Trainer Intros
        • Intros: Trainer Sprites
        • Intros: Sprite Editor
        • Intros: UI Sprites
        • Intros: Battle Transitions
        • Intos: Mid-Battle Scripting
Powered by GitBook
On this page

Was this helpful?

  1. Deluxe Battle Kit for v21.1
  2. Mid-Battle Scripting
  3. Advanced Scripting
  4. Advanced: Speech Utilities

Speech: General

Section 4.C.1.A

PreviousAdvanced: Speech UtilitiesNextSpeech: Choices

Last updated 10 months ago

Was this helpful?

This subsection details the basics in setting speech and offers general tips and advice on how to get the most out of your speech events.


Speech as a String

This is the simplest way to set up speech. This is done by setting the "speech" Command Key to a string, and whichever trainer's Pokemon has triggered the associated Trigger Key will speak that line of text. For example:

"BeforeMove_TRICKROOM_foe" => {
  "speech" => "Time to flip things upside-down!"
}

This will trigger before the opponent's Pokemon uses the move Trick Room. If so, the they will slide on screen and speak the line of dialogue entered. Pretty simple.

But what if I told you there's a way to make this even simpler? If speech is all you want to happen when this Trigger Key is triggered, then you don't even have to bother setting up a hash and using the "speech" Command Key. Instead, you can simply set the Trigger Key itself as the desired line of speech, like so:

"BeforeMove_TRICKROOM_foe" => "Time to flip things upside-down!"

This will produce exactly the same results as the previous example. When Trigger Keys are given strings as values like shown here, they will automatically assume that the string is meant as speech, and act as if the "speech" Command Key is being called. This shortcut can only be used for speech. No other function may be set up in this manner.


Speech as an Array

In some scenarios, you may want multiple lines of dialogue to be spoken, and don't want to cram it all in a single string. To accomplish this, setting "speech" as an array will also work, like in the example below:

"BattlerFainted_CHARIZARD_foe" => {
  "speech" => ["N-no! Charizard!",
               "Argh, do you think this is over because you've beaten my ace?",
               "No...not by a long shot!"]
}

In this example, the opponent will slide on screen and say three different consecutive lines of speech after their Charizard faints. However, this can also be simplified in exactly the same way as outlined in the "String" section above, like so:

"BattlerFainted_CHARIZARD_foe" => ["N-no! Charizard!",
                                   "Argh, do you think this is over because you've beaten my ace?",
                                   "No...not by a long shot!"]

You may set the value of the Trigger Key itself to the array of strings to have these lines be spoken without having to set up an entire hash.


Speech with Multiple Speakers

There may be some scenarios where you don't want just a single speaker saying lines, but instead want multiple speakers with back and forth dialogue. There are a multitude of ways to accomplish this, and I'll outline them below.


Adding Indexes to Arrays

One of the more simple ways of accomplishing this is to set up the entire dialogue exchange in an array with a single "speech" Command Key, except you can indicate which lines of speech should be spoken by each speaker by entering an index prior to the lines you want that speaker to say. For example:

"AfterLastSwitchIn_player" => {
  "speech" => [1, "Pathetic. Give up, already.",
               0, "Never! {1} and I can still win!",
               1, "Win? You can hardly stand! Haha!",
               0, "We'll show you!"]
}

In this example, we have an array of speech which is triggered after the player sends out their final remaining Pokemon. However, you'll notice that within this array, there are numbers included along with the strings of text. These numbers indicate which trainer actually speaks the following line of dialogue. The numbers represent battler indexes. "0" refers to the first battler on the player's side, and "1" refers to the first battler on the opponent's side. The speaker is whichever trainer owns the Pokemon that appears at that index.

So in this example, "1" sets the speaker as the opponent, so the opposing trainer will slide in to speak the first line of dialogue. Then, since "0" appears next in the array, the active speaker is hidden and the next line of dialogue is then spoken by the player. Note that you can still use the shortcut described in the "Speech as an Array" section to set this speech directly to the Trigger Key instead of creating a hash.


Adding Symbols to Arrays

What if you don't want to keep track of index numbers for speakers? Perhaps you find it too confusing, or perhaps you're just setting up a scenario where you can't be sure exactly which speaker index will be available to use. In situations like this, you may set certain symbols in place of an index. Here's an example:

"BattlerEffectEnded_SlowStart" => {
  "speech" => [:Self, "Now you're in trouble! Get'em, {1}!",
               :Opposing, "Oh no...how could I let this happen?"]
}

Here, we have an array of speech which is triggered when the turn counter for the Slow Start ability ends, and Regigigas's stats are at full power. Because no Trigger Extension is used on this Trigger Key to indicate if this should trigger for the player or opponent's Pokemon, this will simply trigger when any battler meets these conditions. In this scenario, this becomes impossible to tell which indexes should be used to indicate the speakers of each line, since you have no way of knowing which trainer's Pokemon will be the one who's Slow Start turns end first.

To resolve this, we can simply use generic symbols to indicate who should speak each line, instead of specific indexes. Here are all of the available symbols that may be used, and who they refer to:

  • :Self This indicates that the speaker should be set to the index of whichever battler triggered the associated Trigger Key.

  • :Ally This indicates that the speaker should be set to the index of the first available ally of whichever battler triggered the associated Trigger Key. Defaults to :Self if no ally exists.

  • :Ally2 This indicates that the speaker should be set to the index of the second available ally (if any) of whichever battler triggered the associated Trigger Key. Defaults to :Ally if no secondary ally exists. Defaults to :Self if neither exist.

  • :Opposing This indicates that the speaker should be set to the index of the closest available opponent of whichever battler triggered the associated Trigger Key. Defaults to :Self if no opponent exists.

  • :OpposingAlly This indicates that the speaker should be set to the index of the first available ally (if any) of the closest available opponent to whichever battler triggered the associated Trigger Key. Defaults to :Opponent if no opposing ally exists. Defaults to :Self if neither exist.

  • :OpposingAlly2 This indicates that the speaker should be set to the index of the second available ally (if any) of the closest available opponent to whichever battler triggered the associated Trigger Key. Defaults to :OpposingAlly if no secondary opposing ally exists. Defaults to :Opposing if no opposing allies exist. Defaults to :Self if no opponents exist.

So following this, it's easy to see how the speech would flow in the example provided. The first line of speech is indicated to be spoken by whichever trainer owns the Pokemon found at whichever index :Self refers to, which would be whichever battler initially triggered the Trigger Key. The second line of speech is indicated to be spoken by whichever trainer owns the Pokemon found at whichever index :Opposes refers to, which would be whichever battler directly opposes the battler which :Self refers to.

So for example, if the scenario played out in a way where the player's Regigigas was the one who triggered "BattlerEffectEnded_SlowStart", then the player would speak the line that follows :Self, and the opponent would speak the line that follows :Opposing.

However, if it was the opponent's Regigigas who was the one who triggered "BattlerEffectEnded_SlowStart", then it would be the opponent that would speak the line that follows :Self, and the player would be the one who spoke the line that follows :Opposing. This is because from the opponent's perspective, the player is the one who :Opposing points to, since they are the one who activated the Trigger Key.

Triggered from the player's perspective.
Triggered from the opponent's perspective.