Simple Player Idle Sprites
Authors: winkio
Version: 1.0
Type: Animation System
Key Term: Environment Add-on
IntroductionThis script was created from a simple request to have idle animations for player characters in this thread:
https://forum.chaos-project.com/index.php/topic,2653.0.htmlThere are many scripts out there that have more fully featured implementations of idle sprites, but this one is intended to be minimalistic - just a single idle sprite per character.
Script#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# With idle sprites. name the idle sprites the same as their normal ones
# except with '_idl' on the end (before the extension)
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :character_name_org # original character file name
attr_reader :current_sprite # current sprite suffix
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_idlesprites_before initialize
def initialize
initialize_idlesprites_before
# set original character name
@character_name_org = @character_name
# set current sprite
@current_sprite = ""
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias update_idlesprites_before update
def update
update_idlesprites_before
update_idlesprites
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias refresh_idlesprites_before refresh
def refresh
refresh_idlesprites_before
update_idlesprites
end
#--------------------------------------------------------------------------
# * update_idlesprites
# Updates idle sprites of the player
#--------------------------------------------------------------------------
def update_idlesprites
if @character_name != ""
if moving?
if @current_sprite != ''
@step_anime = false
@character_name = @character_name_org
@current_sprite = ''
end
elsif Input.dir4 == 0
if @current_sprite != '_idl'
@character_name_org = @character_name
@step_anime = true
@character_name += '_idl'
@current_sprite = '_idl'
end
end
end
end
end
SIMPLE CATERPILLAR IDLE SPRITES (FOR USE WITH TONS OF ADDONS): ShowHide #==============================================================================
# ** Game_Member
#------------------------------------------------------------------------------
# With idle sprites. name the idle sprites the same as their normal ones
# except with '_idl' on the end (before the extension)
#==============================================================================
class Game_Member < Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :character_name_org # original character file name
attr_reader :current_sprite # current sprite suffix
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_idlesprites_before initialize
def initialize(index)
initialize_idlesprites_before(index)
# set original character name
@character_name_org = @character_name
# set current sprite
@current_sprite = ""
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias update_idlesprites_before update
def update
update_idlesprites_before
update_idlesprites
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias refresh_idlesprites_before refresh
def refresh
refresh_idlesprites_before
update_idlesprites
end
#--------------------------------------------------------------------------
# * update_idlesprites
# Updates idle sprites of the party member in the caterpillar
#--------------------------------------------------------------------------
def update_idlesprites
if @character_name != ""
if moving?
if @current_sprite != ''
@step_anime = false
@character_name = @character_name_org
@current_sprite = ''
end
elsif Input.dir4 == 0 && @buffer.size <= @index && @force_movement <= 0
if @current_sprite != '_idl' || @character_name[-4, 4] != @current_sprite
@character_name_org = @character_name
@step_anime = true
@character_name += '_idl'
@current_sprite = '_idl'
end
end
end
end
end
InstructionsPlace the Simple Player Idle Sprites script below the default scripts, above main, and above any other custom scripts you may be using.
If you are using the Tons of Addons script and want caterpillar heroes to have idle sprites as well, you must also place the Simple Caterpillar Idle Sprites script below Tons of Addons.
Idle sprites should be named after the original sprite with '_idl' at the end, for example if your player sprite is named 'MainGuy.png', then the idle sprite should be named 'MainGuy_idl.png'
CompatibilityMade compatible with Tons of Add-ons, including when Caterpillar option is turned on.
May not be compatible with larger scripts and ABS battle systems.