📒
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

Advanced: Storing Scripts

Section 4.C.3

PreviousAdvanced: Variable UtilitiesNextAdvanced: Hardcoding

Last updated 1 year ago

Was this helpful?

Midbattle hashes can be quite long and complex. Because of this, sometimes It's simply impractical to include the entire thing in the "midbattleScript" Battle Rule in an event. To address this, I've created a secondary way of implementing a midbattle script by simply using a symbol ID to refer to an entire hash. This is done by instead creating the entire hash in the plugin scripts themselves. This can be done by using the MidbattleScripts module.

In the Deluxe Battle Kit plugin scripts, create a new script file (in the RB format, like the rest of the plugin scripts) and name this new file whatever you want. You can install for these types of files, if you don't already have a program that recognizes this format. In here, create a module called MidbattleScripts. Inside this module, you can save as many midbattle hashes as you want as constants, which you can then call upon as a shortcut to that midbattle hash without having to include the entire thing in a battle rule. This allows you to make as long of a script as you want without having to worry about cramming each event with enormous scripts. For example, say your custom file contained this script:

module MidbattleScripts
  MIDBATTLE_EXAMPLE_SCRIPT = {
    "RoundStartCommand_1_foe" => {
      "speech" => "You're not gonna beat me this time!"
    },
    "BattleEndLose" => {
      "speech" => "See? I told you!"
    },
    "BattleEndWin" => {
      "speech" => "No! Impossible!"
    }
  }
end

The constant used here is named MIDBATTLE_EXAMPLE_SCRIPT, but you may name this whatever you wish, as long as it's unique and doesn't overlap with an existing constant within this module. Once your constant is saved, you can then call it within the "midbattleScript" Battle Rule instead of inputting the entire hash, like so:

setBattleRule("midbattleScript", :MIDBATTLE_EXAMPLE_SCRIPT)

Note that when the constant is entered in the battle rule, it needs to be entered as a symbol, meaning it requires a semi-colon in front. It shouldn't have this when entered in the module.

You can use this method to make very long and intricate midbattle hashes without having to worry about space in the event scripts. If you want more intricate examples of midbattle scripts that utilize this feature, check the plugin file [002] Midbattle Scripting/[003] MidbattleScripts Module.

Notepad++