Individual Troop Themes XP
#1
Individual Troop Themes XP
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
Code:
=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

Instructions
Instructions are in the script.

FAQ
Awaiting question.

Compatibility
I'm not sure if it's compatible with the SDK or any custom battle scripts. This script aliases Spriteset_Battle's initialize method.

Credits and Thanks
JoeYoung requested something like this in HBGames.org's IRC channel.

Author's Notes
This script was requested by someone, I was interested, voila! :P

Terms and Conditions
Exclusive to RMVXP.co.cc and HBGames.org. Credit me!
Reply }
#2
I would totally use this if I were using a battle system with troops. I am using ATOA's Chrono Trigger script. I do like the idea though. This would actually be much simpler to use than constantly switching the battle theme back and forth with events. Nicely done!
Reply }
#3
Yes, this is definitely useful for boss battles. I'm going to use it.
Reply }
#4
I've actually been wanting something like this for a while. It's perfect for those random boss monsters...
Reply }
#5
Adding on to what I said before, this makes things automated and makes it much easier to handle events without having to worry about forgetting to switch the music back to normal or other crap like that. It's great.
Reply }
#6
This reminds me of FF6, in the Veldt, where all the monsters that have been faced during the game go to. Each troop could have it's own battle music that relates to where you fought them earlier in the game.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Troop : Self-Switches Kain Nobel 0 4,466 06-03-2016, 09:40 AM
Last Post: Kain Nobel
   Individual Battle Commands by Charlie Fleed, Version 1.0 Charlie Fleed 3 11,347 01-25-2014, 12:15 PM
Last Post: Charlie Fleed
   Troop : Self Switches Kain Nobel 1 5,865 02-02-2013, 01:07 PM
Last Post: yamina-chan
   Individual Battle Commands RPG Advocate 4 10,912 10-09-2011, 04:44 AM
Last Post: DerVVulfman
   Advanced Individual Battle Commands Trickster 6 15,941 01-29-2011, 04:30 AM
Last Post: DerVVulfman
   Variable-Based Battle Themes v1.1 PK8 1 7,262 11-27-2009, 07:29 PM
Last Post: explocion200
   Individual Troop Battlebacks PK8 3 8,824 10-02-2009, 10:57 AM
Last Post: Cloak of Laser Cannon
   Individual Troop Victory MEs PK8 1 6,011 09-29-2009, 06:18 AM
Last Post: Yin
   Enemy Troop Extender SephirothSpawn 0 4,789 03-02-2008, 07:18 AM
Last Post: SephirothSpawn
   Individual Turns Battle System Trickster 0 6,213 03-02-2008, 05:56 AM
Last Post: Trickster



Users browsing this thread: 1 Guest(s)