09-29-2009, 03:07 AM
Individual Troop Battlebacks
Version: 1
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
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.