мЭkяΘÐ ツSáb Sep 22, 2012 9:03 pm
Usuario Nv10
Hola¡¡¡¡ bien este nuevo script q les traego esta interesante es para mostrar una animacion al personaje cuando este esta en inactividad.
IMAGEN:
SCRIPT:
- Galv
IMAGEN:
SCRIPT:
- Spoiler:
- Código:
#------------------------------------------------------------------------------#
# Galv's Character Animations
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.4
#------------------------------------------------------------------------------#
# 2012-09-21 - Version 1.4 - Optimised the code significantly (to my ability)
# - Some bug fixes
# 2012-09-21 - Version 1.3 - Added ability to repeat common event
# - Added follower animations
# 2012-09-20 - Version 1.2 - fixed compatibility with Galv's Region Effects
# 2012-09-20 - Version 1.1 - added idle common event, removed unnecessary code
# 2012-09-20 - Version 1.0 - release
#------------------------------------------------------------------------------#
# Designed to give actors additional animations such as:
# - Idle
# - Walking
# - Dashing
# - Custom (run a common event if you've been idle for a period of time)
#
# INSTRUCTIONS:
# 1. Copy this script below materials and above main
# 2. Create your charset files with extensions (see setup options)
# by default these are:
# - "Actor1.png" for idle
# - "Actor1_walk.png" for walking
# - "Actor1_dash.png" for dashing
# Make sure the actor's sprites are in the same position in each charset.
# (you can have 8 actors in each spritesheet)
#
#------------------------------------------------------------------------------#
#
# KNOWN ISSUES:
# - Move Route Change graphic commands only work when the switch is on.
# Then if you turn it off again, the graphic changes back to the original.
# Use "Set Actor Graphic" event command to change instead.
#
#------------------------------------------------------------------------------#
# !!!!! WARNING - I am a learning scripter. Use this at your own risk!!!!!!
#------------------------------------------------------------------------------#
$imported = {} if $imported.nil?
$imported["Chara_Anims"] = true
module Chara_Anims
#------------------------------------------------------------------------------#
# SETUP OPTIONS
#------------------------------------------------------------------------------#
WALK_EXTENSION = "_walk" # appends to end of file names to determine
# the walking charsets.
DASH_EXTENSION = "_dash" # appends to end of dashing charset filename
# Make it the same as walk extension to disable
PAUSE = 5 # frames before idle animation starts
# (60 frames per second). I was planning something
# with this but you shouldn't change it for now.
ANIM_SWITCH = 1 # ID of a switch to disable this effect.
# Turn switch ON in order to use change graphic
# move route commands. Turn off to restore anims.
STEP_ANIMATION = true # If "Stepping" is on or off by default.
# Can be true or false.
COMMON_EVENT = 1 # Common event ID that plays after a certain time
COMMON_EVENT_TIME = 200 # Frames idle before common event called.
REPEAT_EVENT = false # Repeat this common event if player remains idle?
# (restarts the common event time) true or false.
#------------------------------------------------------------------------------#
# END SETUP OPTIONS
#------------------------------------------------------------------------------#
end # Chara_Anims
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# * Initialize the sprites
#--------------------------------------------------------------------------
alias galv_initialize initialize
def initialize(viewport, character = nil)
#party_size = $game_party.battle_members.size
@idletime = 0
galv_initialize(viewport, character)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias galv_update update
def update
galv_update
if $game_switches[Chara_Anims::ANIM_SWITCH] == false
move_anim if $game_player.moving?
@idletime = @idletime + 1
idle_anim if @idletime == Chara_Anims::PAUSE
idle_event if @idletime == Chara_Anims::COMMON_EVENT_TIME
end
end
#--------------------------------------------------------------------------
# * Def idle, walk, dash and actor
#--------------------------------------------------------------------------
def actor
$game_party.battle_members
end
def party_size
$game_party.battle_members.size
end
#--------------------------------------------------------------------------
# * Activate Idle Animation
#--------------------------------------------------------------------------
def idle_anim
party_size.times {|i|
default = actor[i].character_name.chomp(Chara_Anims::DASH_EXTENSION)
actor[i].set_graphic(default.chomp(Chara_Anims::WALK_EXTENSION), actor[i].character_index, actor[i].face_name, actor[i].face_index)
i = i + 1
}
$game_player.refresh
@idletime = @idletime + 1
end
#--------------------------------------------------------------------------
# * Activate Moving Animation
#--------------------------------------------------------------------------
def move_anim
party_size.times {|i|
if !actor[i].character_name.include?(Chara_Anims::WALK_EXTENSION) && $game_player.dash? == false
actor[i].set_graphic(actor[i].character_name.chomp(Chara_Anims::DASH_EXTENSION) + Chara_Anims::WALK_EXTENSION, actor[i].character_index, actor[i].face_name, actor[i].face_index)
end
if !actor[i].character_name.include?(Chara_Anims::DASH_EXTENSION) && $game_player.dash? == true
actor[i].set_graphic(actor[i].character_name.chomp(Chara_Anims::WALK_EXTENSION) + Chara_Anims::DASH_EXTENSION, actor[i].character_index, actor[i].face_name, actor[i].face_index)
end
i = i + 1
}
$game_player.refresh
@idletime = 0
end
#--------------------------------------------------------------------------
# * Activate Idle Common Event
#--------------------------------------------------------------------------
def idle_event
$game_temp.reserve_common_event(Chara_Anims::COMMON_EVENT)
@idletime = 0 if Chara_Anims::REPEAT_EVENT == true
end
end # Sprite_Character < Sprite_Base
class Game_CharacterBase
#--------------------------------------------------------------------------
# * Initialize Public Member Variables
#--------------------------------------------------------------------------
alias galv_init_public_members init_public_members
def init_public_members
galv_init_public_members
@step_anime = Chara_Anims::STEP_ANIMATION
end
end # Game_CharacterBase
- Galv