!!

Welcome to Save Point!

Formerly known as RMVXP, Save-Point is a game creational forum that aids users in creating games using software like RPG Maker or Game Maker. Support is also available today for members and members can also upload and download resources and scripts to use in their games. If you are new or experienced we welcome you to register.

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[XP Script] Battler Sprite Addons
Kain Nobel Offline
Senior Member

****
Posts: 317
Joined: May 2009
View My Download Submissions
Thanks: 0
Given 5 thank(s) in 26 post(s)

Save Points: 9,200sp
Items: (View All Items)
Awards:

Gender: Male
Favorite Maker: RPG Maker XP
Post: #1
Battler Sprite Addons

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)
09-17-2009 12:42 PM
Find all posts by this user Quote this message in a reply
Post Reply 


User(s) browsing this thread:
1 Guest(s)


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
   Modify Battler Collapse Effect PK8 2 1,152 04-03-2012 03:04 AM
Last Post: PK8
   Battler State Graphics DerVVulfman 1 1,241 05-05-2010 08:16 AM
Last Post: zubin73
   Actor Battler Graphics DerVVulfman 2 2,157 10-03-2009 06:15 PM
Last Post: Yin
   Sprite Mover woratana 0 580 01-22-2009 01:19 PM
Last Post: woratana
   Sprite Sun syvkal 0 685 03-08-2008 04:36 AM
Last Post: syvkal
   Sprite Shadow syvkal 0 812 03-08-2008 04:31 AM
Last Post: syvkal
   8-Directional Movement with Sprite Support Kylock 0 1,352 03-07-2008 07:06 PM
Last Post: Kylock
   Sprite Shadow Rataime 0 714 03-02-2008 08:03 AM
Last Post: Rataime
   Sprite Reflection Rataime 0 1,049 03-02-2008 08:02 AM
Last Post: Rataime
   Sprite Mirror Rataime 0 776 03-02-2008 08:01 AM
Last Post: Rataime



 Quick Theme: