Individual Troop Themes
Version: 1
Version: 1
Introduction
This script allows game makers to give a specific Troop ID their own theme song. Useful for Boss battles and other unique battles.
Features
- Give a specific troop ID their own theme.
- Set the song, volume and pitch.
Screenshots
No screencaps.
Demo
No demo is needed.
Script
XP
- =begin
- ╔══════════════════════════════════════════════════════════════════════════════╗
- ║ Individual Troop Themes XP ║
- ║ by PK8 ║
- ║ September 28th, 2009 ║
- ║ http://rmvxp.com ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Table of Contents ║
- ║ ├─ Author's Notes - Line 16─18 ║
- ║ ├─ Introduction & Description - Line 20─22 ║
- ║ ├─ Features - Line 24─26 ║
- ║ ├─ How to Use - Line 28─30 ║
- ║ ├─ Methods Aliased - Line 32,33 ║
- ║ └─ Thanks - Line 35,36 ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Author's Notes ║
- ║ This script was requested by a user in HBGames.org's IRC channel (I forgot ║
- ║ his name) and I was interested in creating this script so... here you go! ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Introduction & Description ║
- ║ This script allows game makers to give a specific Troop ID their own theme ║
- ║ song. Useful for Boss battles and other unique battles. ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Features ║
- ║ ─ Give a specific troop ID their own theme. ║
- ║ ─ Set the song, volume and pitch. ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ How to Use ║
- ║ To give a troop ID their own battle theme, simply type this: ║
- ║ Troops_Theme[id] = ["file", volume, pitch] ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Methods Aliased ║
- ║ ─ initialize of Spriteset_Battle ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Thanks ║
- ║ ─ JoeYoung requested something like this in the HBGames.org's IRC channel. ║
- ╚══════════════════════════════════════════════════════════════════════════════╝
- =end
- #------------------------------------------------------------------------------
- # * Customise
- #------------------------------------------------------------------------------
- class PK8
- Troops_Theme = {} # Do not touch this.
- # [id] = [Music File, Volume, Pitch]
- Troops_Theme[1] = ["002-Battle02", 100, 100]
- Troops_Theme[2] = ["009-LastBoss01", 100, 100]
- end
- #==============================================================================
- # ** Spriteset_Battle
- #------------------------------------------------------------------------------
- # This class brings together battle screen sprites. It's used within
- # the Scene_Battle class.
- #==============================================================================
- class Spriteset_Battle
- alias_method(:pk8_troops_theme_initialize, :initialize)
- def initialize
- pk8_troops_theme_initialize
- start_troop_theme
- end
- #----------------------------------------------------------------------------
- # * Start Troop Theme
- #----------------------------------------------------------------------------
- def start_troop_theme
- PK8::Troops_Theme.each_key { | i |
- # If Troop ID equals the key.
- if $game_temp.battle_troop_id == i
- # If specified BGM isn't nil or empty.
- if PK8::Troops_Theme[i][0] != nil and !PK8::Troops_Theme[i][0].empty?
- # Sets BGM volume to 100 if nil.
- PK8::Troops_Theme[i][1] = 100 if PK8::Troops_Theme[i][1] == nil
- # Sets BGM pitch to 100 if nil.
- PK8::Troops_Theme[i][2] = 100 if PK8::Troops_Theme[i][2] == nil
- # Plays BGM.
- Audio.bgm_play("Audio/BGM/#{PK8::Troops_Theme[i][0]}",
- PK8::Troops_Theme[i][1], PK8::Troops_Theme[i][2])
- end
- break
- end }
- end
- end
Expand to see the code.
VX
- =begin
- ╔══════════════════════════════════════════════════════════════════════════════╗
- ║ Individual Troop Themes VX ║
- ║ by PK8 ║
- ║ September 28th, 2009 ║
- ║ http://rmvxp.com ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Table of Contents ║
- ║ ├─ Author's Notes - Line 16─18 ║
- ║ ├─ Introduction & Description - Line 20─22 ║
- ║ ├─ Features - Line 24─26 ║
- ║ ├─ How to Use - Line 28─30 ║
- ║ ├─ Methods Aliased - Line 32,33 ║
- ║ └─ Thanks - Line 35─37 ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Author's Notes ║
- ║ This script was requested by a user in HBGames.org's IRC channel (I forgot ║
- ║ his name) and I was interested in creating this script so... here you go! ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Introduction & Description ║
- ║ This script allows game makers to give a specific Troop ID their own theme ║
- ║ song. Useful for Boss battles and other unique battles. ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Features ║
- ║ ─ Give a specific troop ID their own theme. ║
- ║ ─ Set the song, volume and pitch. ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ How to Use ║
- ║ To give a troop ID their own battle theme, simply type this: ║
- ║ Troops_Theme[id] = ["file", volume, pitch] ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Methods Aliased ║
- ║ ─ call_battle of Scene_Map ║
- ╟──────────────────────────────────────────────────────────────────────────────╢
- ║ ■ Thanks ║
- ║ ─ JoeYoung requested something like this in the HBGames.org's IRC channel. ║
- ║ ─ Decibel showing me how I could find the ID of the troop I'm battling. ║
- ╚══════════════════════════════════════════════════════════════════════════════╝
- =end
- #------------------------------------------------------------------------------
- # * Customise
- #------------------------------------------------------------------------------
- class PK8
- Troops_Theme = {} # Do not touch this.
- # [id] = [Music File, Volume, Pitch]
- Troops_Theme[1] = ["Airship", 100, 100]
- Troops_Theme[2] = ["Battle10", 100, 100]
- end
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # This class performs the map screen processing.
- #==============================================================================
- class Scene_Map
- alias_method(:pk8_troops_theme_call_battle, :call_battle)
- def call_battle
- pk8_troops_theme_call_battle
- start_troop_theme
- end
- #----------------------------------------------------------------------------
- # * Start Troop Theme
- #----------------------------------------------------------------------------
- def start_troop_theme
- PK8::Troops_Theme.each_key { | i |
- # If Troop ID equals the key.
- if $game_troop.troop.id == i
- # If specified BGM isn't nil or empty.
- if PK8::Troops_Theme[i][0] != nil and !PK8::Troops_Theme[i][0].empty?
- # Sets BGM volume to 100 if nil.
- PK8::Troops_Theme[i][1] = 100 if PK8::Troops_Theme[i][1] == nil
- # Sets BGM pitch to 100 if nil.
- PK8::Troops_Theme[i][2] = 100 if PK8::Troops_Theme[i][2] == nil
- # Plays BGM.
- Audio.bgm_play("Audio/BGM/#{PK8::Troops_Theme[i][0]}",
- PK8::Troops_Theme[i][1], PK8::Troops_Theme[i][2])
- end
- break
- end }
- end
- end
Expand to see the code.
Instructions
Instructions are in the script.
FAQ
Awaiting question.
Compatibility
XP: I'm not sure if it's compatible with the SDK or any custom battle scripts. This script aliases Spriteset_Battle's initialize method.
VX: This script aliases Scene_Map's call_battle.
Credits and Thanks
XP/VX: JoeYoung requested something like this in HBGames.org's IRC channel.
VX: Decibel showing me how I could find the ID of the troop I'm battling.
Author's Notes
This script was requested by someone, I was interested, voila! :P
Terms and Conditions
Exclusive to RMVXP.com and HBGames.org. Credit me!