Individual Troop Battlebacks
#1
Individual Troop Battlebacks
Version: 1

Introduction
This script allows game makers to give a specific Troop ID their own battleback and other stuff (hue, mirror, tone). I'm not sure what it would be useful for, actually.

Features
  • Give a specific troop ID their own battleback.
  • Set battleback file, hue, mirror and tone.

Screenshots
[Image: m9ng3t.png]
Fighting Troop ID 1 in a modified grassland battleback.

Demo
No demo.

Script
Code:
=begin
????????????????????????????????????????????????????????????????????????????????
? Individual Troop Battleback                                                  ?
? by PK8                                                                       ?
? September 28th, 2009                                                         ?
? http://rmvxp.com                                                             ?
????????????????????????????????????????????????????????????????????????????????
? ? Table of Contents                                                          ?
? ?? Author's Notes                - Line 16?18                                ?
? ?? Introduction & Description    - Line 20?23                                ?
? ?? Features                      - Line 25?27                                ?
? ?? How to Use                    - Line 29?38                                ?
? ?? Methods Aliased               - Line 40,41                                ?
? ?? Thanks                        - Line 43,44                                ?
????????????????????????????????????????????????????????????????????????????????
? ? Author's Notes                                                             ?
? This script was requested by a user in HBGames.org's IRC channel 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         ?
? battleback and other stuff (hue, mirror, tone). I'm not sure what it would be?
? useful for, actually.                                                        ?
????????????????????????????????????????????????????????????????????????????????
? ? Features                                                                   ?
? ? Give a specific troop ID their own battleback.                             ?
? ? Set battleback file, hue, mirror and tone.                                 ?
????????????????????????????????????????????????????????????????????????????????
? ? How to Use                                                                 ?
? To give a troop ID their own battle theme, simply type this:                 ?
? Troops_BB[id] = [file, hue, mirror, [red, green, blue, sat]]                 ?
? file: Battleback Graphic name. (Should be in Graphics/Battlebacks directory) ?
? hue:    Set battleback's hue.               [Min: 0 - Max: 360]              ?
? mirror: Flip battleback horizontally?       [true or false]                  ?
? red:    Set amount of red in battleback.    [Min: -255 - Max: 255]           ?
? green:  Set amount of green in battleback.  [Min: -255 - Max: 255]           ?
? blue:   Set amount of blue in battleback.   [Min: -255 - Max: 255]           ?
? sat:    Set battleback saturation.          [Min: 0 - Max: 255 (grey)]       ?
????????????????????????????????????????????????????????????????????????????????
? ? Methods Aliased                                                            ?
? ? initialize of Spriteset_Battle                                             ?
????????????????????????????????????????????????????????????????????????????????
? ? Thanks                                                                     ?
? ? JoeYoung requested something like this in the HBGames.org's IRC channel.   ?
????????????????????????????????????????????????????????????????????????????????
=end

