01-20-2010, 01:44 AM
Found an old script by Yeyinde floating around my hard drive:
Enjoy
Code:
#==============================================================================
# ** Miniscript: Character Animation
#------------------------------------------------------------------------------
# By Yeyinde (August 14, 2006)
# This is just a little script that changes the way a characterset animations
# plays. It makes the first frame an 'idle pose', and uses the next three
# frames as the animation (Much like in RM2K).
#
# Insert the code above Main:
#
#==============================================================================
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
alias old_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
old_initialize
@pattern_count = 0
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Branch with jumping, moving, and stopping
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
# If animation count exceeds maximum value
# * Maximum value is move speed * 1 taken from basic value 18
if @anime_count > 18 - @move_speed * 2
# If stop animation is OFF when stopping
if not @step_anime and @stop_count > 0
# Return to original pattern
@pattern = @original_pattern
@pattern_count = 0
# If stop animation is ON when moving
else
# Update pattern
@pattern_count = (@pattern_count + 1) % 4
case @pattern_count
when 0
@pattern = 2
when 1
@pattern = 1
when 2
@pattern = 2
when 3
@pattern = 3
end
end
# Clear animation count
@anime_count = 0
end
# If waiting
if @wait_count > 0
# Reduce wait count
@wait_count -= 1
return
end
# If move route is forced
if @move_route_forcing
# Custom move
move_type_custom
return
end
# When waiting for event execution or locked
if @starting or lock?
# Not moving by self
return
end
# If stop count exceeds a certain value (computed from move frequency)
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
# Branch by move type
case @move_type
when 1 # Random
move_type_random
when 2 # Approach
move_type_toward_player
when 3 # Custom
move_type_custom
end
end
end
end
Enjoy