Battler Sprite Addons
#1
Battler Sprite Addons
Version: 1.2

Introduction
Adds on additional properties from the Sprite class to battler sprites which weren't included before such as Angle, Tone, Color, Mirror, Zoom_X and Zoom_Y. As of version 1.1, it also allows devs to change certain properties of battler sprites.

Features
  • Gives battler sprites additional properties from the Sprite class such as angle, tone, color, mirror, zoom_x and zoom_y.
  • Change the color, tone, angle and size of battler sprites with script calls.
  • 1 customization option. (See Customization section in text file.)
Script
Code:
=begin
????????????????????????????????????????????????????????????????????????????????
? Battler Sprite Addons                                                        ?
? Version 1.2 by Punk                                                          ?
????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????
? ? Description:                                                               ?
? ?? Adds on additional properties to battler sprites which weren't included   ?
?    before such as Angle, Tone, Color, Mirror, Zoom_X and Zoom_Y.             ?
????????????????????????????????????????????????????????????????????????????????
? ? Features:                                                                  ?
? ?? Gives battler sprites additional properties from the Sprite class such    ?
? ?  as angle, tone, color, mirror, zoom_x and zoom_y.                         ?
? ?? Change the angle, size, color, tone of a battler sprite as well as        ?
?    flipping it horizontally with script calls. (New to Version 1.1)          ?
????????????????????????????????????????????????????????????????????????????????
? ? Customization                                                              ?
? ?? For those who don't like how in the zoom functions, the value 1.0         ?
?    signifies "actual pixel size", I've changed it a bit to make the value    ?
?    100.0 signify actual pixel size. For those who may not like the update,   ?
?    you can disable this by jumping to the third line after this long box     ?
?    and set BattlerSpriteZoom100 to false.                                    ?
????????????????????????????????????????????????????????????????????????????????
? ? Usage:                                                                     ?
? ? ? Tones.                                                                   ?
? ?? How do I change the tone of an actor's sprite?                            ?
? ?     1. Use Call script event command.                                      ?
? ?     2. Type this (replace red green blue saturation with values):          ?
? ?        $game_actors[id].tone = Tone.new(red, green, blue(, sat))           ?
? ?        $game_party.actors[index].tone = Tone.new(red, green, blue(, sat)   ?
? ?        return true                                                         ?
? ?? How do I change the tone of an event's sprite?                            ?
? ?     1. Use Call script event command.                                      ?
? ?     2. Type this (replace id with an enemy id):                            ?
? ?        $game_troop.enemies[id].tone = Tone.new(red, green, blue(, sat))    ?
? ?        return true                                                         ?
? ?? Example usage? I may still be confused.                                   ?
? ?     $game_actors[1].tone = Tone.new(100, 100, 100, 255);return true        ?
? ?     $game_party.actors[0].tone = Tone.new(100, 100, 100, 255);return true  ?
? ?     $game_troop.enemies[0].tone = Tone.new(-64, 0, -64, 0);return true     ?
? ?     $game_troop.enemies[0].tone = Tone.new(-64, 0, -64);return true        ?
? ? ? Angles.                                                                  ?
? ?? How do I change the angle of the actors's sprite?                         ?
? ?     1. Use Call script event command.                                      ?
? ?     2. Type this (replace angle with a value):                             ?
? ?        $game_actors[id].angle = value                                      ?
? ?        $game_party.actors[index].angle = value                             ?
? ?? How do I change the angle of an enemy's sprite?                           ?
? ?     1. Use Call script event command.                                      ?
? ?     2. Type this (replace angle with a value, id with an event id):        ?
? ?        $game_troop.enemies[id].angle = value                               ?
? ? ? Colors.                                                                  ?
? ?? How do I change the color of the first actor's sprite?                    ?
? ?     1. Use Call script event command.                                      ?
? ?     2. Type this (replace red green blue alpha with values):               ?
? ?        $game_actors[1].color = Color.new(red, green, blue(, alpha))        ?
? ?        return true                                                         ?
? ?? How do I change the angle of an enemy's sprite?                           ?
? ?     1. Use Call script event command.                                      ?
? ?     2. Type this (replace id with an event id):                            ?
? ?        $game_troop.enemies[id].color = Color.new(red, green, blue(, alpha))?
? ?        return true                                                         ?
? ?? Example usage? I may still be confused.                                   ?
? ?     $game_actors[1].color = Color.new(100, 100, 100, 100);return true      ?
? ?     $game_party.actors[0].color = Color.new(200, 0, 200, 255);return true  ?
? ?     $game_troop.enemies[0].color = Color.new(200, 0, 200);return true      ?
? ?                                                                            ?
? ? ? zoom_x and zoom_y.                                                       ?
? ?? How do I change the sprite's x-axis zoom level?                           ?
? ?     For actor: $game_party.actors[index].zoom_x = value                    ?
? ?     For enemy: $game_troop.enemies[index].zoom_x = value                   ?
? ?? How do I change the sprite's y-axis zoom level?                           ?
? ?     For actor: $game_party.actors[index].zoom_y = value                    ?
? ?     For enemy: $game_troop.enemies[index].zoom_y = value                   ?
? ? ? Mirror.                                                                  ?
? ?? How do I flip battler sprites horizontally?                               ?
? ?     For actors: $game_party.actors[index].mirror = true                    ?
? ?     For events: $game_troop.enemies[index].mirror = true                   ?
? ?? Okay, how do I unflip them?                                               ?
?       For actors: $game_party.actors[index].mirror = false                   ?
?       For events: $game_troop.enemies[index].mirror = false                  ?
????????????????????????????????????????????????????????????????????????????????
? ? Methods Aliased:                                                           ?
? ?? update - Sprite_Battler < RPG::Sprite                                     ?
? ?? initialize - Game_Battler                                                 ?
????????????????????????????????????????????????????????????????????????????????
? ? Changelog:                                                                 ?
? ?? Version 1.1 (5/10/09) - Replaced attr_reader with attr_accessor.          ?
? ?? Version 1.2 (5/12/09) - Updated the zoom stuff. (More info below)         ?
????????????????????????????????????????????????????????????????????????????????
? ? About Version 1.2 change:                                                  ?
?   Originally, the value '1.0' for properties zoom_x and zoom_y stood for     ?
?   the battler sprite's actual size. I felt like trying to explain that in    ?
?   the instructions of this script and add-ons made to it would just confuse  ?
?   some people. So I wanted to make the value 100.0 denote the actual pixel   ?
?   size of the sprite.                                                        ?
????????????????????????????????????????????????????????????????????????????????
=end

#????????????????????????????????????????????????????????????????????????????????
#? ? Customize                                                                 ?
#????????????????????????????????????????????????????????????????????????????????
class PK8
  BattlerSpriteZoom100 = true
  # If false, sprite's zoom level value 1.0 would denote actual pixel size.
  # If true, sprite's zoom level value 100.0 would denote actual pixel size.
end

#===============================================================================?
# ** Game_Battler
#===============================================================================?

class Game_Battler
  #-----------------------------------------------------------------------------
  # * Public Instance Variables
  #-----------------------------------------------------------------------------
  attr_accessor :tone
  attr_accessor :angle
  attr_accessor :zoom_x
  attr_accessor :zoom_y
  attr_accessor :mirror
  attr_accessor :color
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :pk8_battler_sprite_addons_initialize, :initialize
  #-----------------------------------------------------------------------------
  # * Object Initialization
  #-----------------------------------------------------------------------------
  def initialize(*args)
    @tone   = Tone.new(0, 0, 0, 0)
    @angle  = 0
    @zoom_x = (PK8::BattlerSpriteZoom100 ? 100.0 : 1.0)
    @zoom_y = (PK8::BattlerSpriteZoom100 ? 100.0 : 1.0)
    @mirror = false
    @color  = Color.new(0, 0, 0, 0)
    pk8_battler_sprite_addons_initialize(*args)
  end
end

#===============================================================================?
# ** Sprite_Battler
#===============================================================================?

class Sprite_Battler < RPG::Sprite
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :pk8_battler_sprite_addons_update, :update
  #-----------------------------------------------------------------------------
  # * Update
  #-----------------------------------------------------------------------------
  def update
    pk8_battler_sprite_addons_update
    return unless @battler
    self.tone = @battler.tone
    self.angle = @battler.angle
    if PK8::BattlerSpriteZoom100 == true
      self.zoom_x = @battler.zoom_x / 100.0
      self.zoom_y = @battler.zoom_y / 100.0
    elsif PK8::BattlerSpriteZoom100 == false
      self.zoom_x = @battler.zoom_x
      self.zoom_y = @battler.zoom_y
    end
    self.mirror = @battler.mirror
    self.color = @battler.color
  end
end

Instructions
Copy-paste! Also, look for any add-on topics which may link to this as a requirement for use.

FAQ
Changing the tone of a battler sprite
Example usage of changing battler sprite tone?
Changing the color of a battler sprite.
Example usage of changing battler sprite color?
Changing the angle of a battler sprite
Changing the x-axis and y-axis zoom level of a battler sprite
Flipping battler sprite horizontally

Compatibility
This aliases the following methods from the following classes.
  • Sprite_Battler < RPG::Sprite
    • update
  • Game_Battler
    • initialize
Author's Notes
I want scripters to add on to it. :3

Terms and Conditions
It's not necessary to credit me for this. <--Thats what PK8 said in his battler sprite addons script. This is a remix of his "Character Sprite Addons" tailored to battlers, so it isn't necessary for you to credit ME for this (I mean you can) but I would like you to credit PK8 even if he doesn't say so =P

------------------------------
Add-ons
Battler Tone, Angle, Color, Mirror and Size comment commands. (Should be posted later tonight I hope)
[Image: Button-BOTB.png]
[Image: Save-Point.gif][Image: Button-You-Tube2.png][Image: Button-Sound-Cloud2.png][Image: Button-Audio-Mack2.png]
[Image: LS-Banner.gif]
NEW ALBUM OUT NOW!

Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Quickie Battler Animation DerVVulfman 0 283 08-26-2024, 10:16 PM
Last Post: DerVVulfman
   Aleworks Input Mouse Sprite Add-On DerVVulfman 2 1,794 09-21-2023, 02:56 PM
Last Post: DerVVulfman
   Battler : Dead When SP 0 Kain Nobel 0 4,854 06-03-2016, 10:11 AM
Last Post: Kain Nobel
   Modify Battler Collapse Effect PK8 2 11,117 04-03-2012, 03:04 AM
Last Post: PK8
   Sprite Shadow Rataime 0 5,485 03-02-2008, 08:03 AM
Last Post: Rataime
   Sprite Reflection Rataime 0 5,923 03-02-2008, 08:02 AM
Last Post: Rataime
   Sprite Mirror Rataime 0 4,971 03-02-2008, 08:01 AM
Last Post: Rataime
   Sprite Sun Rataime 0 4,898 03-02-2008, 07:57 AM
Last Post: Rataime



Users browsing this thread: 1 Guest(s)