These 3 scripts work separately but together create a fantastic battle system, all you need to do is place them in 3 separate scripts above Main and below Scene_Debug. Once you have done that all you have to do is export your characters and enemies charsets into the battlers folder, any monsters or Heroes that use RTP battlers will should automatically assign the new charset files as the battler, if not assign them manually. And thats all there is to it, just enjoy
Screenshots
This is a screenshot of the system in action from my game Dragon Emperor

Scripts
Name this script as New_Battle
#==============================================================================# ■ New_Battle#------------------------------------------------------------------------------# Compiled By : Maki#==============================================================================# Original Scripts By : Fukuyama, and 桜雅 在土#==============================================================================# ?????? XRXS_BP 3. ??????HP???? ver.1.01 ??????# by fukuyama, ???? ??y# Battle_End_Recovery## ????????????????W???[??## Request: stay# Script: fukuyama# Test: ?m?R?m?q## URL: http://www4.big.or.j...nd_Recovery.txt#module Battle_End_Recoverymodule Scene_Battle_Module# ???????????ID@@recovery_rate_variable_id = nil# ?????????def battle_end_recovery_rate if @@recovery_rate_variable_id.nil? @@recovery_rate_variable_id = $data_system.variables.index '???????????' if @@recovery_rate_variable_id.nil? @@recovery_rate_variable_id = false end end return 0 unless @@recovery_rate_variable_id return $game_variables[@@recovery_rate_variable_id]end# ?????????????def battle_end_recovery # ?????? recovery_rate = battle_end_recovery_rate # ????????????O??O????A?N?^?[????????????????A????????????????s?? if recovery_rate != 0 and not actor.dead? # ?p?[?e?B??A?N?^?[??????[?v $game_party.actors.each do |actor| # ??????v?Z recovery_hp = (actor.maxhp / 100.0 * recovery_rate).truncate recovery_sp = (actor.maxsp / 100.0 * recovery_rate).truncate # ???????? actor.hp += recovery_hp actor.sp += recovery_sp # ?A?j???[?V??????? actor.damage = - recovery_hp actor.damage_pop = true end # ?X?e?[?^?X?E?B???h?E???X?V @status_window.refresh endendend # module Scene_Battle_Moduleend # module Battle_End_Recovery#------------------------------# ???V?[???????`#------------------------------class Scene_Battle# Scene_Battle?p???W???[?????C???N???[?hinclude Battle_End_Recovery::Scene_Battle_Module# ????t?F?[?Y?T?J?n???????????alias battle_end_recovery_original_start_phase5 start_phase5# ?t?F?[?Y?T?J?n??????`def start_phase5# ??????????????????o??battle_end_recovery# ????t?F?[?Y?T?J?n?????o??battle_end_recovery_original_start_phase5endend# Battle_End_Recovery# ?????? XRXS_BP10. LEVEL UP!?E?B???h?E ??????# by ???? ??y$data_system_level_up_se = "" # ???x???A?b?vSE?B""??????B$data_system_level_up_me = "Audio/ME/007-Fanfare01" # ???x???A?b?vME#==============================================================================# ?? Window_LevelUpWindow#------------------------------------------------------------------------------# ?@?o?g???I?????A???x???A?b?v????????X?e?[?^?X???\???????E?B???h?E????B#==============================================================================class Window_LevelUpWindow < Window_Base#--------------------------------------------------------------------------# ?? ?I?u?W?F?N?g??????#--------------------------------------------------------------------------def initialize(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)super(0, 128, 160, 192)self.contents = Bitmap.new(width - 32, height - 32)self.visible = falserefresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)end#--------------------------------------------------------------------------# ?? ???t???b?V??#--------------------------------------------------------------------------def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)self.contents.clearself.contents.font.color = system_colorself.contents.font.name = "Arial"self.contents.font.size = 14self.contents.draw_text( 0, 0, 160, 24, "LEVEL UP!!")self.contents.font.size = 18self.contents.draw_text( 0, 28, 160, 24, $data_system.words.hp)self.contents.draw_text( 0, 50, 160, 24, $data_system.words.sp)self.contents.font.size = 14self.contents.draw_text( 0, 72, 80, 24, $data_system.words.str)self.contents.draw_text( 0, 94, 80, 24, $data_system.words.dex)self.contents.draw_text( 0, 116, 80, 24, $data_system.words.agi)self.contents.draw_text( 0, 138, 80, 24, $data_system.words.int)self.contents.draw_text(92, 0, 128, 24, "??")self.contents.draw_text(76, 28, 128, 24, "=")self.contents.draw_text(76, 50, 128, 24, "=")self.contents.draw_text(76, 72, 128, 24, "=")self.contents.draw_text(76, 94, 128, 24, "=")self.contents.draw_text(76, 116, 128, 24, "=")self.contents.draw_text(76, 138, 128, 24, "=")self.contents.font.color = normal_colorself.contents.draw_text( 0, 0, 88, 24, last_lv.to_s, 2)self.contents.draw_text( 0, 28, 72, 24, "+" + up_hp.to_s, 2)self.contents.draw_text( 0, 50, 72, 24, "+" + up_sp.to_s, 2)self.contents.draw_text( 0, 72, 72, 24, "+" + up_str.to_s, 2)self.contents.draw_text( 0, 94, 72, 24, "+" + up_dex.to_s, 2)self.contents.draw_text( 0, 116, 72, 24, "+" + up_agi.to_s, 2)self.contents.draw_text( 0, 138, 72, 24, "+" + up_int.to_s, 2)self.contents.font.size = 20self.contents.draw_text( 0, 0, 128, 24, actor.level.to_s, 2)self.contents.draw_text( 0, 26, 128, 24, actor.maxhp.to_s, 2)self.contents.draw_text( 0, 48, 128, 24, actor.maxsp.to_s, 2)self.contents.draw_text( 0, 70, 128, 24, actor.str.to_s, 2)self.contents.draw_text( 0, 92, 128, 24, actor.dex.to_s, 2)self.contents.draw_text( 0, 114, 128, 24, actor.agi.to_s, 2)self.contents.draw_text( 0, 136, 128, 24, actor.int.to_s, 2)endend#==============================================================================# ?? Window_BattleStatus#==============================================================================class Window_BattleStatus < Window_Base#--------------------------------------------------------------------------# ?? ????E???J?C???X?^???X???#--------------------------------------------------------------------------attr_accessor :level_up_flags # LEVEL UP!?\??end#==============================================================================# ?? Game_Battler#==============================================================================class Game_Battler#--------------------------------------------------------------------------# ?? ????E???J?C???X?^???X???#--------------------------------------------------------------------------attr_accessor :exp_gain_ban # EXP??????~#--------------------------------------------------------------------------# ?? ?I?u?W?F?N?g??????#--------------------------------------------------------------------------alias xrxs_bp10_initialize initializedef initialize@exp_gain_ban = falsexrxs_bp10_initializeend#--------------------------------------------------------------------------# ?? ?X?e?[?g [EXP ???l????????] ????#--------------------------------------------------------------------------alias xrxs_bp10_cant_get_exp? cant_get_exp?def cant_get_exp?if @exp_gain_ban == true return trueelse return xrxs_bp10_cant_get_exp?endendend#==============================================================================# ?? Scene_Battle#==============================================================================class Scene_Battle#--------------------------------------------------------------------------# ?? ?A?t?^?[?o?g???t?F?[?Y?J?n#--------------------------------------------------------------------------alias xrxs_bp10_start_phase5 start_phase5def start_phase5# EXP ?l????~for i in 0...$game_party.actors.size $game_party.actors[i].exp_gain_ban = trueendxrxs_bp10_start_phase5# EXP ?l????~?????for i in 0...$game_party.actors.size $game_party.actors[i].exp_gain_ban = falseend# EXP????????@exp_gained = 0for enemy in $game_troop.enemies # ?l?? EXP????? # ?G?l?~?[???B??????????? @exp_gained += enemy.exp if not enemy.hiddenend# ???@phase5_step = 0@exp_gain_actor = -1# ???U???g?E?B???h?E???\??@result_window.y -= 64@result_window.visible = true# ???x???A?b?v??????phase5_next_levelupend#--------------------------------------------------------------------------# ?? ?t???[???X?V (?A?t?^?[?o?g???t?F?[?Y)#--------------------------------------------------------------------------alias xrxs_bp10_update_phase5 update_phase5def update_phase5case @phase5_stepwhen 1 update_phase5_step1else xrxs_bp10_update_phase5 # ???x???A?b?v???????????????o?g???I?? battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0endend#--------------------------------------------------------------------------# ?? ?t???[???X?V (?A?t?^?[?o?g???t?F?[?Y 1 : ???x???A?b?v)#--------------------------------------------------------------------------def update_phase5_step1# C ?{?^????????????if Input.trigger?(Input::C) # ?E?B???h?E??????????A?N?^?[?? @levelup_window.visible = false if @levelup_window != nil @status_window.level_up_flags[@exp_gain_actor] = false phase5_next_levelupendend#--------------------------------------------------------------------------# ?? ????A?N?^?[????x???A?b?v?\????#--------------------------------------------------------------------------def phase5_next_levelupbegin # ????A?N?^?[?? @exp_gain_actor += 1 # ?????A?N?^?[??? if @exp_gain_actor >= $game_party.actors.size # ?A?t?^?[?o?g???t?F?[?Y?J?n @phase5_step = 0 return end actor = $game_party.actors[@exp_gain_actor] if actor.cant_get_exp? == false # ?????\??l????? last_level = actor.level last_maxhp = actor.maxhp last_maxsp = actor.maxsp last_str = actor.str last_dex = actor.dex last_agi = actor.agi last_int = actor.int # ?o???l????????I?u??(?? actor.exp += @exp_gained # ???? if actor.level > last_level # ???x???A?b?v?????? @status_window.level_up(@exp_gain_actor) if $data_system_level_up_se != "" Audio.se_stop Audio.se_play($data_system_level_up_se) end if $data_system_level_up_me != "" Audio.me_stop Audio.me_play($data_system_level_up_me) end @levelup_window = Window_LevelUpWindow.new(actor, last_level, actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str, actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int) @levelup_window.x = 160 * @exp_gain_actor @levelup_window.visible = true @phase5_wait_count = 40 @phase5_step = 1 # ?X?e?[?^?X?E?B???h?E?????t???b?V?? @status_window.refresh return end endend until falseendend# ?????? XRXS_17. ?X???b?v?_???[?W?h???^???????? ver.1.51 ??????# by ???? ??y, fukuyama#==============================================================================# ?? Game_Battler#==============================================================================class Game_Battler#--------------------------------------------------------------------------# ?? ?X???b?v?_???[?W?????K?p#--------------------------------------------------------------------------alias xrxs_bp7_slip_damage_effect slip_damage_effectdef slip_damage_effect# ???l???????slip_damage_percent = 0slip_damage_plus = 0# ????t????????????X?e?[?g????????X???b?v?_???[?W?L??????m???T??for i in @states if $data_states[i].slip_damage # ????X?e?[?g????????????X???b?v?_???[?W?? # Lv?v???X?X?e?[?g?????Lv?}?C?i?X?X?e?[?g???????B for j in $data_states[i].plus_state_set if $data_states[j] != nil if $data_states[j].name =~ /^?X???b?v([0-9]+)(%|??)/ slip_damage_percent += $1.to_i elsif $data_states[j].name =~ /^?X???b?v([0-9]+)$/ slip_damage_plus += $1.to_i end end end for j in $data_states[i].minus_state_set if $data_states[j] != nil if $data_states[j].name =~ /^?X???b?v([0-9]+)(%|??)/ slip_damage_percent -= $1.to_i elsif $data_states[j].name =~ /^?X???b?v([0-9]+)$/ slip_damage_plus -= $1.to_i end end end endendif slip_damage_percent == 0 and slip_damage_plus == 0 xrxs_bp7_slip_damage_effectelse # ?h???X???b?v?h??? ?????????? for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id] armor = $data_armors[i] next if armor == nil for j in armor.guard_state_set if $data_states[j] != nil if $data_states[j].name =~ /^?X???b?v([0-9]+)(%|??)/ if slip_damage_percent > 0 slip_damage_percent = [slip_damage_percent - $1.to_i, 0].max end end if $data_states[j].name =~ /^?X???b?v([0-9]+)$/ if slip_damage_percent > 0 slip_damage_plus = [slip_damage_plus - $1.to_i, 0].max end end end end end # ?_???[?W????? self.damage = self.maxhp * slip_damage_percent / 100 + slip_damage_plus # ???U if self.damage.abs > 0 amp = [self.damage.abs * 15 / 100, 1].max self.damage += rand(amp+1) + rand(amp+1) - amp end # HP ?????_???[?W?????Z self.hp -= self.damage # ???\?b?h?I?? return trueendendend# ?????? XRXS_BP 1. CP?????? ver.15 ??????# by ???? ??y, ?a??, Jack-R#==============================================================================# ?? Scene_Battle_CP#==============================================================================class Scene_Battle_CP#--------------------------------------------------------------------------# ?? ???J?C???X?^???X???#--------------------------------------------------------------------------attr_accessor :stop # CP???Z?X?g?b?v#----------------------------------------------------------------------------# ?? ?I?u?W?F?N?g???????#----------------------------------------------------------------------------def initialize@battlers = []@cancel = false@agi_total = 0# ?z?? @count_battlers ????????@count_battlers = []# ?G?l?~?[???z?? @count_battlers ????for enemy in $game_troop.enemies @count_battlers.push(enemy)end# ?A?N?^?[???z?? @count_battlers ????for actor in $game_party.actors @count_battlers.push(actor)endfor battler in @count_battlers @agi_total += battler.agiendfor battler in @count_battlers battler.cp = [[65535 * (rand(15) + 85) / 100 * battler.agi / @agi_total * 4, 0].max, 65535].minendend#----------------------------------------------------------------------------# ?? CP?J?E???g??J?n#----------------------------------------------------------------------------def startif @cp_thread != nil then returnend@cancel = false@stop = false# ?????????X???b?h@cp_thread = Thread.new do while @cancel != true if @stop != true self.update # ?X?V sleep(0.05) end endend# ???????X???b?hend#----------------------------------------------------------------------------# ?? CP?J?E???g?A?b?v#----------------------------------------------------------------------------def updateif @count_battlers != nil then for battler in @count_battlers # ?s???o???????????? if battler.dead? == true #or battler.movable? == false then battler.cp = 0 next end # ?????? 1.3????????????X?s?[?h????X??\?B???????????_??g?p??????B battler.cp = [[battler.cp + 1.3 * 4096 * battler.agi / @agi_total, 0].max, 65535].min endendend#----------------------------------------------------------------------------# ?? CP?J?E???g??J?n#----------------------------------------------------------------------------def stop@cancel = trueif @cp_thread != nil then @cp_thread.join @cp_thread = nilendendend#==============================================================================# ?? Game_Battler#==============================================================================class Game_Battlerattr_accessor :now_guarding # ????h???t???Oattr_accessor :cp # ????CPattr_accessor :slip_state_update_ban # ?X???b?v?E?X?e?[?g???????????~#--------------------------------------------------------------------------# ?? ?R?}???h?????\????#--------------------------------------------------------------------------def inputable?return (not @hidden and restriction <= 1 and @cp >=65535)end#--------------------------------------------------------------------------# ?? ?X?e?[?g [?X???b?v?_???[?W] ????#--------------------------------------------------------------------------alias xrxs_bp1_slip_damage? slip_damage?def slip_damage?return false if @slip_state_update_banreturn xrxs_bp1_slip_damage?end#--------------------------------------------------------------------------# ?? ?X?e?[?g???R???? (?^?[?????????o??)#--------------------------------------------------------------------------alias xrxs_bp1_remove_states_auto remove_states_autodef remove_states_autoreturn if @slip_state_update_banxrxs_bp1_remove_states_autoendend#==============================================================================# ?? Game_Actor#==============================================================================class Game_Actor < Game_Battler#--------------------------------------------------------------------------# ?? ?Z?b?g?A?b?v#--------------------------------------------------------------------------alias xrxs_bp1_setup setupdef setup(actor_id)xrxs_bp1_setup(actor_id)@hate = 100 # init-value is 100@cp = 0@now_guarding = false@slip_state_update_ban = falseendend#==============================================================================# ?? Game_Enemy#==============================================================================class Game_Enemy < Game_Battler#--------------------------------------------------------------------------# ?? ?I?u?W?F?N?g??????#--------------------------------------------------------------------------alias xrxs_bp1_initialize initializedef initialize(troop_id, member_index)xrxs_bp1_initialize(troop_id, member_index)@hate = 100 # init-value is 100@cp = 0@now_guarding = false@slip_state_update_ban = falseendend#==============================================================================# ?? Window_BattleStatus#==============================================================================class Window_BattleStatus < Window_Base#--------------------------------------------------------------------------# ?? ???J?C???X?^???X???#--------------------------------------------------------------------------attr_accessor :update_cp_only # CP???[?^?[????X?V#--------------------------------------------------------------------------# ?? ?I?u?W?F?N?g??????#--------------------------------------------------------------------------alias xrxs_bp1_initialize initializedef initialize@update_cp_only = falsexrxs_bp1_initializeend#--------------------------------------------------------------------------# ?? ???t???b?V??#--------------------------------------------------------------------------alias xrxs_bp1_refresh refreshdef refreshif @update_cp_only == false xrxs_bp1_refreshendfor i in 0...$game_party.actors.size actor = $game_party.actors[i] actor_x = i * 160 + 4 draw_actor_cp_meter(actor, actor_x, 96, 120, 0)endend#--------------------------------------------------------------------------# ?? CP???[?^?[ ??`??#--------------------------------------------------------------------------def draw_actor_cp_meter(actor, x, y, width = 156, type = 0)self.contents.font.color = system_colorself.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))if actor.cp == nil actor.cp = 0endw = width * [actor.cp,65535].min / 65535self.contents.fill_rect(x, y+28, w,1, Color.new(255, 255, 128, 255))self.contents.fill_rect(x, y+29, w,1, Color.new(255, 255, 0, 255))self.contents.fill_rect(x, y+30, w,1, Color.new(192, 192, 0, 255))self.contents.fill_rect(x, y+31, w,1, Color.new(128, 128, 0, 255))endend#==============================================================================# ?? Scene_Battle#==============================================================================class Scene_Battle# ???????????????????A?A?N?^?[?R?}???h???|?b?v??????????????????$data_system_command_up_se = ""#--------------------------------------------------------------------------# ?? ?o?g???I??# result : ???? (0:???? 1:?s?k 2:????)#--------------------------------------------------------------------------alias xrxs_bp1_battle_end battle_enddef battle_end(result)# CP?J?E???g???~@cp_thread.stopxrxs_bp1_battle_end(result)end#--------------------------------------------------------------------------# ?? ?v???o?g???t?F?[?Y?J?n#--------------------------------------------------------------------------alias xrxs_bp1_start_phase1 start_phase1def start_phase1@agi_total = 0@cp_thread = Scene_Battle_CP.new# ?A?N?^?[?R?}???h?E?B???h?E?????s1 = $data_system.words.attacks2 = $data_system.words.skills3 = $data_system.words.guards4 = $data_system.words.item@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, "Run"])@actor_command_window.y = 128@actor_command_window.back_opacity = 160@actor_command_window.active = false@actor_command_window.visible = false@actor_command_window.draw_item(4, $game_temp.battle_can_escape ? @actor_command_window.normal_color : @actor_command_window.disabled_color)xrxs_bp1_start_phase1end#--------------------------------------------------------------------------# ?? ?p?[?e?B?R?}???h?t?F?[?Y?J?n#--------------------------------------------------------------------------alias xrxs_bp1_start_phase2 start_phase2def start_phase2xrxs_bp1_start_phase2@party_command_window.active = false@party_command_window.visible = false# ????start_phase3end#--------------------------------------------------------------------------# ?? ?t???[???X?V (?p?[?e?B?R?}???h?t?F?[?Y)#--------------------------------------------------------------------------alias xrxs_bp1_update_phase2 update_phase2def update_phase2# C ?{?^????????????if Input.trigger?(Input::C) # ?p?[?e?B?R?}???h?E?B???h?E??J?[?\????u????? case @party_command_window.index when 0 # ?? # ???? SE ?????t $game_system.se_play($data_system.decision_se) @cp_thread.start # ?A?N?^?[?R?}???h?t?F?[?Y?J?n start_phase3 end returnendxrxs_bp1_update_phase2end#--------------------------------------------------------------------------# ?? ????A?N?^?[??R?}???h?????#--------------------------------------------------------------------------def phase3_next_actor# ???[?vbegin # ?A?N?^?[?????G?t?F?N?g OFF if @active_battler != nil @active_battler.blink = false end # ?????A?N?^?[??? if @actor_index == $game_party.actors.size-1 # ???C???t?F?[?Y?J?n @cp_thread.start start_phase4 return end # ?A?N?^?[??C???f?b?N?X???i??? @actor_index += 1 @active_battler = $game_party.actors[@actor_index] @active_battler.blink = true if @active_battler.inputable? == false @active_battler.current_action.kind = -1 end # ?A?N?^?[???R?}???h??????????t??????????????????xend until @active_battler.inputable?@cp_thread.stop# ?A?N?^?[?R?}???h?E?B???h?E???Z?b?g?A?b?v@active_battler.now_guarding = falsephase3_setup_command_windowend#--------------------------------------------------------------------------# ?? ?O??A?N?^?[??R?}???h?????#--------------------------------------------------------------------------def phase3_prior_actor# ???[?vbegin # ?A?N?^?[?????G?t?F?N?g OFF if @active_battler != nil @active_battler.blink = false end # ?????A?N?^?[??? if @actor_index == 0 # ??????? start_phase3 return end # ?A?N?^?[??C???f?b?N?X????? @actor_index -= 1 @active_battler = $game_party.actors[@actor_index] @active_battler.blink = true # ?A?N?^?[???R?}???h??????????t??????????????????xend until @active_battler.inputable?@cp_thread.stop# ?A?N?^?[?R?}???h?E?B???h?E???Z?b?g?A?b?v@active_battler.now_guarding = falsephase3_setup_command_windowend#--------------------------------------------------------------------------# ?? ?A?N?^?[?R?}???h?E?B???h?E??Z?b?g?A?b?v#--------------------------------------------------------------------------alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_windowdef phase3_setup_command_window# ?????????Audio.se_play($data_system_command_up_se) if $data_system_command_up_se != ""# ???xrxs_bp1_phase3_setup_command_windowend#--------------------------------------------------------------------------# ?? ?t???[???X?V (?A?N?^?[?R?}???h?t?F?[?Y : ???{?R?}???h)#--------------------------------------------------------------------------alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_commanddef update_phase3_basic_command# C ?{?^????????????if Input.trigger?(Input::C) # ?A?N?^?[?R?}???h?E?B???h?E??J?[?\????u????? case @actor_command_window.index when 4 # ?????? if $game_temp.battle_can_escape # ???? SE ?????t $game_system.se_play($data_system.decision_se) # ?A?N?V????????? @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 4 # ????A?N?^?[??R?}???h????? phase3_next_actor else # ?u?U?[ SE ?????t $game_system.se_play($data_system.buzzer_se) end return endendxrxs_bsp1_update_phase3_basic_commandend#--------------------------------------------------------------------------# ?? ???C???t?F?[?Y?J?n#--------------------------------------------------------------------------alias xrxs_bp1_start_phase4 start_phase4def start_phase4xrxs_bp1_start_phase4# ?G?l?~?[?A?N?V??????for enemy in $game_troop.enemies if enemy.cp < 65535 enemy.current_action.clear enemy.current_action.kind = -1 # ?^?[????????B next end enemy.make_actionend# ?s????????make_action_ordersend#--------------------------------------------------------------------------# ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 1 : ?A?N?V????????)#--------------------------------------------------------------------------alias xrxs_bp1_update_phase4_step1 update_phase4_step1def update_phase4_step1# ??????@phase4_act_continuation = 0# ???s????if judge @cp_thread.stop # ?????????s?k??? : ???\?b?h?I?? returnend# ???s???o?g???[?z???????????@active_battler = @action_battlers[0]# ?X?e?[?^?X?X?V??CP??????????B@status_window.update_cp_only = true# ?X?e?[?g?X?V????~?B@active_battler.slip_state_update_ban = true if @active_battler != nil# ???xrxs_bp1_update_phase4_step1# ??~??????@status_window.update_cp_only = false@active_battler.slip_state_update_ban = false if @active_battler != nilend#--------------------------------------------------------------------------# ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 2 : ?A?N?V?????J?n)#--------------------------------------------------------------------------alias xrxs_bp1_update_phase4_step2 update_phase4_step2def update_phase4_step2# ?????A?N?V????????????unless @active_battler.current_action.forcing # CP?????????????? if @phase4_act_continuation == 0 and @active_battler.cp < 65535 @phase4_step = 6 return end # ?????? [?G??????U??????] ?? [??????????U??????] ??? if @active_battler.restriction == 2 or @active_battler.restriction == 3 # ?A?N?V??????U??????? @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 0 end # ?????? [?s????????] ??? if @active_battler.restriction == 4 # ?A?N?V????????????o?g???[???N???A $game_temp.forcing_battler = nil if @phase4_act_continuation == 0 and @active_battler.cp >= 65535 # ?X?e?[?g???R???? @active_battler.remove_states_auto # CP???? @active_battler.cp = [(@active_battler.cp - 65535),0].max # ?X?e?[?^?X?E?B???h?E?????t???b?V?? @status_window.refresh end # ?X?e?b?v 1 ???s @phase4_step = 1 return endend# ?A?N?V?????????????case @active_battler.current_action.kindwhen 0 # ?U????h???E???????E???????????????????CP @active_battler.cp -= 0 if @phase4_act_continuation == 0when 1 # ?X?L???g?p???????CP @active_battler.cp -= 65535 if @phase4_act_continuation == 0when 2 # ?A?C?e???g?p???????CP @active_battler.cp -= 65535 if @phase4_act_continuation == 0when -1 # CP????????????? @phase4_step = 6 returnend# CP???Z???????~????@cp_thread.stop = true# ?X?e?[?g???R????@active_battler.remove_states_autoxrxs_bp1_update_phase4_step2end#--------------------------------------------------------------------------# ?? ???{?A?N?V???? ?????#--------------------------------------------------------------------------alias xrxs_bp1_make_basic_action_result make_basic_action_resultdef make_basic_action_result# ?U?????if @active_battler.current_action.basic == 0 and @phase4_act_continuation == 0 @active_battler.cp -= 65535 # ?U??????CP????end# ?h?????if @active_battler.current_action.basic == 1 and @phase4_act_continuation == 0 @active_battler.cp -= 32767 # ?h????CP????end# ?G??????????if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2 and @phase4_act_continuation == 0 @active_battler.cp -= 65535 # ????????CP????end# ????????????if @active_battler.current_action.basic == 3 and @phase4_act_continuation == 0 @active_battler.cp -= 32767 # ?????????????CP????end# ?????????if @active_battler.current_action.basic == 4 and @phase4_act_continuation == 0 @active_battler.cp -= 65535 # ????????CP???? # ??????\??????? if $game_temp.battle_can_escape == false # ?u?U?[ SE ?????t $game_system.se_play($data_system.buzzer_se) return end # ???? SE ?????t $game_system.se_play($data_system.decision_se) # ???????? update_phase2_escape returnendxrxs_bp1_make_basic_action_resultend#--------------------------------------------------------------------------# ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 5 : ?_???[?W?\??)#--------------------------------------------------------------------------alias xrxs_bp1_update_phase4_step5 update_phase4_step5def update_phase4_step5# ?X???b?v?_???[?Wif @active_battler.hp > 0 and @active_battler.slip_damage? @active_battler.slip_damage_effect @active_battler.damage_pop = trueendxrxs_bp1_update_phase4_step5end#--------------------------------------------------------------------------# ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 6 : ???t???b?V??)#--------------------------------------------------------------------------alias xrxs_bp1_update_phase4_step6 update_phase4_step6def update_phase4_step6# CP???Z????J????@cp_thread.stop = false# ?w???v?E?B???h?E???B??@help_window.visible = falsexrxs_bp1_update_phase4_step6endend# ?????? XRXS_BP 7. ?o?g???X?e?[?^?X?E?N???A?f?U?C?? ver.1.02 ??????# by ???? ??y, TOMY#==============================================================================# ?? Window_BattleStatus#==============================================================================class Window_BattleStatus < Window_Base#--------------------------------------------------------------------------# ?? ???J?C???X?^???X???#--------------------------------------------------------------------------attr_accessor :update_cp_only # CP???[?^?[????X?V#--------------------------------------------------------------------------# ?? ?I?u?W?F?N?g??????#--------------------------------------------------------------------------alias xrxs_bp7_initialize initializedef initializexrxs_bp7_initialize# ??Full-View?????????s?? # ????????????????B#self.opacity = 0#self.back_opacity = 0end#--------------------------------------------------------------------------# ?? ???t???b?V??#--------------------------------------------------------------------------alias xrxs_bp7_refresh refreshdef refreshif @update_cp_only xrxs_bp7_refresh returnend# ?`?????~??????????@draw_ban = truexrxs_bp7_refresh# ?`????~??????@draw_ban = false# ?`????J?n@item_max = $game_party.actors.sizefor i in 0...$game_party.actors.size actor = $game_party.actors[i] actor_x = i * 160 + 21 # ???s?L?????O???t?B?b?N??`?? draw_actor_graphic(actor, actor_x - 9, 116) # HP/SP???[?^?[??`?? draw_actor_hp_meter_line(actor, actor_x, 72, 96, 12) draw_actor_sp_meter_line(actor, actor_x, 104, 96, 12) # HP???l??`?? self.contents.font.size = 24 # HP/SP???l?????????? self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color draw_shadow_text(actor_x-2, 58, 96, 24, actor.hp.to_s, 2) # SP???l??`?? self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color draw_shadow_text(actor_x-2, 90, 96, 24, actor.sp.to_s, 2) # ?p???uHP?v??p???uSP?v??`?? self.contents.font.size = 12 # ?p???uHP/SP?v?????????? self.contents.font.color = system_color # ?p???uHP/SP?v???????F draw_shadow_text(actor_x, 60, 96, 12, $data_system.words.hp) draw_shadow_text(actor_x, 92, 96, 12, $data_system.words.sp) draw_actor_state(actor, actor_x, 100)endendend#==============================================================================# ?? Window_Base#==============================================================================class Window_Base < Window#--------------------------------------------------------------------------# ?? HP???[?^?[ ??`??#--------------------------------------------------------------------------def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)w = width * actor.hp / actor.maxhphp_color_1 = Color.new(255, 0, 0, 192)hp_color_2 = Color.new(255, 255, 0, 192)self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)x -= 1y += (height/4).floorself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)end#--------------------------------------------------------------------------# ?? SP???[?^?[ ??`??#--------------------------------------------------------------------------def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)w = width * actor.sp / actor.maxsphp_color_1 = Color.new( 0, 0, 255, 192)hp_color_2 = Color.new( 0, 255, 255, 192)self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)x -= 1y += (height/4).floorself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)x -= 1y += (height/4).ceilself.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)end#--------------------------------------------------------------------------# ?? ???O??`??#--------------------------------------------------------------------------alias xrxs_bp7_draw_actor_name draw_actor_namedef draw_actor_name(actor, x, y)xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != trueend#--------------------------------------------------------------------------# ?? ?X?e?[?g??`??#--------------------------------------------------------------------------alias xrxs_bp7_draw_actor_state draw_actor_statedef draw_actor_state(actor, x, y, width = 120)xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != trueend#--------------------------------------------------------------------------# ?? HP ??`??#--------------------------------------------------------------------------alias xrxs_bp7_draw_actor_hp draw_actor_hpdef draw_actor_hp(actor, x, y, width = 144)xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != trueend#--------------------------------------------------------------------------# ?? SP ??`??#--------------------------------------------------------------------------alias xrxs_bp7_draw_actor_sp draw_actor_spdef draw_actor_sp(actor, x, y, width = 144)xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != trueendend#==============================================================================# ?? ?O?????C?u????#==============================================================================class Window_Base#--------------------------------------------------------------------------# ?? ???C???`?? by ???? ??y#--------------------------------------------------------------------------def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)# ?`???????v?Z?B???????p????????Bdistance = (start_x - end_x).abs + (start_y - end_y).abs# ?`??J?nif end_color == start_color for i in 1..distance x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i self.contents.fill_rect(x, y, width, width, start_color) endelse for i in 1..distance x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i r = start_color.red * (distance-i)/distance + end_color.red * i/distance g = start_color.green * (distance-i)/distance + end_color.green * i/distance b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a)) endendend#--------------------------------------------------------------------------# ?? ?e?????`?? by TOMY#--------------------------------------------------------------------------def draw_shadow_text(x, y, width, height, string, align = 0)# ????F????????????color = self.contents.font.color.dup# ??????e?`??self.contents.font.color = Color.new(0, 0, 0)self.contents.draw_text(x + 2, y + 2, width, height, string, align)# ????F??????`??self.contents.font.color = colorself.contents.draw_text(x, y, width, height, string, align)endend
Name this script as Animated Battlers - Enhanced
#==============================================================================# ** Animated Battlers - Enhanced ver. 5.0 (12-23-2006)#------------------------------------------------------------------------------# Animated Battlers by Minkoff# Enhancements by DerVVulfman # Low percentage and Status Poses # Concept & Base coding by Twin Matrix# Stationary Enemies requested by jens009# Continuous Victory Looping for actors requested by Skyla Doragono# Actors readying themselves before battle requested by Clive# Default Battlers for Enemies requested for by WithViolence# Mixed Default and Spritesheet Battlers requested for by SteveE22# Hero & Enemy z.depth concept by Min-Chan and Caldaron ( totally redone <img src='http://www.rmxpunlimited.net/forums/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' /> )# Stationary Poses suggested by Twin Matrix# Critical Hit animation requested by Mimi-Chan# Both Enemy and Actor's individual Frames per Pose requested by creiz# Expandable Battle Parties beyond 4 requested by Leknaat# Additional value call added for compatability with Battle Cry script# Removed dependancy on $game_system for the Sideview Mirror system# Fixed the 'Blocking during Victory State' bug discovered by Kaze950# Collapse stack-error found by JirbyTaylor(fixed) / Code by SephirothSpawn# #============================================================================== ## ADDITIONAL CALLS AVAILABLE PRIOR TO COMBAT:##------------------------------------------------------------------------------# SIDEVIEW MIRROR: This value switches the positions of both enemies and# heroes to opposite ends of the screen.## Script : $sideview_mirror = [number]# number : a value indicating whether the hero & enemy positions are switched# 0 = Default: Enemies on the left, Heroes on the right# 1 = Switched: Heroes on the left, Enemies on the right##------------------------------------------------------------------------------# BATTLER FORMATIONS: This value changes the way your heroes line up when the# battle starts.## Script : $formation_style = [number]# number : a value indicating the type of formation your heroes will use# 0 = Diagonal (Default) 4 = Column Pattern 1# 1 = Diagonal Pattern 2 5 = Column Pattern 2# 2 = Slanted Pattern 1 6 = Wave Formation 1# 3 = Slanted Pattern 2 7 = Wave Formation 2 ## 8 = Randomized (system will choose from 0 to 7)##------------------------------------------------------------------------------ # FORMATION OPTIONS: These values may expand your system to go beyond the# default four player system.## Script : $formation_max_member = [number]# number : A value indicating the maximum number of members in your party.# (default = 4)# # Script : $formation_max_height = [number]# number : A value indicating (in pixels) the top height of your party shown# in the Battle Screen. The higher the number, the lower the party# on the screen. (default = 220)## Script : $formation_max_width = [number]# number : The left/right width of the party's formation. (default = 128)## Script : $battlestatus_height = [number]# number : The actual height of your battlestatus window. (default = 160)## NOTE: The combined $formation_max_height and $battlestatus_height determines# the vertical distance between battlers in their formation.##============================================================================== # Things added since original version by Minkoff:# Can reverse the battler positions# Editable spritesheet layout in script# Able to define total/max frames per pose# Can define individual # of frames per each pose# Can use 'red-out' RTP death or 'battler death' pose# Can show battler falling before death.# 'Casting' pose now available for RTAB/Skill Timing users# Can show battler celebrating before victory pose# Can tag battlers who's victory pose loops indefinitely# Can show actor battlers get ready before battle starts.# Separate poses for 'skills', 'items' or 'weapons' based on their id# Can allow the battlers to step forward before using items & skills (FFVII+)# Attacking battlers rush towards their targets while item & skill users don't# Certain weapons can force the battler NOT to move# Certain items & skills can force battlers to 'rush' the enemy# Certain skills or items can force movement to the center of the screen# Stationary enemies. In case enemies do NOT move when they attack.# Adjustable 'low health' checker. Set your low health to 25%... 30%... 10%...# Poses now available for status ailments# Dead revert to 'victory' pose bug fixed.# Default battlers now available for actors and/or enemies# Default battlers now usable by ID number (had to rewrite red-out for that)# Escaping Enemies bug found by SteveE22. Fixed just as fast.# Hero Formations (total of 8 hardwired -& 1 random- ... add at your own risk)# Z-Depth for attack overlapping purposes# Corrected attack overlap offset routine. Overlap now based on battler size# Certain skills and items can now prevent movement# Can allow battlers to take step forward before performing 'attack' pose.(FF)# Certain weapons can move battlers to center screen instead of a full move.# Escaping Enemies can now have a pose before disappearing (was a rush pose)# Redesigned Scene_Battle's movement routine# Added pose for Critical Hits# Added the enemy's hash for frame number based on poses# Added the actor's hash for frame number based on poses# Re-Tooled the formations to go beyond the default four party system# Minor value added for compatability with Delissa's Battle Cry script# Default Collapse Stack-Error fixed(code by SephirothSpawn) found JirbyTaylor# Removed dependancy on $game_system for the Sideview Mirror system# Fixed the 'Blocking during Victory State' bug discovered by Kaze950# Includes an Adaptation Switch for use with RTAB's Connected Attacking script# # 40 counted.#==============================================================================# ** Sprite_Battler#------------------------------------------------------------------------------# This sprite is used to display the battler.It observes the Game_Character# class and automatically changes sprite conditions.#==============================================================================class Sprite_Battler < RPG::Sprite attr_accessor :battler_offset # Degree of action forcing attr_accessor :skill_used # Degree of action forcing attr_accessor :item_used # Degree of action forcing #-------------------------------------------------------------------------- # * Initialize #-------------------------------------------------------------------------- alias cbs_initialize initialize def initialize(viewport, battler = nil) # * Configuration System * # * Default Battler Style Switches #-------------------------------------------------------------------------- $default_enemy = false # If true, these switches allows the use $default_actor = false # of default battlers for actors/enemies $default_enemy_id = [] # Ids of enemies using default battlers $default_actor_id = [] # Ids of actors using default battlers @default_collapse_actor = false # If true, restores the old 'red fade' @default_collapse_enemy = true # collapse effect (using spritesheets) # * Animation Frames and Animation Speed #-------------------------------------------------------------------------- @speed = 5 # Framerate speed of the battlers @poses = 4 # Maximum # of poses (stances) in the template @frames = 4 # Maximum # of frames in each pose @frames_standard = 4 # Standard # of frames played in each pose. @low_hp_percentage = 0.25 # Determines health% of battler for WOOZY pose. # * Poses Control #-------------------------------------------------------------------------- # Editable Template (Some people wanted to change their template design) $p1 = 1 # Sets the 'Ready Pose' ($p1) to be pose #1 in your template $p2 = 1 # Sets the 'Struck Pose' ($p2) to be pose #2 in your template $p3 = 1 # Sets the 'Woozy Pose' ($p3) to be pose #3 in your template $p4 = 1 # Sets the 'Block Pose' ($p4) to be pose #4 in your template $p5 = 1 # Sets the 'Charge Pose' ($p5) to be pose #5 in your template $p6 = 2 # Sets the 'Retreat Pose'($p6) to be pose #6 in your template $p7 = 1 # Sets the 'Attack Pose' ($p7) to be pose #7 in your template $p8 = 1 # Sets the 'Item Pose' ($p8) to be pose #8 in your template $p9 = 1 # Sets the 'Skill Pose' ($p9) to be pose #9 in your template $p10 = 0 # Sets the 'Victory Pose'($p10)to be pose #10 in your template $p11 = 3 # Sets the 'Defeat Pose' ($p11)to be pose #11 in your template # Non-Default Poses (can expand beyond the default 11 poses here) @poses_setup = nil # Choose animation pose for 'preparation' @poses_casting = nil # Set casting pose to 'Block' for example $poses_escaping = nil # Set 'coward' pose for fleeing monsters) $poses_critical = nil # Set 'critical' hit pose for BIG hits. @poses_dying = nil # Choose animation pose for dying throws. @poses_winning = nil # Set winning dance to 'block' for examp. @poses_winning_loops = [] # Set victory non-freezing actor as #7 # Non-Default Pose Hashes (poses dependant on .id values) @poses_status = {} # Didn't set any $poses_skills = {} # Didn't set any $poses_items = {} # Didn't set any $poses_weapons = {} # Didn't set any weapons to any poses # * Frames Control #-------------------------------------------------------------------------- @frames_per_pose = {0 => 1, 3 => 1} # Set #of frames to pose(by index) # 1 frame set for 0(Victory) and # set for 3 (Defeat). All other # poses are animated. # Advanced Individual Pose/Frame Hashes # Advanced Individual Poses uses # hashes within hashes. $poses_actor = {} # $poses_enemy = {} # # # Individual Battler Settings @mirror_enemies = true # Enemy battlers use reversed image @stationary_enemies = false # If the enemies don't move while attacking @stationary_actors = false # If the actors don't move while attacking @calculate_speed = false # System calculates a mean/average speed @phasing = false # Characters fade in/out while attacking # * Movement Settings (Step-Forward / Final Fantasy-Style) #-------------------------------------------------------------------------- $rush_offset = 0 # How much additional space between battlers $rush_attack = false # If true, battler steps forward to attack $rush_skill = true # If true, battler steps forward to use skill $rush_item = true # If true, battler steps forward to use item # * Movement Arrays (Arrays for skill/weapon/item IDs that affect movement) #-------------------------------------------------------------------------- $moving_item_atk = [1] # Examples are items that need to be applied. $moving_skill_atk = [57,61] # Examples are martial-arts and sneak attacks $move2center_atk = [] # Moves battler to center based on weapon id! $move2center_item = [5] # Moves battler to center for a big item atk! $move2center_skill = [7] # Moves battler to center for a big skill atk! # * Stationary Arrays (Arrays for skill/weapon/item IDs that halt movement) #-------------------------------------------------------------------------- # Array that holds the id # of skills, items or weapons that affect movement $stationary_enemyid = [] # Enemies that don't RUN during melee attacks @stationary_weapons = [17,18,19,20,21,22,23,24] # (examples are bows & guns) @stationary_skills = [] # (examples are bows & guns) @stationary_items = [] # (examples are bows & guns) # Adaptation Switches $RTAB_Connected_Attacking = false # Needed to be on if RTAB and Con. Attk. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING @frame, @pose = 0, 0 @last_time = 0 @last_move_time = 0 @battler_offset = 0 @skill_used = 0 @item_used = 0 $casted = false $casting = false @dying = true @s_pose = false $victory = false @winning = true cbs_initialize(viewport, battler) viewport.z = 99 $formation = $formation_style # Setting values called from EVENT scripts $sv_mirror = $sideview_mirror $sv_mirror = 0 if $sideview_mirror == nil $max_member = $formation_max_member $max_member = 4 if $formation_max_member == nil $formation_top = $formation_max_height $formation_top = 220 if $formation_max_height == nil $formation_width = $formation_max_width $formation_width = 128 if $formation_max_width == nil $battlestat_height = $battlestatus_height $battlestat_height = 160 if $battlestatus_height == nil $formation = $formation_style $formation = 0 if $formation_style == nil # if Formation is random if $formation == 8 then $formation = rand(8).to_i end end #-------------------------------------------------------------------------- # * Update #-------------------------------------------------------------------------- alias cbs_update update def update return unless @battler # Regular Update cbs_update # Reset hash for Advanced Pose/Frames pose_temp = {} # Start Routine unless @started @pose = state if @battler.is_a?(Game_Enemy) if not $default_enemy if $default_enemy_id == nil # Set up Spritesheet Standards @width = @width / @frames @height = @height / @poses else if not $default_enemy_id.include?(@battler.id) @width = @width / @frames @height = @height / @poses end end end end if @battler.is_a?(Game_Actor) if not $default_actor if $default_actor_id == nil # Set up Spritesheet Standards @width = @width / @frames @height = @height / @poses else if not $default_actor_id.include?(@battler.id) @width = @width / @frames @height = @height / @poses end end end end @battler_offset = @width * 0.75 @display_x = @battler.screen_x @display_y = @battler.screen_y @display_z = @battler.screen_z @destination_x = @display_x @destination_y = @display_y @destination_z = @display_z self.opacity = 0 @started = true end # Cut Out Frame # Enemy Battler Routine if @battler.is_a?(Game_Enemy) if $default_enemy self.src_rect.set(@width * 0, @height * 0, @width, @height) else if $default_enemy_id !=nil if $default_enemy_id.include?(@battler.id) self.src_rect.set(@width * 0, @height * 0, @width, @height) else self.src_rect.set(@width * @frame, @height * @pose, @width, @height) end else self.src_rect.set(@width * @frame, @height * @pose, @width, @height) end end end # Actor Battler Routine if @battler.is_a?(Game_Actor) if $default_actor self.src_rect.set(@width * 0, @height * 0, @width, @height) else if $default_actor_id !=nil if $default_actor_id.include?(@battler.id) self.src_rect.set(@width * 0, @height * 0, @width, @height) else self.src_rect.set(@width * @frame, @height * @pose, @width, @height) end else self.src_rect.set(@width * @frame, @height * @pose, @width, @height) end end end # Position Sprite self.x = @display_x self.y = @display_y self.z = @display_z self.ox = @width / 2 self.oy = @height # Adjust sprite direction if facing the other way... if $sv_mirror == 1 if @battler.is_a?(Game_Actor) self.mirror = !!battler else if not @mirror_enemies self.mirror = !!battler end end else if @battler.is_a?(Game_Enemy) if @mirror_enemies self.mirror = !!battler end end end # Setup Frames per Pose poseframe = @frames_standard poseframe = @frames_per_pose[@pose] if @frames_per_pose.include?(@pose) # Set Advanced Poses for Actors if @battler.is_a?(Game_Actor) pose_temp = $poses_actor[@battler.id] if $poses_actor.include?(@battler.id) poseframe = pose_temp[@pose] if pose_temp.include?(@pose) end # Set Advanced Poses for Enemies if @battler.is_a?(Game_Enemy) pose_temp = $poses_enemy[@battler.id] if $poses_enemy.include?(@battler.id) poseframe = pose_temp[@pose] if pose_temp.include?(@pose) end # Setup Animation time = Graphics.frame_count / (Graphics.frame_rate / @speed) if @last_time < time @frame = (@frame + 1) % poseframe if @frame == 0 if @freeze @frame = poseframe - 1 return end @pose = state end end @last_time = time # Setup Dying Animation if @battler.dead? if @dying == true @pose = state @dying = false end else if @battler.is_a?(Game_Actor) if @poses_setup != nil if @s_pose == false @pose = @poses_setup @s_pose = true end end if $victory == true if @winning == true @pose = state @winning = false end end end end # Move It move if moving end #-------------------------------------------------------------------------- # * Current State #-------------------------------------------------------------------------- def state # Damage State if [nil,{}].include?(@battler.damage) # Battler Fine @state = $p1 # Battler Wounded @state = $p3 if @battler.hp < @battler.maxhp * @low_hp_percentage # Battler Status-Effect for i in @battler.states @state = @poses_status[i] if @poses_status.include?(i) end # If Battler Dead if @battler.dead? # If using default battlers or default collapse if (@default_collapse_actor and @battler.is_a?(Game_Actor)) or (@default_collapse_enemy and @battler.is_a?(Game_Enemy)) or ($default_actor and @battler.is_a?(Game_Actor)) or ($default_enemy and @battler.is_a?(Game_Enemy)) or ($default_enemy_id.include?(@battler.id) and @battler.is_a?(Game_Enemy)) or ($default_actor_id.include?(@battler.id) and @battler.is_a?(Game_Actor)) # Do absolutely nothing <img src='http://www.rmxpunlimited.net/forums/public/style_emoticons/<#EMO_DIR#>/smile.gif' class='bbc_emoticon' alt=':)' /> else # Use Poses system if @poses_dying != nil if @dying == true @state = @poses_dying else @state = $p11 end else @state = $p11 end # Fix Opacity self.opacity = 255 end end end # Casting State if $casted if @battler.rtp != 0 if @poses_casting != nil @state = @poses_casting end end end # Victory State if @battler.is_a?(Game_Actor) if $victory if @poses_winning != nil if @winning == true if not @battler.dead? @state = @poses_winning end else if not @battler.dead? @state = $p10 if not @poses_winning_loops.include?(@battler.id) @freeze = true end end end else if not @battler.dead? @state = $p10 if not @poses_winning_loops.include?(@battler.id) @freeze = true end end end end end # Guarding State (not if dead OR in victory) if not @battler.dead? if not $victory @state = $p4 if @battler.guarding? end end # Moving State if moving # Adjust sprite direction if facing the other way... if $sv_mirror == 1 # If enemy battler moving if @battler.is_a?(Game_Enemy) # Battler Moving Left @state = $p5 if moving.eql?(0) # Battler Moving Right @state = $p6 if moving.eql?(1) # Else actor battler moving else # Battler Moving Left @state = $p6 if moving.eql?(0) # Battler Moving Right @state = $p5 if moving.eql?(1) end else # If enemy battler moving if @battler.is_a?(Game_Enemy) # Battler Moving Left @state = $p6 if moving.eql?(0) # Battler Moving Right @state = $p5 if moving.eql?(1) # Else actor battler moving else # Battler Moving Left @state = $p5 if moving.eql?(0) # Battler Moving Right @state = $p6 if moving.eql?(1) end end end # Return State return @state end #-------------------------------------------------------------------------- # * Move #-------------------------------------------------------------------------- def move time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5)) if @last_move_time < time # Pause for Animation return if @pose != state # Phasing if @phasing d1 = (@display_x - @original_x).abs d2 = (@display_y - @original_y).abs d3 = (@display_x - @destination_x).abs d4 = (@display_y - @destination_y).abs self.opacity = [255 - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max end # Calculate Difference difference_x = (@display_x - @destination_x).abs difference_y = (@display_y - @destination_y).abs difference_z = (@display_z - @destination_z).abs # Done? Reset, Stop if [difference_x, difference_y].max.between?(0, 8) @display_x = @destination_x @display_y = @destination_y @display_z = @destination_z @pose = state return end # Calculate Movement Increments increment_x = increment_y = 1 if difference_x < difference_y increment_x = 1.0 / (difference_y.to_f / difference_x) elsif difference_y < difference_x increment_y = 1.0 / (difference_x.to_f / difference_y) end increment_z = increment_y # Calculate Movement Speed if @calculate_speed total = 0; $game_party.actors.each{ |actor| total += actor.agi } speed = @battler.agi.to_f / (total / $game_party.actors.size) increment_x *= speed increment_y *= speed increment_z *= speed end # Multiply and Move multiplier_x = (@destination_x - @display_x > 0 ? 8 : -8) multiplier_y = (@destination_y - @display_y > 0 ? 8 : -8) multiplier_z = (@destination_z - @display_z > 0 ? 8 : -8) @display_x += (increment_x * multiplier_x).to_i @display_y += (increment_y * multiplier_y).to_i @display_z += (increment_z * multiplier_z).to_i end @last_move_time = time end #-------------------------------------------------------------------------- # * Set Movement #-------------------------------------------------------------------------- def setmove(destination_x, destination_y, destination_z) unless (@battler.is_a?(Game_Enemy) and @stationary_enemies) or (@battler.is_a?(Game_Actor) and @stationary_actors) unless @stationary_weapons.include?(@battler.weapon_id) or @stationary_skills.include?(@skill_used) or @stationary_items.include?(@item_used) @original_x = @display_x @original_y = @display_y @original_z = @display_z @destination_x = destination_x @destination_y = destination_y @destination_z = destination_z end end end #-------------------------------------------------------------------------- # * Movement Check #-------------------------------------------------------------------------- def moving if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?) return (@display_x > @destination_x ? 0 : 1) end end #-------------------------------------------------------------------------- # * Set Pose #-------------------------------------------------------------------------- def pose=(pose) @pose = pose @frame = 0 end #-------------------------------------------------------------------------- # * Freeze #-------------------------------------------------------------------------- def freeze @freeze = true end #-------------------------------------------------------------------------- # * Fallen Pose #-------------------------------------------------------------------------- if @derv_anim_bat_stack.nil? @derv_anim_bat_stack = true alias cbs_collapse collapse def collapse if @default_collapse_enemy cbs_collapse if @battler.is_a?(Game_Enemy) end if @default_collapse_actor cbs_collapse if @battler.is_a?(Game_Actor) end if $default_enemy cbs_collapse if @battler.is_a?(Game_Enemy) end if $default_actor cbs_collapse if @battler.is_a?(Game_Actor) end if $default_enemy_id != nil if $default_enemy_id.include?(@battler.id) cbs_collapse if @battler.is_a?(Game_Enemy) end end if $defend_actor.id != nil if $default_actor_id.include?(@battler.id) cbs_collapse if @battler.is_a?(Game_Actor) end end end endend #============================================================================== # ** Game_System#------------------------------------------------------------------------------# This class handles data surrounding the system. Backround music, etc.# is managed here as well. Refer to "$game_system" for the instance of # this class.#==============================================================================class Game_System #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_accessor :sideview_mirror #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias initialize_cbs_customize initialize def initialize # Call original initialization process initialize_cbs_customize @sideview_mirror = 0 endend #==============================================================================# ** Game_Actor#------------------------------------------------------------------------------# This class handles the actor. It's used within the Game_Actors class# ($game_actors) and refers to the Game_Party class ($game_party).#==============================================================================class Game_Actor #-------------------------------------------------------------------------- # * Actor X Coordinate #-------------------------------------------------------------------------- def screen_x # Determine minimum horizontal space between battlers x_spacer = $formation_width / $max_member if self.index != nil case $formation when 0 # DIAGONAL PATTERN 1 if $sv_mirror == 1 return self.index * -x_spacer + (($max_member+1)*x_spacer) #202 else return self.index * x_spacer + (640-(($max_member+1)*x_spacer))#450 end when 1 # DIAGONAL PATTERN 2 if $sv_mirror == 1 return self.index * x_spacer + x_spacer #64 else return self.index * -x_spacer + (640-x_spacer*2) #576 end when 2 # 2-ROW SLANT if $sv_mirror == 1 if self.index < ($max_member/2) return self.index + (($max_member+1)*x_spacer) + (x_spacer * self.index) else return self.index + (x_spacer * self.index) - x_spacer * 0.5 end else if self.index < ($max_member/2) return self.index + (640-(($max_member+1)* x_spacer)) + (-x_spacer * self.index) else return self.index + (640-((x_spacer*0.5)-x_spacer)) + (-x_spacer * self.index) end end when 3 # 2 ROW - SLANT if $sv_mirror == 1 if self.index < ($max_member/2) return self.index + (x_spacer/2)+(($max_member+1)* x_spacer) + (-x_spacer * self.index) else return self.index + (($max_member+1)* x_spacer) + (-x_spacer * self.index) end else if self.index < ($max_member/2) return self.index + 442 + (x_spacer * self.index) else return self.index + 430 + (x_spacer * self.index) end end when 4 # Column Pattern 1 if $sv_mirror == 1 if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 ) return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1)) else return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index) end else if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 ) return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1)) else return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index) end end when 5 # Column Pattern 2 if $sv_mirror == 1 if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 ) return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * (self.index-1)) else return self.index + ($max_member*(x_spacer*1.5)) + (-(x_spacer*1.5) * self.index) end else if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 ) return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * (self.index-1)) else return self.index + 640-($max_member*(x_spacer*1.5)) + ((x_spacer*1.5) * self.index) end end when 6 # Wave Formation 1 if $sv_mirror == 1 if self.index < ($max_member/2) return 170 else return 90 end else if self.index < ($max_member/2) return 470 else return 550 end end else # Wave Formation 2 if $sv_mirror == 1 if self.index < ($max_member/2) return 170 else return 90 end else if self.index < ($max_member/2) return 470 else return 550 end end end else return 0 end end #-------------------------------------------------------------------------- # * Actor Y Coordinate #-------------------------------------------------------------------------- def screen_y # Determine minimum vertical space between battlers y_spacer = (480 - $battlestat_height - $formation_top) / $max_member if self.index != nil case $formation when 0 return self.index * (y_spacer*1.25) + $formation_top when 1 return self.index * (y_spacer*1.25) + $formation_top when 2 if self.index < ($max_member/2) return $formation_top + ((y_spacer*2.5) * self.index) else return ($formation_top - (y_spacer*($max_member+1))) + ((y_spacer*2.5) * self.index) #was 60 end when 3 if self.index < ($max_member/2) return $formation_top + ((y_spacer*2.5) * self.index) else return ($formation_top - (y_spacer*($max_member+1))) + ((y_spacer*2.5) * self.index) # was 60 end when 4 if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 ) return $formation_top + ($battlestat_height/2) else return $formation_top + ($battlestat_height/6) end when 5 if ((self.index + 1) / 2) >= (((self.index + 1).to_f) / 2 ) return $formation_top + ($battlestat_height/6) else return $formation_top + ($battlestat_height /2) end when 6 if self.index < ($max_member/2) return $formation_top + (y_spacer * 2.5 * self.index) else return $formation_top + (y_spacer * 2.5 * ((self.index) - ($max_member/2))) end else if self.index < ($max_member/2) return $formation_top + (y_spacer*2.5*(($max_member/2)-1))+ (y_spacer * 2.5 * -self.index) else return $formation_top + (y_spacer*2.5*(($max_member/2)-1)) + (y_spacer * 2.5 * -((self.index) - ($max_member/2))) end end end end #-------------------------------------------------------------------------- # * Actor Z Coordinate #-------------------------------------------------------------------------- def screen_z return screen_y endend#==============================================================================# ** Game_Enemy#------------------------------------------------------------------------------# This class handles enemies. It's used within the Game_Troop class# ($game_troop).#==============================================================================class Game_Enemy < Game_Battler def screen_x if self.index != nil if $sv_mirror == 1 return 640 - $data_troops[@troop_id].members[@member_index].x else return $data_troops[@troop_id].members[@member_index].x end end endend #==============================================================================# ** Scene_Battle #------------------------------------------------------------------------------ # This class performs battle screen processing.#==============================================================================class Scene_Battle #-------------------------------------------------------------------------- # * Make Skill Action Results (alias used to determine skill used) #-------------------------------------------------------------------------- alias make_skill_action_result_anim make_skill_action_result def make_skill_action_result(battler = @active_battler, plus_id = 0) @rtab = !@target_battlers if $RTAB_Connected_Attacking make_skill_action_result_anim(battler, plus_id) else @rtab ? make_skill_action_result_anim(battler) : make_skill_action_result_anim end @skill_used = @skill.id end #-------------------------------------------------------------------------- # * Make Item Action Results (alias used to determine item used) #-------------------------------------------------------------------------- alias make_item_action_result_anim make_item_action_result def make_item_action_result(battler = @active_battler) @rtab = !@target_battlers @rtab ? make_item_action_result_anim(battler) : make_item_action_result_anim @item_used = @item.id @item_usage = @item.scope end #-------------------------------------------------------------------------- # * Frame Update (main phase step 1 : action preparation) (Casting Routine) #-------------------------------------------------------------------------- alias update_phase4_step1_anim update_phase4_step1 def update_phase4_step1(battler = @active_battler) @rtab = !@target_battlers if $rtab_detected == true update_phase4_step1_anim(battler) if battler.current_action.kind == 1 and (not battler.current_action.forcing or @force != 2) if battler.rtp != 0 $casted = true end end else update_phase4_step1_anim end end #-------------------------------------------------------------------------- # * Action Animation, Movement #-------------------------------------------------------------------------- alias cbs_update_phase4_step3 update_phase4_step3 def update_phase4_step3(battler = @active_battler) @rtab = !@target_battlers target = (@rtab ? battler.target : @target_battlers)[0] # If enemy is a default battler if battler.is_a?(Game_Enemy) if $default_enemy if @rtab then battler.white_flash = true end if @rtab then battler.wait = 10 end end if $default_enemy_id != nil if $default_enemy_id.include?(@battler.id) if @rtab then battler.white_flash = true end if @rtab then battler.wait = 10 end end end end # If actor is a default battler if battler.is_a?(Game_Actor) if $default_actor if @rtab then battler.white_flash = true end if @rtab then battler.wait = 10 end end if $default_actor_id != nil if $default_actor_id.include?(@battler.id) if @rtab then battler.white_flash = true end if @rtab then battler.wait = 10 end end end end # Set values and poses based on Action case battler.current_action.kind when 0 # Attack rush_type = $rush_attack full_moving = true; if rush_type; full_moving = false; end if $move2center_atk.include?(battler.weapon_id); center_move=true; end if $stationary_enemyid.include?(battler.id) and battler.is_a?(Game_Enemy) full_moving = false center_move = false rush_type = false end if battler.current_action.basic == 2 # If escaping, disable all movement full_moving = false center_move = false rush_type = false end base_pose = $p7 base_pose = $poses_weapons[battler.weapon_id] if $poses_weapons.include?(battler.weapon_id) if battler.current_action.basic == 2 base_pose = $poses_escaping if $poses_escaping != nil end when 1 # Skill rush_type = $rush_skill if $moving_skill_atk.include?(@skill_used); full_moving = true; end if $move2center_skill.include?(@skill_used); center_move = true; end base_pose = $p9 base_pose = $poses_skills[@skill_used] if $poses_skills.include?(@skill_used) when 2 # Item rush_type = $rush_item if $moving_item_atk.include?(@item_used) or @item_scope == 1..2; full_moving = true; end if $move2center_item.include?(@item_used); center_move = true; end base_pose = $p8 base_pose = $poses_items[@item_used] if $poses_items.include?(@item_used) end # Control Movement and use current pose @moved = {} unless @moved return if @spriteset.battler(battler).moving if not (@moved[battler] or battler.guarding?) offset = offset_value(battler) if rush_type # Steps forward @spriteset.battler(battler).setmove(battler.screen_x - offset, battler.screen_y + 1, battler.screen_z) end if full_moving # Runs to target @spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y - 1, target.screen_z + 10) end if center_move # Runs to center @spriteset.battler(battler).setmove(320+(offset/4), battler.screen_y-1, battler.screen_z) end @moved[battler] = true return @spriteset.battler(battler).pose = base_pose elsif not battler.guarding? @spriteset.battler(battler).pose = base_pose @spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y, battler.screen_z) end # Finish Up Skill and Item Use case battler.current_action.kind when 1 # Flag system that skill was used $casted = false $casting = false @spriteset.battler(battler).skill_used = 0 when 2 # Flag system that item was used @spriteset.battler(battler).item_used = 0 end # Battle_Charge value for BattleCry script $battle_charge = true # Done @moved[battler] = false @rtab ? cbs_update_phase4_step3(battler) : cbs_update_phase4_step3 end #-------------------------------------------------------------------------- # * Offset Calculation #-------------------------------------------------------------------------- def offset_value(battler = @active_battler) offst = @spriteset.battler(battler).battler_offset offst += $rush_offset if $sv_mirror == 1 offset = (battler.is_a?(Game_Actor) ? -(offst) : offst) else offset = (battler.is_a?(Game_Actor) ? offst : -(offst)) end return offset end #-------------------------------------------------------------------------- # * Hit Animation #-------------------------------------------------------------------------- alias cbs_update_phase4_step4 update_phase4_step4 def update_phase4_step4(battler = @active_battler) for target in (@rtab ? battler.target : @target_battlers) damage = (@rtab ? target.damage[battler] : target.damage) critical = (@rtab ? target.critical[battler] : target.critical) if damage.is_a?(Numeric) and damage > 0 @spriteset.battler(target).pose = $p2 if critical == true @spriteset.battler(target).pose = $poses_critical if $poses_critical != nil end end end @rtab ? cbs_update_phase4_step4(battler) : cbs_update_phase4_step4 end #-------------------------------------------------------------------------- # * Victory Animation #-------------------------------------------------------------------------- alias cbs_start_phase5 start_phase5 def start_phase5 for actor in $game_party.actors return if @spriteset.battler(actor).moving end for actor in $game_party.actors unless actor.dead? $victory = true end end cbs_start_phase5 end #-------------------------------------------------------------------------- # * Change Arrow Viewport #-------------------------------------------------------------------------- alias cbs_start_enemy_select start_enemy_select def start_enemy_select cbs_start_enemy_select @enemy_arrow.dispose @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2) @enemy_arrow.help_window = @help_window endend#============================================================================== # ** Spriteset_Battle#------------------------------------------------------------------------------# This class brings together battle screen sprites. It's used within# the Scene_Battle class.#==============================================================================class Spriteset_Battle #-------------------------------------------------------------------------- # * Change Enemy Viewport #-------------------------------------------------------------------------- alias cbs_initialize initialize def initialize cbs_initialize if @real_zoom != nil $rtab_detected = true end @enemy_sprites = [] for enemy in $game_troop.enemies.reverse @enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy)) end end #-------------------------------------------------------------------------- # * Find Sprite From Battler Handle #-------------------------------------------------------------------------- def battler(handle) for sprite in @actor_sprites + @enemy_sprites return sprite if sprite.battler == handle end endend#==============================================================================# ** Arrow_Base#------------------------------------------------------------------------------# This sprite is used as an arrow cursor for the battle screen. This class# is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.#==============================================================================class Arrow_Base < Sprite #-------------------------------------------------------------------------- # * Reposition Arrows #-------------------------------------------------------------------------- alias cbs_initialize initialize def initialize(viewport) cbs_initialize(viewport) self.ox = 14 self.oy = 10 endend
And name this one as Damage_Effects
#===================================# Damage#---------------------------------------------------------------# Script by Corbaque#---------------------------------------------------------------# 19/08/2006#---------------------------------------------------------------# Modification of the posting of damage#---------------------------------------------------------------# Version 1.0#===================================module RPG FONT_OF_LETTERS = "Arial" COLOR_OF_LETTER = Color.new(255, 255, 255) COLOR_OF_CONTOUR = Color.new(0, 0, 0) #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Sprite #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= class Sprite < ::Sprite @@_animations = [] @@_reference_count = {} def initialize(viewport = nil) super(viewport) @_whiten_duration = 0 @_appear_duration = 0 @_escape_duration = 0 @_collapse_duration = 0 @_damage_duration = 0 @_animation_duration = 0 @_blink = false end def dispose dispose_damage dispose_animation dispose_loop_animation super end def whiten self.blend_type = 0 self.color.set(255, 255, 255, 128) self.opacity = 255 @_whiten_duration = 16 @_appear_duration = 0 @_escape_duration = 0 @_collapse_duration = 0 end def appear self.blend_type = 0 self.color.set(0, 0, 0, 0) self.opacity = 0 @_appear_duration = 16 @_whiten_duration = 0 @_escape_duration = 0 @_collapse_duration = 0 end def escape self.blend_type = 0 self.color.set(0, 0, 0, 0) self.opacity = 255 @_escape_duration = 32 @_whiten_duration = 0 @_appear_duration = 0 @_collapse_duration = 0 end def collapse self.blend_type = 1 self.color.set(255, 64, 64, 255) self.opacity = 255 @_collapse_duration = 48 @_whiten_duration = 0 @_appear_duration = 0 @_escape_duration = 0 end #----------------------------------------------------------- # Damage #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - value = number or string... # - critical = true/false #----------------------------------------------------------- def damage(value, critical) # Delete last damage dispose_damage # Translate value into string if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end # Defined bitmap bitmap = Bitmap.new(160, 48) bitmap.font.name = FONT_OF_LETTERS bitmap.font.size = 32 bitmap.font.color = COLOR_OF_CONTOUR bitmap.draw_text(-1, 12, 160, 36, damage_string, 1) bitmap.draw_text(0, 13, 160, 36, damage_string, 1) bitmap.draw_text(1, 13, 160, 36, damage_string, 1) bitmap.draw_text(1, 12, 160, 36, damage_string, 1) if value.is_a?(Numeric) and value < 0 bitmap.font.color.set(176, 255, 144) else bitmap.font.color = COLOR_OF_LETTER end bitmap.draw_text(0, 12, 160, 36, damage_string, 1) if critical bitmap.font.size = 20 bitmap.font.color = COLOR_OF_CONTOUR bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1) bitmap.font.color = COLOR_OF_LETTER bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end # D?finition du sprite @_damage_sprite = ::Sprite.new(self.viewport) @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 @_damage_sprite.oy = 20 @_damage_sprite.x = self.x @_damage_sprite.y = self.y - self.oy / 2 @_damage_sprite.z = 3000 @_damage_sprite.zoom_x = 0 @_damage_sprite.zoom_y = 0 @_damage_duration = 40 end def animation(animation, hit) dispose_animation @_animation = animation return if @_animation == nil @_animation_hit = hit @_animation_duration = @_animation.frame_max animation_name = @_animation.animation_name animation_hue = @_animation.animation_hue bitmap = RPG::Cache.animation(animation_name, animation_hue) if @@_reference_count.include?(bitmap) @@_reference_count[bitmap] += 1 else @@_reference_count[bitmap] = 1 end @_animation_sprites = [] if @_animation.position != 3 or not @@_animations.include?(animation) for i in 0..15 sprite = ::Sprite.new(self.viewport) sprite.bitmap = bitmap sprite.visible = false @_animation_sprites.push(sprite) end unless @@_animations.include?(animation) @@_animations.push(animation) end end update_animation end def loop_animation(animation) return if animation == @_loop_animation dispose_loop_animation @_loop_animation = animation return if @_loop_animation == nil @_loop_animation_index = 0 animation_name = @_loop_animation.animation_name animation_hue = @_loop_animation.animation_hue bitmap = RPG::Cache.animation(animation_name, animation_hue) if @@_reference_count.include?(bitmap) @@_reference_count[bitmap] += 1 else @@_reference_count[bitmap] = 1 end @_loop_animation_sprites = [] for i in 0..15 sprite = ::Sprite.new(self.viewport) sprite.bitmap = bitmap sprite.visible = false @_loop_animation_sprites.push(sprite) end update_loop_animation end def dispose_damage if @_damage_sprite != nil @_damage_sprite.bitmap.dispose @_damage_sprite.dispose @_damage_sprite = nil @_damage_duration = 0 end end def dispose_animation if @_animation_sprites != nil sprite = @_animation_sprites[0] if sprite != nil @@_reference_count[sprite.bitmap] -= 1 if @@_reference_count[sprite.bitmap] == 0 sprite.bitmap.dispose end end for sprite in @_animation_sprites sprite.dispose end @_animation_sprites = nil @_animation = nil end end def dispose_loop_animation if @_loop_animation_sprites != nil sprite = @_loop_animation_sprites[0] if sprite != nil @@_reference_count[sprite.bitmap] -= 1 if @@_reference_count[sprite.bitmap] == 0 sprite.bitmap.dispose end end for sprite in @_loop_animation_sprites sprite.dispose end @_loop_animation_sprites = nil @_loop_animation = nil end end def blink_on unless @_blink @_blink = true @_blink_count = 0 end end def blink_off if @_blink @_blink = false self.color.set(0, 0, 0, 0) end end def blink? @_blink end def effect? @_whiten_duration > 0 or @_appear_duration > 0 or @_escape_duration > 0 or @_collapse_duration > 0 or @_damage_duration > 0 or @_animation_duration > 0 end #----------------------------------------------------------- # Update #----------------------------------------------------------- def update # Update sprite super ################################# # \/ Other elements update's \/ # ################################# if @_whiten_duration > 0 @_whiten_duration -= 1 self.color.alpha = 128 - (16 - @_whiten_duration) * 10 end if @_appear_duration > 0 @_appear_duration -= 1 self.opacity = (16 - @_appear_duration) * 16 end if @_escape_duration > 0 @_escape_duration -= 1 self.opacity = 256 - (32 - @_escape_duration) * 10 end if @_collapse_duration > 0 @_collapse_duration -= 1 self.opacity = 256 - (48 - @_collapse_duration) * 6 end ################################# if @_damage_duration > 0 @_damage_duration -= 1 case @_damage_duration when 28..39 # Move sprite @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math: <img src='http://www.rmxpunlimited.net/forums/public/style_emoticons/<#EMO_DIR#>/tongue.gif' class='bbc_emoticon' alt=':P' /> I / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: <img src='http://www.rmxpunlimited.net/forums/public/style_emoticons/<#EMO_DIR#>/tongue.gif' class='bbc_emoticon' alt=':P' /> I / 5) @_damage_sprite.zoom_x += 0.1 @_damage_sprite.zoom_y += 0.1 end # opacity transition @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32 # Delete sprite if animation is terminate if @_damage_duration == 0 dispose_damage end end ################################# # \/ Other elements update's \/ # ################################# if @_animation != nil and (Graphics.frame_count % 2 == 0) @_animation_duration -= 1 update_animation end if @_loop_animation != nil and (Graphics.frame_count % 2 == 0) update_loop_animation @_loop_animation_index += 1 @_loop_animation_index %= @_loop_animation.frame_max end if @_blink @_blink_count = (@_blink_count + 1) % 32 if @_blink_count < 16 alpha = (16 - @_blink_count) * 6 else alpha = (@_blink_count - 16) * 6 end self.color.set(255, 255, 255, alpha) end @@_animations.clear ################################# end def update_animation if @_animation_duration > 0 frame_index = @_animation.frame_max - @_animation_duration cell_data = @_animation.frames[frame_index].cell_data position = @_animation.position animation_set_sprites(@_animation_sprites, cell_data, position) for timing in @_animation.timings if timing.frame == frame_index animation_process_timing(timing, @_animation_hit) end end else dispose_animation end end def update_loop_animation frame_index = @_loop_animation_index cell_data = @_loop_animation.frames[frame_index].cell_data position = @_loop_animation.position animation_set_sprites(@_loop_animation_sprites, cell_data, position) for timing in @_loop_animation.timings if timing.frame == frame_index animation_process_timing(timing, true) end end end def animation_set_sprites(sprites, cell_data, position) for i in 0..15 sprite = sprites[i] pattern = cell_data[i, 0] if sprite == nil or pattern == nil or pattern == -1 sprite.visible = false if sprite != nil next end sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) if position == 3 if self.viewport != nil sprite.x = self.viewport.rect.width / 2 sprite.y = self.viewport.rect.height - 160 else sprite.x = 320 sprite.y = 240 end else sprite.x = self.x - self.ox + self.src_rect.width / 2 sprite.y = self.y - self.oy + self.src_rect.height / 2 sprite.y -= self.src_rect.height / 4 if position == 0 sprite.y += self.src_rect.height / 4 if position == 2 end sprite.x += cell_data[i, 1] sprite.y += cell_data[i, 2] sprite.z = 2000 sprite.ox = 96 sprite.oy = 96 sprite.zoom_x = cell_data[i, 3] / 100.0 sprite.zoom_y = cell_data[i, 3] / 100.0 sprite.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end def animation_process_timing(timing, hit) if (timing.condition == 0) or (timing.condition == 1 and hit == true) or (timing.condition == 2 and hit == false) if timing.se.name != "" se = timing.se Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch) end case timing.flash_scope when 1 self.flash(timing.flash_color, timing.flash_duration * 2) when 2 if self.viewport != nil self.viewport.flash(timing.flash_color, timing.flash_duration * 2) end when 3 self.flash(nil, timing.flash_duration * 2) end end end def x=(x) sx = x - self.x if sx != 0 if @_animation_sprites != nil for i in 0..15 @_animation_sprites[i].x += sx end end if @_loop_animation_sprites != nil for i in 0..15 @_loop_animation_sprites[i].x += sx end end end super end def y=(y) sy = y - self.y if sy != 0 if @_animation_sprites != nil for i in 0..15 @_animation_sprites[i].y += sy end end if @_loop_animation_sprites != nil for i in 0..15 @_loop_animation_sprites[i].y += sy end end end super end endend



