#------------------------------------------------------------------------------
# * Customise
#------------------------------------------------------------------------------
class PK8
  Troops_BB = {} # Do not touch this.
  
  #       [id] = [Battleback, Hue, Flip, [Red, Green, Blue, Sat] ]
  Troops_BB[1] = ["005-Beach01", 0, true, [0, 0, 0, 0]]
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_bb_initialize, :initialize)
  def initialize
    start_troop_battleback1
    pk8_troops_bb_initialize
    start_troop_battleback2
  end
  
  #----------------------------------------------------------------------------
  # * Start Troop BattleBack 1
  #----------------------------------------------------------------------------
  def start_troop_battleback1
    PK8::Troops_BB.each_key { | i |
    # If Troop ID equals the key.
    if $game_temp.battle_troop_id == i
      # If specified battleback File isn't nil or empty.
      if PK8::Troops_BB[i][0] != nil and !PK8::Troops_BB[i][0].empty?
        $game_temp.battleback_name = PK8::Troops_BB[i][0]
      end
      break
    end }
  end
  
  #----------------------------------------------------------------------------
  # * Start Troop BattleBack 2
  #----------------------------------------------------------------------------
  def start_troop_battleback2
    PK8::Troops_BB.each_key { | i |
    # If Troop ID equals the key.
    if $game_temp.battle_troop_id == i
      # Sets Battleback's hue to 0 if nil.
      PK8::Troops_BB[i][1] = 0 if PK8::Troops_BB[i][1] == nil
      # If mirror is set to nil, sets it to false.
      PK8::Troops_BB[i][2] = false if PK8::Troops_BB[i][2] == nil
      # Sets tone to [0, 0, 0, 0] if battleback's tone is nil.
      PK8::Troops_BB[i][3] = [0, 0, 0, 0] if PK8::Troops_BB[i][3] == nil
      # Sets battleback's red tone to 0 if nil
      PK8::Troops_BB[i][3][0] = 0 if PK8::Troops_BB[i][3][0] == nil
      # Sets battleback's green tone to 0 if nil
      PK8::Troops_BB[i][3][1] = 0 if PK8::Troops_BB[i][3][1] == nil
      # Sets battleback's blue tone to 0 if nil
      PK8::Troops_BB[i][3][2] = 0 if PK8::Troops_BB[i][3][2] == nil
      # Sets battleback's saturation to 0 if nil
      PK8::Troops_BB[i][3][3] = 0 if PK8::Troops_BB[i][3][3] == nil
      # Changing Hue
      @battleback_sprite.bitmap.hue_change(PK8::Troops_BB[i][1])
      # Flipping battleback?
      @battleback_sprite.mirror = PK8::Troops_BB[i][2]
      # Changing Tone
      @battleback_sprite.tone = Tone.new(PK8::Troops_BB[i][3][0],
      PK8::Troops_BB[i][3][1], PK8::Troops_BB[i][3][2], PK8::Troops_BB[i][3][3])
      break
    end }
  end
end

Instructions
Instructions are in the script.

FAQ
Awaiting question.

Compatibility
I'm not sure if it's compatible with any battle-related scripts or the SDK. Aliases Spriteset_Battle's initialize.

Credits and Thanks
JoeYoung for requesting 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.
Reply }
#2
Tongue sticking out You don't know what it would be useful for? Changing the hue can maybe give off a reddish-orange aura if you are fighting some flaming creature or something. It has its uses.
Reply }
#3
Yin Wrote:Tongue sticking out You don't know what it would be useful for? Changing the hue can maybe give off a reddish-orange aura if you are fighting some flaming creature or something. It has its uses.

Agreed. This is actually a really good script and could be very useful. Plus, the code isn't that long and nooby gamers won't have to fret their brains over the formatting. Nicely done.
Reply }
#4
Cool script! This could be useful for a large room with different types of terrain, and when combined with a script that changes encounters based on where you are on the map...you could have different troops for each terrain type...and then the battlebacks would go with where you are on the map!

It could also be used with your Individual Troop Themes XP script to have some rare encounters that are much different. Like the grassland has the grassland battleback and grasslandish enemies, but every so often you'll randomly be attacked by some Space Devourer creature that gets boss music and the Space battleback. I don't know, just an idea.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Troop : Self-Switches Kain Nobel 0 4,462 06-03-2016, 09:40 AM
Last Post: Kain Nobel
   Individual Battle Commands by Charlie Fleed, Version 1.0 Charlie Fleed 3 11,329 01-25-2014, 12:15 PM
Last Post: Charlie Fleed
   Troop : Self Switches Kain Nobel 1 5,858 02-02-2013, 01:07 PM
Last Post: yamina-chan
   Individual Battle Commands RPG Advocate 4 10,885 10-09-2011, 04:44 AM
Last Post: DerVVulfman
   Advanced Individual Battle Commands Trickster 6 15,918 01-29-2011, 04:30 AM
Last Post: DerVVulfman
   Individual Troop Themes XP PK8 5 10,049 10-03-2009, 06:36 PM
Last Post: Alpha-Mad
   Individual Troop Victory MEs PK8 1 5,998 09-29-2009, 06:18 AM
Last Post: Yin
   Enemy Troop Extender SephirothSpawn 0 4,782 03-02-2008, 07:18 AM
Last Post: SephirothSpawn
   Individual Turns Battle System Trickster 0 6,210 03-02-2008, 05:56 AM
Last Post: Trickster



Users browsing this thread: 1 Guest(s)