#==============================================================================# # ? Yanfly Engine Ace - Input Combo Skills v1.01# -- Last Updated: 2011.12.26# -- Level: Hard# -- Requires: n/a# #==============================================================================$imported = {} if $imported.nil?$imported["YEA-InputComboSkills"] = true#==============================================================================# ? Updates# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# 2011.12.26 - Bug Fix: Crash when no action is performed.# 2011.12.22 - Started Script and Finished.# #==============================================================================# ? Introduction# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script enables the usage of Input Combo Skills. When an Input Combo# Skill is activated by an actor, a list of the potential input attacks appears# on the side of the screen. The player then presses the various buttons listed# in the window and attacks will occur in a combo fashion. If a particular# attack combination is met, a special attack will occur.# #==============================================================================# ? Instructions# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# To install this script, open up your script editor and copy/paste this script# to an open slot below ? Materials/?? but above ? Main. Remember to save.# # -----------------------------------------------------------------------------# Skill Notetags - These notetags go in the skill notebox in the database.# -----------------------------------------------------------------------------# <combo skill L: x># <combo skill R: x># <combo skill X: x># <combo skill Y: x># <combo skill Z: x># Makes the skill with these notetags to become potentially comboable. Replace# x with the ID of the skill you want the button to cause the skill to combo.# The combo skill will be usable even if the user has not learned the skill.# However, if the user is unable to use the skill due to a lack of resources,# then the skill will be greyed out. The skill can be inputted, but if the user# lacks the resources, it will not perform and the skill combo will break.# # <combo max: x># Sets the maximum number of inputs the player can use for this skill. If this# tag is not present, it will use the default number of maximum inputs that's# pre-defined by the module.# # <combo special string: x># If the player inputs a sequence that matches the string (any combination of# L, R, X, Y, Z), then the special skill x will be performed. If a combination# is met, then the combo chain will end prematurely even if there are more# inputs left. If the user does not know skill x, then the special combo skill# x will not be performed.# # <combo only># This makes a skill only usable in a combo and cannot be directly used from a# skill menu. This effect does not affect monsters. Combo skills will still be# unusable if the user does not meet the skill's other requirements (such as a# lack of MP or TP).# #==============================================================================# ? Compatibility# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that# it will run with RPG Maker VX without adjusting.# # While this script doesn't interfere with Active Chain Skills, it will most# likely be unable to used in conjunction with Active Chain Skills. I will not# provide support for any errors that may occur from this, nor will I be# responsible for any damage doing this may cause your game.# #==============================================================================module YEA module INPUT_COMBO #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Combo Skill Settings - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # These settings adjust the sound effect played when a skill is selected, # what the minimum time windows are. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # This will be the sound effect played whenever an active combo skill has # been selected for comboing. INPUT_COMBO_SOUND = RPG::SE.new("F1_MissedCall", 80, 100) # This will be the sound effect played when an input combo matches and # activates a specialized combo. ACHIEVED_COMBO_SOUND = RPG::SE.new("F1_New_MMS", 90, 100) # How many frames minimum for combo allowance. Sometimes the battlelog # window will move too fast for the player to be able to combo. This sets # a minimum timer for how long the combo window will stay open. MINIMUM_TIME = 120 # This is the bonus number of frames of leeway that the player gets for # a larger input sequence. This is because the battlelog window may move # too fast for the player to be able to combo. This adds to the minimum # timer for how long the combo window will stay open. TIME_PER_INPUT = 90 # This sets the default number of inputs that a combo skill can have at # maximum. If you wish to exceed this amount or to have lower than this # amount, use a notetag to change the skill's max combo amount. DEFAULT_MAX_INPUT = 9 # This will be the "Window" colour used for a special skill in the display. SPECIAL_SKILL_COLOUR = 17 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # - Combo Skill Text - #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # This section adjusts the text that appears for the combo skills. Adjust # the text to appear as you see fit. Note that the vocab other than the # title can use text codes. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- COMBO_TITLE = "Input Combo Attacks" TITLE_SIZE = 16 L_SKILL_ON = "\eC[17]Q\eC[0]: " L_SKILL_OFF = "\eC[7]Q: " R_SKILL_ON = "\eC[17]W\eC[0]: " R_SKILL_OFF = "\eC[7]W: " X_SKILL_ON = "\eC[17]A\eC[0]: " X_SKILL_OFF = "\eC[7]A: " Y_SKILL_ON = "\eC[17]S\eC[0]: " Y_SKILL_OFF = "\eC[7]S: " Z_SKILL_ON = "\eC[17]D\eC[0]: " Z_SKILL_OFF = "\eC[7]D: " B_SKILL_ON = "\eC[17]ESC\eC[0]: " B_SKILL_OFF = "\eC[7]ESC: " end # INPUT_COMBOend # YEA#==============================================================================# ? Editting anything past this point may potentially result in causing# computer damage, incontinence, explosion of user's head, coma, death, and/or# halitosis so edit at your own risk.#==============================================================================module YEA module REGEXP module SKILL COMBO_MAX = /<(?:COMBO_MAX|combo max):[ ](\d+)>/i COMBO_ONLY = /<(?:COMBO_ONLY|combo only)>/i COMBO_SKILL = /<(?:COMBO_SKILL|combo skill)[ ]([LRXYZ]):[ ](\d+)>/i COMBO_SPECIAL = /<(?:COMBO_SPECIAL|combo special)[ ](.*):[ ](\d+)>/i end # SKILL end # REGEXPend # YEA#==============================================================================# ¦ DataManager#==============================================================================module DataManager #-------------------------------------------------------------------------- # alias method: load_database #-------------------------------------------------------------------------- class <<self; alias load_database_ics load_database; end def self.load_database load_database_ics load_notetags_ics end #-------------------------------------------------------------------------- # new method: load_notetags_ics #-------------------------------------------------------------------------- def self.load_notetags_ics for skill in $data_skills next if skill.nil? skill.load_notetags_ics end end end # DataManager#==============================================================================# ¦ RPG::Skill#==============================================================================class RPG::Skill < RPG::UsableItem #-------------------------------------------------------------------------- # public instance variables #-------------------------------------------------------------------------- attr_accessor :combo_only attr_accessor :combo_skill attr_accessor :combo_max attr_accessor :combo_special #-------------------------------------------------------------------------- # common cache: load_notetags_ics #-------------------------------------------------------------------------- def load_notetags_ics @combo_only = false @combo_skill = {} @combo_special = {} @combo_max = YEA::INPUT_COMBO::DEFAULT_MAX_INPUT #--- self.note.split(/[\r\n]+/).each { |line| case line #--- when YEA::REGEXP::SKILL::COMBO_ONLY @combo_only = true when YEA::REGEXP::SKILL::COMBO_SKILL case $1.upcase when "L"; @combo_skill[:L] = $2.to_i when "R"; @combo_skill[:R] = $2.to_i when "X"; @combo_skill[:X] = $2.to_i when "Y"; @combo_skill[:Y] = $2.to_i when "Z"; @combo_skill[:Z] = $2.to_i when "B"; @combo_skill[:B] = $2.to_i else; next end when YEA::REGEXP::SKILL::COMBO_MAX @combo_max = $1.to_i when YEA::REGEXP::SKILL::COMBO_SPECIAL @combo_special[$1.to_s.upcase] = $2.to_i #--- end } # self.note.split #--- end end # RPG::UsableItem#==============================================================================# ¦ Game_Action#==============================================================================class Game_Action #-------------------------------------------------------------------------- # new method: set_input_combo_skill #-------------------------------------------------------------------------- def set_input_combo_skill(skill_id) set_skill(skill_id) @target_index = subject.current_action.target_index @input_combo_skill = true end #-------------------------------------------------------------------------- # alias method: valid? #-------------------------------------------------------------------------- alias game_action_valid_ics valid? def valid? subject.enable_input_combo(true) if @input_combo_skill result = game_action_valid_ics subject.enable_input_combo(false) if @input_combo_skill return result end end # Game_Action#==============================================================================# ¦ Game_BattlerBase#==============================================================================class Game_BattlerBase #-------------------------------------------------------------------------- # alias method: skill_conditions_met? #-------------------------------------------------------------------------- alias game_battlerbase_skill_conditions_met_ics skill_conditions_met? def skill_conditions_met?(skill) return false if combo_skill_restriction?(skill) return game_battlerbase_skill_conditions_met_ics(skill) end #-------------------------------------------------------------------------- # new method: combo_skill_restriction? #-------------------------------------------------------------------------- def combo_skill_restriction?(skill) return false unless actor? return false unless $game_party.in_battle return false unless skill.combo_only return !@input_combo_enabled end #-------------------------------------------------------------------------- # alias method: hp= #-------------------------------------------------------------------------- alias game_battlerbase_hpequals_ics hp= def hp=(value) game_battlerbase_hpequals_ics(value) return unless SceneManager.scene_is?(Scene_Battle) return unless actor? return if value == 0 SceneManager.scene.refresh_input_combo_skill_window(self) end #-------------------------------------------------------------------------- # alias method: mp= #-------------------------------------------------------------------------- alias game_battlerbase_mpequals_ics mp= def mp=(value) game_battlerbase_mpequals_ics(value) return unless SceneManager.scene_is?(Scene_Battle) return unless actor? return if value == 0 SceneManager.scene.refresh_input_combo_skill_window(self) end #-------------------------------------------------------------------------- # alias method: tp= #-------------------------------------------------------------------------- alias game_battlerbase_tpequals_ics tp= def tp=(value) game_battlerbase_tpequals_ics(value) return unless SceneManager.scene_is?(Scene_Battle) return unless actor? return if value == 0 SceneManager.scene.refresh_input_combo_skill_window(self) end end # Game_BattlerBase#==============================================================================# ¦ Game_Battler#==============================================================================class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # alias method: on_battle_start #-------------------------------------------------------------------------- alias game_battler_on_battle_start_ics on_battle_start def on_battle_start game_battler_on_battle_start_ics @input_combo_enabled = false end #-------------------------------------------------------------------------- # alias method: on_battle_end #-------------------------------------------------------------------------- alias game_battler_on_battle_end_ics on_battle_end def on_battle_end game_battler_on_battle_end_ics @input_combo_enabled = false end #-------------------------------------------------------------------------- # new method: enable_input_combo #-------------------------------------------------------------------------- def enable_input_combo(active) return unless actor? @input_combo_enabled = active end end # Game_Battler#==============================================================================# ¦ Window_ComboSkillList#==============================================================================class Window_ComboSkillList < Window_Base #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize dw = [Graphics.width/2, 320].max super(0,0, dw, fitting_height(7)) self.z = 200 self.opacity = 0 hide end #-------------------------------------------------------------------------- # reveal #-------------------------------------------------------------------------- def reveal(battler, skill) @battler = battler @skill = skill @combo_skills = [] for key in skill.combo_skill next if key[1].nil? next if $data_skills[key[1]].nil? @combo_skills.push($data_skills[key[1]]) end return if @combo_skills == [] self.y = Graphics.height - fitting_height(4) self.y -= (fitting_height(@combo_skills.size + 2)) + 146 show activate refresh end #-------------------------------------------------------------------------- # refresh_check #-------------------------------------------------------------------------- def refresh_check(battler) return if @battler != battler refresh end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh contents.clear#~ draw_background_colour#~ draw_horz_line(0) draw_combo_title#~ draw_horz_line(@combo_skills.size * line_height) draw_combo_skills end #~ #--------------------------------------------------------------------------#~ # draw_background_colour#~ #--------------------------------------------------------------------------#~ def draw_background_colour#~ dh = line_height * (@combo_skills.size + 2)#~ rect = Rect.new(0, 0, contents.width, dh)#~ back_colour1 = Color.new(0, 0, 0, 192)#~ back_colour2 = Color.new(0, 0, 0, 0)#~ contents.gradient_fill_rect(rect, back_colour1, back_colour2)#~ end#~ #~ #--------------------------------------------------------------------------#~ # draw_horz_line#~ #--------------------------------------------------------------------------#~ def draw_horz_line(dy)#~ line_y = dy + line_height - 2#~ line_colour = normal_color#~ line_colour.alpha = 48#~ contents.fill_rect(0, line_y, contents.width, 2, line_colour)#~ end #-------------------------------------------------------------------------- # draw_combo_title #-------------------------------------------------------------------------- def draw_combo_title reset_font_settings text = YEA::INPUT_COMBO::COMBO_TITLE contents.font.size = YEA::INPUT_COMBO::TITLE_SIZE contents.font.bold = true contents.font.italic = true draw_text(12, 0, contents.width - 12, line_height, text) reset_font_settings end #-------------------------------------------------------------------------- # draw_combo_skills #-------------------------------------------------------------------------- def draw_combo_skills button_array = [:L, :R, :X, :Y, :Z, :B,] dx = 24 dy = line_height for button in button_array next if @skill.combo_skill[button].nil? combo_skill = $data_skills[@skill.combo_skill[button]] text = text_setting(button, combo_skill) text += sprintf("\eI[%d]", combo_skill.icon_index) text += combo_skill.name draw_text_ex(dx, dy, text) dy += line_height end end #-------------------------------------------------------------------------- # text_setting #-------------------------------------------------------------------------- def text_setting(button, skill) text = "" case button when :L if @battler.usable?(skill) text = YEA::INPUT_COMBO::L_SKILL_ON else text = YEA::INPUT_COMBO::L_SKILL_OFF end when :R if @battler.usable?(skill) text = YEA::INPUT_COMBO::R_SKILL_ON else text = YEA::INPUT_COMBO::R_SKILL_OFF end when :X if @battler.usable?(skill) text = YEA::INPUT_COMBO::X_SKILL_ON else text = YEA::INPUT_COMBO::X_SKILL_OFF end when :Y if @battler.usable?(skill) text = YEA::INPUT_COMBO::Y_SKILL_ON else text = YEA::INPUT_COMBO::Y_SKILL_OFF end when :Z if @battler.usable?(skill) text = YEA::INPUT_COMBO::Z_SKILL_ON else text = YEA::INPUT_COMBO::Z_SKILL_OFF end end return text end end # Window_ComboSkillList#==============================================================================# ¦ Window_ComboInfo#==============================================================================class Window_ComboInfo < Window_Base #-------------------------------------------------------------------------- # initialize #-------------------------------------------------------------------------- def initialize super(212, 0, Graphics.width, fitting_height(1)) self.y = (Graphics.height - fitting_height(4) - fitting_height(1)) + 28 self.opacity = 0 self.z = 200 @combos = [] @special = nil hide end #-------------------------------------------------------------------------- # reveal #-------------------------------------------------------------------------- def reveal @combos = [] @special = nil refresh show end #-------------------------------------------------------------------------- # refresh #-------------------------------------------------------------------------- def refresh contents.clear dx = draw_combo_icons draw_special(dx) end #-------------------------------------------------------------------------- # add_combo #-------------------------------------------------------------------------- def add_combo(icon, special = nil) @combos.push(icon) @special = special refresh end #-------------------------------------------------------------------------- # draw_combo_icons #-------------------------------------------------------------------------- def draw_combo_icons dx = 0 for icon in @combos draw_icon(icon, dx, 0) dx += 24 end return dx end #-------------------------------------------------------------------------- # draw_special #-------------------------------------------------------------------------- def draw_special(dx) return if @special.nil? draw_icon(@special.icon_index, dx + 12, 0) colour = text_color(YEA::INPUT_COMBO::SPECIAL_SKILL_COLOUR) change_color(colour) draw_text(dx + 36, 0, contents.width, line_height, @special.name) end end # Window_ComboInfo#==============================================================================# ¦ Scene_Battle#==============================================================================class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # alias method: create_all_windows #-------------------------------------------------------------------------- alias scene_battle_create_all_windows_ics create_all_windows def create_all_windows scene_battle_create_all_windows_ics create_combo_skill_window end #-------------------------------------------------------------------------- # new method: create_combo_skill_window #-------------------------------------------------------------------------- def create_combo_skill_window @input_combo_skill_window = Window_ComboSkillList.new @input_combo_info_window = Window_ComboInfo.new @input_combo_skill_counter = 0 end #-------------------------------------------------------------------------- # alias method: use_item #-------------------------------------------------------------------------- alias scene_battle_use_item_ics use_item def use_item @subject.enable_input_combo(true) item = @subject.current_action.item combo_skill_list_appear(true, item) start_input_combo_skill_counter(item) scene_battle_use_item_ics loop do break if break_input_combo?(item) update_basic update_combo_skill_queue end combo_skill_list_appear(false, item) @subject.enable_input_combo(false) end #-------------------------------------------------------------------------- # new method: combo_skill_list_appear #-------------------------------------------------------------------------- def combo_skill_list_appear(visible, skill) return if @subject.nil? return unless @subject.actor? return unless skill.is_a?(RPG::Skill) return if visible && @input_combo_skill_window.visible if visible $combo_window_open = true @break_combo = false @current_combo_skill = skill @total_combo_skills = 0 @combo_skill_queue = [] @combo_skill_string = "" @input_combo_skill_window.reveal(@subject, skill) @input_combo_info_window.reveal else $combo_window_open = false @input_combo_skill_window.hide @input_combo_info_window.hide return if @subject.current_action.nil? @subject.current_action.set_skill(@current_combo_skill.id) end end #-------------------------------------------------------------------------- # new method: refresh_input_combo_skill_window #-------------------------------------------------------------------------- def refresh_input_combo_skill_window(battler) return unless @input_combo_skill_window.visible @input_combo_skill_window.refresh_check(battler) end #-------------------------------------------------------------------------- # new method: start_input_combo_skill_counter #-------------------------------------------------------------------------- def start_input_combo_skill_counter(skill) return unless @input_combo_skill_window.visible @input_combo_skill_counter = YEA::INPUT_COMBO::MINIMUM_TIME bonus_time = skill.combo_max * YEA::INPUT_COMBO::TIME_PER_INPUT @input_combo_skill_counter += bonus_time end #-------------------------------------------------------------------------- # new method: break_input_combo? #-------------------------------------------------------------------------- def break_input_combo?(item) return true if @break_combo return true if @current_combo_skill.nil? return true if @current_combo_skill.combo_skill == {} return false if @combo_skill_queue != [] return true if @total_combo_skills == @current_combo_skill.combo_max return @input_combo_skill_counter <= 0 end #-------------------------------------------------------------------------- # new method: update_combo_skill_queue #-------------------------------------------------------------------------- def update_combo_skill_queue return if @combo_skill_queue == [] action = @combo_skill_queue.shift if !@subject.usable?(action) @break_combo = true return end @subject.current_action.set_input_combo_skill(action.id) @log_window.clear execute_action end #-------------------------------------------------------------------------- # alias method: update_basic #-------------------------------------------------------------------------- alias scene_battle_update_basic_ics update_basic def update_basic scene_battle_update_basic_ics update_input_combo_skill_counter update_input_combo_skill_select end #-------------------------------------------------------------------------- # new method: update_input_combo_skill_counter #-------------------------------------------------------------------------- def update_input_combo_skill_counter return if @input_combo_skill_counter == 0 @input_combo_skill_counter -= 1 end #-------------------------------------------------------------------------- # new method: update_input_combo_skill_select #-------------------------------------------------------------------------- def update_input_combo_skill_select return unless @input_combo_skill_window.visible return if @total_combo_skills >= @current_combo_skill.combo_max if Input.trigger?(:L) check_input_combo_skill(:L) elsif Input.trigger?(:R) check_input_combo_skill(:R) elsif Input.trigger?(:X) check_input_combo_skill(:X) elsif Input.trigger?(:Y) check_input_combo_skill(:Y) elsif Input.trigger?(:Z) check_input_combo_skill(:Z) elsif Input.trigger?(: @break_combo = true end end #-------------------------------------------------------------------------- # new method: check_input_combo_skill #-------------------------------------------------------------------------- def check_input_combo_skill(button) skill_id = @current_combo_skill.combo_skill[button] return if skill_id.nil? return if $data_skills[skill_id].nil? case button when :L; @combo_skill_string += "L" when :R; @combo_skill_string += "R" when :X; @combo_skill_string += "X" when :Y; @combo_skill_string += "Y" when :Z; @combo_skill_string += "Z" when :B; @combo_skill_string += "B" end if special_input_combo? $jatk = false $advance_2 = true icon = $data_skills[skill_id].icon_index @combo_skill_queue.push($data_skills[skill_id]) skill_id = @current_combo_skill.combo_special[@combo_skill_string] combo_skill = $data_skills[skill_id] @input_combo_info_window.add_combo(icon, combo_skill) YEA::INPUT_COMBO::ACHIEVED_COMBO_SOUND.play @total_combo_skills = @current_combo_skill.combo_max $advance_2 = false else $advance_2 = true YEA::INPUT_COMBO::INPUT_COMBO_SOUND.play combo_skill = $data_skills[skill_id] @input_combo_info_window.add_combo(combo_skill.icon_index) @total_combo_skills += 1 $advance_2 = false end @combo_skill_queue.push(combo_skill) return unless @total_combo_skills == @current_combo_skill.combo_max @input_combo_skill_counter = 0 $jatk_check = false end #-------------------------------------------------------------------------- # new method: special_input_combo? #-------------------------------------------------------------------------- def special_input_combo? combo_hash = @current_combo_skill.combo_special return false unless combo_hash.include?(@combo_skill_string) skill = $data_skills[combo_hash[@combo_skill_string]] return @subject.skills.include?(skill) end end # Scene_Battle#==============================================================================# # ? End of File# #==============================================================================
#------------------------------------------------------------------------------## Galv's Animated Battlers#------------------------------------------------------------------------------## For: RPGMAKER VX ACE# Version 1.1#------------------------------------------------------------------------------## 2013-05-06 - Version 1.1 - added move speed for melee attacks# 2013-05-04 - Version 1.0 - release#------------------------------------------------------------------------------## This is just another animated battler script that uses holder-style animated# battler sheets. There are better ones out there, this one is just my basic# implementation in an attempt to continue improving my scripting.## Holder's animated battler spritesheets can be found here:# [URL="http://animatedbattlers.wordpress.com/#%23"]http://animatedbattlers.wordpress.com/##[/URL] This script works in the default battle system but is optimised for use with# Yanfly's battle script. Not tested with other battle scripts. Put this script# below any battle scripts you try it with.#------------------------------------------------------------------------------# #------------------------------------------------------------------------------## Note tag for ENEMIES and ACTORS#------------------------------------------------------------------------------### <battler: filename> # filename is the animated spritesheet located in# # /Graphics/Battlers/# # Required for actors, optional for enemies.## <stationary_sub> # will not re-position themselves in front of an ally# # they are covering/substituting for.##------------------------------------------------------------------------------# #------------------------------------------------------------------------------## Note tags for SKILLS, ITEMS and STATES#------------------------------------------------------------------------------### <pose: x> # The skill, item or state will use x pose row.# # If a skill does not have this tag, it will use row 6.# # If an item does not have this tag, it will use row 5.# # If a state does not have this tag, it will use row 2. If a# # battler has multiple states, it uses the highest priority.##------------------------------------------------------------------------------# #------------------------------------------------------------------------------## Note tag for SKILLS, ITEMS and ACTORS#------------------------------------------------------------------------------### <melee: x> # Normal attacks for Actors, items being used or skills being# # used that have this tag will make the actor dash into close# # range before doing the action. x is the dash speed.# # 0 = instant. 1 is slow, higher numbers is faster##------------------------------------------------------------------------------# #------------------------------------------------------------------------------## SCRIPT CALLS#------------------------------------------------------------------------------### change_battler(id,"filename") # Changes actor's animated battler sheet.##------------------------------------------------------------------------------# ($imported ||= {})["Galv_Animated_Battlers"] = truemodule GALV_BAT #-------------------------------------------------------------------------------## * SETTINGS##------------------------------------------------------------------------------- COLS = 8 # How many columns your animated spritesheet uses ROWS = 14 # How many rows your animated spritesheet uses ENEMY_FLIP = false # true = flip enemy battler image horizontally ACTOR_FLIP = false # true = flip actor battler image horizonatally HP_CRISIS = 0.25 # Remaining hp before poor status pose (0.25 = 25%) ONE_ANIM = [3,4,5,6,12] # Poses that will NOT keep repeating their frames XOFFSET = 95 # horizonatal distance from opponent when using <melee: x> YOFFSET = 15 # vertical distance from opponent when using <melee: x> SXOFFSET = 40 # horizontal distance from ally when substituting SYOFFSET = 0 # vertical distance from ally when substituting #------------------------------------------------------------------------------# ACTOR_POSITIONS = [ # don't touch#------------------------------------------------------------------------------## Set x,y locations of your actors on the battle screen#------------------------------------------------------------------------------# [440,340], # Party member 1 [x,y] [470,355], # Party member 2 [x,y] [450,320], # Party member 3 [x,y] [480,310], # Party member 4 [x,y] #------------------------------------------------------------------------------# ] #don't touch#------------------------------------------------------------------------------# #-------------------------------------------------------------------------------# POSES USED FOR SPECIAL ACTIONS:#------------------------------------------------------------------------------- COUNTER_ATTACK = 4 # Pose when counter attacking MAGIC_REFLECT = 7 # Pose when reflecting magic EVASION = [9,8] # Move back then move forward poses to evade. #-------------------------------------------------------------------------------# POSE INFORMATION:#------------------------------------------------------------------------------## DEFAULT SPRITESHEET POSES (HOLDER SETUP)#------------------------------------------------------------------------------## ROW POSE ## 0 Idle# 1 Guard# 2 Poor Status# 3 Get hit# 4 Normal Attack# 5 Use Item# 6 Use Skill# 7 Use Magic# 8 Move toward# 9 Move back# 10 Victory# 11 Battle Start# 12 Dead# 13 Spritesheet Info#------------------------------------------------------------------------------# #-------------------------------------------------------------------------------## * END SETTINGS##------------------------------------------------------------------------------- end #------------------------------------------------------------------------------## OVERWRITTEN METHODS#------------------------------------------------------------------------------## class Spriteset_Battle# - create_enemies# - create_actors# - update_actors#------------------------------------------------------------------------------# #----------------------##---| GAME_INTERPRETER |---------------------------------------------------- #----------------------# class Game_Interpreter def change_battler(id,name) $game_actors[id].animated_battler = name endend # Game_Interpreter #-------------------##---| RPG::BASEITEM |------------------------------------------------------- #-------------------# class RPG::BaseItem def pose if @pose.nil? if @note =~ /<pose: (.*)>/i @pose = $1.to_i else @pose = nil end end @pose endend # RPG::BaseItem #----------------------##---| GAME_BATTLERBASE |---------------------------------------------------- #----------------------# class Game_BattlerBase alias galv_animb_gbb_appear appear def appear return if SceneManager.scene_is?(Scene_Map) galv_animb_gbb_appear endend # Game_BattlerBase #------------------##---| GAME_BATTLER |-------------------------------------------------------- #------------------# class Game_Battler < Game_BattlerBase attr_accessor :animated_battler attr_accessor :pose attr_accessor :freeze_pose attr_accessor :bactivated attr_accessor :move_target attr_accessor :orx attr_accessor :ory attr_accessor :reset_pose attr_accessor :move_speed def setup_animated_battler @pose = 0 @move_speed = 0 char = actor? ? actor : enemy @animated_battler = $1 if char.note =~ /<battler:[ ](.*)>/i end def do_pose(col) @reset_pose = true @pose = col @freeze_pose = true if GALV_BAT::ONE_ANIM.include?(@pose) end alias galv_animb_gbgbb_on_turn_end on_turn_end def on_turn_end galv_animb_gbgbb_on_turn_end set_idle_pose end alias galv_animb_gbgbb_on_action_end on_action_end def on_action_end galv_animb_gbgbb_on_action_end set_idle_pose end def set_idle_pose return if !@bactivated if death_state? do_pose(12) elsif guard? do_pose(1) elsif !@states.empty? do_pose(state_pose) elsif low_life? do_pose(2) else do_pose(1) end @freeze_pose = false unless GALV_BAT::ONE_ANIM.include?(@pose) end def low_life? @hp < (mhp * GALV_BAT::HP_CRISIS) end def state_pose prio = 0 prio_state = 0 @states.each { |sid| if $data_states[sid].priority > prio prio_state = sid prio = $data_states[sid].priority end } if prio_state <= 0 || !$data_states[prio_state].pose return 2 else $data_states[prio_state].pose end end alias galv_animb_gbgbb_add_state add_state def add_state(state_id) galv_animb_gbgbb_add_state(state_id) set_idle_pose end alias galv_animb_gbgbb_remove_state remove_state def remove_state(state_id) dead = dead? galv_animb_gbgbb_remove_state(state_id) set_idle_pose if state_id != 1 && !dead? || dead end alias galv_animb_gbgbb_execute_damage execute_damage def execute_damage(user) perform_get_hit if @result.hp_damage > 0 galv_animb_gbgbb_execute_damage(user) if !$imported["YEA-BattleEngine"] SceneManager.scene.wait(15) set_idle_pose end end def perform_get_hit if !dead? && !guard? && $game_party.in_battle && @animated_battler do_pose(3) @sprite_effect_type = :get_hit end end def perform_counter_attack if !dead? && $game_party.in_battle && @animated_battler do_pose(GALV_BAT::COUNTER_ATTACK) @sprite_effect_type = :counter_attack end end def perform_magic_reflect if !dead? && $game_party.in_battle && @animated_battler do_pose(GALV_BAT::MAGIC_REFLECT) @sprite_effect_type = :counter_attack end end def perform_victory if !dead? && @animated_battler do_pose(10) end end def perform_enter_battle @bactivated = true if !dead? && @animated_battler @pose = 11 @sprite_effect_type = :enter_battle end end def perform_dash(dash_type,target) if !dead? && @animated_battler @move_target = target pose = dash_type == :dash_forward ? 8 : 9 do_pose(pose) @sprite_effect_type = dash_type end end def perform_travel(dash_type,target,speed) @move_target = target @move_speed = speed do_pose(8) @sprite_effect_type = dash_type end def moving? @move_speed > 0 end def perform_dodge if !dead? && @animated_battler do_pose(GALV_BAT::EVASION[0]) @sprite_effect_type = :dodge end end alias galv_animb_gbgbb_on_battle_start on_battle_start def on_battle_start perform_enter_battle galv_animb_gbgbb_on_battle_start end def init_animated_battler(i) @sprite_effect_type = :appear @bactivated = false @pose = alive? ? 11 : 12 if actor? @screen_x = GALV_BAT::ACTOR_POSITIONS[i][0] @orx = GALV_BAT::ACTOR_POSITIONS[i][0] @screen_y = GALV_BAT::ACTOR_POSITIONS[i][1] @ory = GALV_BAT::ACTOR_POSITIONS[i][1] else @orx = @screen_x @ory = @screen_y end end def reinit_battler(i) if actor? @screen_x = GALV_BAT::ACTOR_POSITIONS[i][0] @orx = GALV_BAT::ACTOR_POSITIONS[i][0] @screen_y = GALV_BAT::ACTOR_POSITIONS[i][1] @ory = GALV_BAT::ACTOR_POSITIONS[i][1] else @orx = @screen_x @ory = @screen_y end @bactivated = true end alias galv_animb_gbgbb_item_apply item_apply def item_apply(user, item) galv_animb_gbgbb_item_apply(user, item) if @result.evaded perform_dodge end endend # Game_Battler < Game_BattlerBase #----------------##---| GAME_ACTOR |---------------------------------------------------------- #----------------# class Game_Actor < Game_Battler attr_accessor :screen_x attr_accessor :screen_y def screen_x; screen_x = @screen_x; end def screen_y; screen_y = @screen_y; end def screen_z; 100; end alias galv_animb_gagb_initialize initialize def initialize(actor_id) galv_animb_gagb_initialize(actor_id) setup_animated_battler @screen_x = 0 @screen_y = 0 end def sub_pose(target) if !dead? && @animated_battler return if $data_actors[@actor_id].note =~ /<stationary_sub>/i @screen_x = target.screen_x - GALV_BAT::SXOFFSET @screen_y = target.screen_y - GALV_BAT::SYOFFSET @sprite_effect_type = :substitute end end def return_to_position if !dead? && @animated_battler @screen_x = @orx @screen_y = @ory end endend # Game_Actor < Game_Battler #----------------##---| GAME_ENEMY |---------------------------------------------------------- #----------------# class Game_Enemy < Game_Battler alias galv_animb_gegb_initialize initialize def initialize(index, enemy_id) galv_animb_gegb_initialize(index, enemy_id) setup_animated_battler end def sub_pose(target) if !dead? && @animated_battler return if $data_enemies[@enemy_id].note =~ /<stationary_sub>/i @screen_x = target.screen_x + GALV_BAT::SXOFFSET @screen_y = target.screen_y + GALV_BAT::SYOFFSET @sprite_effect_type = :substitute end end def return_to_position if !dead? && @animated_battler @screen_x = @orx @screen_y = @ory end endend # Game_Enemy < Game_Battler #-------------------##---| BATTLEMANAGER |------------------------------------------------------- #-------------------# module BattleManager class << self alias galv_animb_bm_process_victory process_victory end def self.process_victory $game_party.battle_members.each { |actor| actor.perform_victory } galv_animb_bm_process_victory endend # BattleManager #------------------##---| SCENE_BATTLE |-------------------------------------------------------- #------------------# class Scene_Battle < Scene_Base alias galv_animb_sbsb_start start def start position_battlers galv_animb_sbsb_start end def position_actors $game_party.battle_members.each_with_index { |battler,i| battler.reinit_battler(i) } @spriteset.refresh_actors end def position_battlers galv_all_battle_members.each_with_index { |battler,i| battler.init_animated_battler(i) } end def galv_all_battle_members $game_party.battle_members + $game_troop.members end alias galv_animb_sbsb_show_animation show_animation def show_animation(targets, animation_id) @move_target = targets[0] check_dash set_pose galv_animb_sbsb_show_animation(targets, animation_id) end def check_dash move = move_to_target if move > 0 @subject.perform_travel(:move_forward,@move_target,move) update_for_wait while @subject.moving? elsif move == 0 @subject.perform_dash(:dash_forward,@move_target) wait(30) end end def move_to_target return -1 if no_action && !@moveitem @moveitem ||= @subject.current_action.item return $1.to_i if @moveitem.note =~ /<melee: (.*)>/i if @moveitem.is_a?(RPG::Skill) && @moveitem.id == 1 char = @subject.actor? ? $data_actors[@subject.id] : $data_enemies[@subject.enemy_id] return $1.to_i if char.note =~ /<melee: (.*)>/i end return -1 end def no_action !@subject || !@subject.current_action || !@subject.current_action.item end alias galv_animb_sbsb_process_action_end process_action_end def process_action_end if @subject.screen_x != @subject.orx @subject.perform_dash(:dash_back,@subject) wait(25) end galv_animb_sbsb_process_action_end @moveitem = nil end alias galv_animb_sbsb_invoke_counter_attack invoke_counter_attack def invoke_counter_attack(target,item) target.perform_counter_attack galv_animb_sbsb_invoke_counter_attack(target,item) end alias galv_animb_sbsb_invoke_magic_reflection invoke_magic_reflection def invoke_magic_reflection(target, item) target.perform_magic_reflect galv_animb_sbsb_invoke_magic_reflection(target, item) end def set_pose return if no_action item = @subject.current_action.item if item.is_a?(RPG::Skill) case item.id when 2 # guard @subject.do_pose(1) when 1 # attack @subject.do_pose(4) wait(20) if $imported["YEA-BattleEngine"] else unique = item.pose ? item.pose : 6 @subject.do_pose(unique) end elsif item.is_a?(RPG::Item) unique = item.pose ? item.pose : 5 @subject.do_pose(unique) wait(30) if $imported["YEA-BattleEngine"] end endend # Scene_Battle < Scene_Base #----------------------##---| WINDOW_BATTLELOG |---------------------------------------------------- #----------------------# class Window_BattleLog < Window_Selectable alias galv_animb_wblws_display_substitute display_substitute def display_substitute(substitute, target) substitute.sub_pose(target) galv_animb_wblws_display_substitute(substitute, target) endend #----------------------##---| SPRITESET_BATTLE |---------------------------------------------------- #----------------------# class Spriteset_Battle #OVERWRITE def create_enemies @enemy_sprites = $game_troop.members.reverse.collect do |enemy| if enemy.animated_battler Sprite_AnimBattler.new(@viewport1, enemy) else Sprite_Battler.new(@viewport1, enemy) end end end # OVERWRITE def create_actors @actor_sprites = $game_party.battle_members.reverse.collect do |actor| Sprite_ActorBattler.new(@viewport1, actor) end end # OVERWRITE def update_actors need_update = false @actor_sprites.each_with_index do |sprite, i| sprite.battler = $game_party.battle_members[i] if sprite.battler sprite.update else need_update = true end end need_update = true if @actor_sprites.count < $game_party.battle_members.count if need_update SceneManager.scene.position_actors end end def refresh_actors dispose_actors create_actors endend # Spriteset_Battle #--------------------##---| SPRITE_BATTLER |------------------------------------------------------ #--------------------# class Sprite_Battler < Sprite_Base alias galv_animb_spritebsb_update update def update if @battler && @battler.animated_battler super else galv_animb_spritebsb_update end endend # Sprite_Battler < Sprite_Base #------------------------##---| SPRITE_ANIMBATTLER |-------------------------------------------------- #------------------------# class Sprite_AnimBattler < Sprite_Battler def initialize(viewport, battler = nil) init_variables super(viewport,battler) end def init_variables @pattern = 0 @speed_timer = 0 @pose = 0 end def update if @battler && @battler.animated_battler update_bitmap update_pose update_src_rect update_anim update_position setup_new_effect setup_new_animation update_effect end super end def update_bitmap new_bitmap = Cache.battler(@battler.animated_battler, @battler.battler_hue) if bitmap != new_bitmap self.bitmap = new_bitmap spritesheet_normal init_visibility end end def spritesheet_normal @cw = bitmap.width / GALV_BAT::COLS @ch = bitmap.height / GALV_BAT::ROWS self.ox = @cw / 2 self.oy = @ch set_mirror end def set_mirror self.mirror = GALV_BAT::ENEMY_FLIP end def update_pose if @pose != @battler.pose @pattern = 0 @pose = @battler.pose end if @battler.reset_pose @pose = 0 @battler.reset_pose = false end end def update_src_rect if @pattern >= GALV_BAT::COLS @pattern = 0 unless freeze_pose? end sx = @pattern * @cw sy = @battler.pose * @ch self.src_rect.set(sx, sy, @cw, @ch) end def freeze_pose? @battler.freeze_pose && @pattern == GALV_BAT::COLS - 1 end def update_anim return if !@battler.bactivated @speed_timer += 1 if @speed_timer > 4 @pattern += 1 unless freeze_pose? @speed_timer = 0 end end def update_position self.x = @battler.screen_x self.y = @battler.screen_y self.z = @battler.screen_z end def start_effect(effect_type) @effect_type = effect_type case @effect_type when :counter_attack,:magic_reflect,:get_hit @effect_duration = 40 @battler_visible = true when :enter_battle @effect_duration = 35 @battler_visible = true when :dash_forward,:dash_back @effect_duration = 15 @battler_visible = true when :move_forward @effect_duration = 500 @move_duration = @effect_duration @battler_visible = true when :dodge @effect_duration = 20 @battler_visible = true when :substitute @effect_duration = 20 @battler_visible = true end super end def update_effect if @effect_duration > 0 case @effect_type when :get_hit, :substitute update_generic_pose when :counter_attack,:magic_reflect update_counter when :enter_battle update_enter_battle when :dash_forward update_dash_forward when :move_forward update_move_forward when :dash_back update_dash_back when :dodge update_dodge end end super end def revert_to_normal return if do_revert? super spritesheet_normal end def do_revert? @effect_type == :whiten || @battler.dead? end def update_generic_pose if @effect_duration == 1 @battler.return_to_position @battler.set_idle_pose end end def xoff; @battler.actor? ? GALV_BAT::XOFFSET : -GALV_BAT::XOFFSET; end def yoff; @battler.actor? ? GALV_BAT::YOFFSET : -GALV_BAT::YOFFSET; end def update_dash_forward if @battler.actor? && @battler.screen_x > Graphics.width / 2 @battler.screen_x -= 3 elsif @battler.enemy? && @battler.screen_x < Graphics.width / 2 @battler.screen_x += 3 end update_disappear if @effect_duration == 1 @battler.screen_x = @battler.move_target.screen_x + xoff @battler.screen_y = @battler.move_target.screen_y + yoff start_effect(:appear) end end def update_dash_back if @battler.actor? && @battler.screen_x < Graphics.width / 2 @battler.screen_x += 3 elsif @battler.enemy? && @battler.screen_x > Graphics.width / 2 @battler.screen_x -= 3 end update_disappear if @effect_duration == 1 @battler.screen_x = @battler.move_target.orx @battler.screen_y = @battler.move_target.ory start_effect(:appear) end end def update_move_forward if @battler.actor? @battler.screen_x -= x_difference(@battler,@battler.move_target) elsif @battler.enemy? @battler.screen_x += x_difference(@battler,@battler.move_target) end @battler.screen_y += y_difference(@battler,@battler.move_target) end def y_difference(bat,tar) yof = bat.actor? ? yoff : -yoff y_diff = bat.ory - (tar.screen_y + yof) x_diff = bat.orx - (tar.screen_x + xoff) y_move = y_diff.to_f / (x_diff.to_f / [@battler.move_speed,1].max).to_f return bat.actor? ? -y_move : y_move end def x_difference(bat,tar) if bat.actor? && bat.screen_x <= (tar.screen_x + xoff) || bat.enemy? && bat.screen_x >= (tar.screen_x + xoff) @battler.move_speed = 0 @effect_duration = 1 return 0 end return @battler.move_speed end def update_dodge if @effect_duration == 1 @battler.screen_x = @battler.orx @battler.screen_y = @battler.ory @battler.set_idle_pose elsif @effect_duration >= 10 @battler.actor? ? @battler.screen_x += 3 : @battler.screen_x -= 3 else @battler.pose = GALV_BAT::EVASION[1] @battler.actor? ? @battler.screen_x -= 3 : @battler.screen_x += 3 end end def update_enter_battle if @effect_duration == 1 @battler.bactivated = true @battler.set_idle_pose end end def update_counter self.color.set(255, 255, 255, 0) self.color.alpha = 128 - (26 - @effect_duration) * 10 @battler.set_idle_pose if @effect_duration == 1 end def update_collapse; endend # Sprite_AnimBattler < Sprite_Base #-------------------------##---| SPRITE_ACTORBATTLER |------------------------------------------------- #-------------------------# class Sprite_ActorBattler < Sprite_AnimBattler def initialize(viewport, battler = nil) super(viewport,battler) end def dispose; super; end def update; super; end def set_mirror self.mirror = GALV_BAT::ACTOR_FLIP end def update_position self.x = @battler.screen_x self.y = @battler.screen_y self.z = @battler.screen_z end def init_visibility self.opacity = 255 endend # Sprite_ActorBattler < Sprite_AnimBattler #------------------------##---| WINDOW_BATTLEENEMY |-------------------------------------------------- #------------------------# class Window_BattleEnemy < Window_Selectable if $imported["YEA-BattleEngine"] def create_flags set_select_flag(:any) select(-1) return if $game_temp.battle_aid.nil? if $game_temp.battle_aid.need_selection? select(-1) elsif $game_temp.battle_aid.for_all? select(-1) set_select_flag(:all) elsif $game_temp.battle_aid.for_random? select(-1) set_select_flag(:random) end end endend # Window_BattleEnemy < Window_Selectable