isaacsol 10 Report post Posted August 28, 2007 Instructions 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 :D . 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: [url="http://www4.big.or.jp/~fukuyama/rgss/Battle_End_Recovery.txt"]http://www4.big.or.jp/~fukuyama/rgss/Battle_End_Recovery.txt[/url] # module Battle_End_Recovery module 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 end end end # module Scene_Battle_Module end # module Battle_End_Recovery #------------------------------ # ???V?[???????` #------------------------------ class Scene_Battle # Scene_Battle?p???W???[?????C???N???[?h include 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_phase5 end end # 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 = false refresh(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.clear self.contents.font.color = system_color self.contents.font.name = "Arial" self.contents.font.size = 14 self.contents.draw_text( 0, 0, 160, 24, "LEVEL UP!!") self.contents.font.size = 18 self.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 = 14 self.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_color self.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 = 20 self.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) end end #============================================================================== # ?? 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 initialize def initialize @exp_gain_ban = false xrxs_bp10_initialize end #-------------------------------------------------------------------------- # ?? ?X?e?[?g [EXP ???l????????] ???? #-------------------------------------------------------------------------- alias xrxs_bp10_cant_get_exp? cant_get_exp? def cant_get_exp? if @exp_gain_ban == true return true else return xrxs_bp10_cant_get_exp? end end end #============================================================================== # ?? Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ?? ?A?t?^?[?o?g???t?F?[?Y?J?n #-------------------------------------------------------------------------- alias xrxs_bp10_start_phase5 start_phase5 def start_phase5 # EXP ?l????~ for i in 0...$game_party.actors.size $game_party.actors[i].exp_gain_ban = true end xrxs_bp10_start_phase5 # EXP ?l????~????? for i in 0...$game_party.actors.size $game_party.actors[i].exp_gain_ban = false end # EXP???????? @exp_gained = 0 for enemy in $game_troop.enemies # ?l?? EXP????? # ?G?l?~?[???B??????????? @exp_gained += enemy.exp if not enemy.hidden end # ??? @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_levelup end #-------------------------------------------------------------------------- # ?? ?t???[???X?V (?A?t?^?[?o?g???t?F?[?Y) #-------------------------------------------------------------------------- alias xrxs_bp10_update_phase5 update_phase5 def update_phase5 case @phase5_step when 1 update_phase5_step1 else xrxs_bp10_update_phase5 # ???x???A?b?v???????????????o?g???I?? battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0 end end #-------------------------------------------------------------------------- # ?? ?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_levelup end end #-------------------------------------------------------------------------- # ?? ????A?N?^?[????x???A?b?v?\???? #-------------------------------------------------------------------------- def phase5_next_levelup begin # ????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 end end until false end end # ?????? 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_effect def slip_damage_effect # ???l??????? slip_damage_percent = 0 slip_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 end end if slip_damage_percent == 0 and slip_damage_plus == 0 xrxs_bp7_slip_damage_effect else # ?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 true end end end # ?????? 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) end for battler in @count_battlers @agi_total += battler.agi end for battler in @count_battlers battler.cp = [[65535 * (rand(15) + 85) / 100 * battler.agi / @agi_total * 4, 0].max, 65535].min end end #---------------------------------------------------------------------------- # ?? CP?J?E???g??J?n #---------------------------------------------------------------------------- def start if @cp_thread != nil then return end @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 end end # ???????X???b?h end #---------------------------------------------------------------------------- # ?? CP?J?E???g?A?b?v #---------------------------------------------------------------------------- def update if @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 end end end #---------------------------------------------------------------------------- # ?? CP?J?E???g??J?n #---------------------------------------------------------------------------- def stop @cancel = true if @cp_thread != nil then @cp_thread.join @cp_thread = nil end end end #============================================================================== # ?? Game_Battler #============================================================================== class Game_Battler attr_accessor :now_guarding # ????h???t???O attr_accessor :cp # ????CP attr_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_ban return xrxs_bp1_slip_damage? end #-------------------------------------------------------------------------- # ?? ?X?e?[?g???R???? (?^?[?????????o??) #-------------------------------------------------------------------------- alias xrxs_bp1_remove_states_auto remove_states_auto def remove_states_auto return if @slip_state_update_ban xrxs_bp1_remove_states_auto end end #============================================================================== # ?? Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ?? ?Z?b?g?A?b?v #-------------------------------------------------------------------------- alias xrxs_bp1_setup setup def setup(actor_id) xrxs_bp1_setup(actor_id) @hate = 100 # init-value is 100 @cp = 0 @now_guarding = false @slip_state_update_ban = false end end #============================================================================== # ?? Game_Enemy #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ?? ?I?u?W?F?N?g?????? #-------------------------------------------------------------------------- alias xrxs_bp1_initialize initialize def 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 = false end end #============================================================================== # ?? 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 initialize def initialize @update_cp_only = false xrxs_bp1_initialize end #-------------------------------------------------------------------------- # ?? ???t???b?V?? #-------------------------------------------------------------------------- alias xrxs_bp1_refresh refresh def refresh if @update_cp_only == false xrxs_bp1_refresh end for 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) end end #-------------------------------------------------------------------------- # ?? CP???[?^?[ ??`?? #-------------------------------------------------------------------------- def draw_actor_cp_meter(actor, x, y, width = 156, type = 0) self.contents.font.color = system_color self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255)) if actor.cp == nil actor.cp = 0 end w = width * [actor.cp,65535].min / 65535 self.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)) end end #============================================================================== # ?? 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_end def battle_end(result) # CP?J?E???g???~ @cp_thread.stop xrxs_bp1_battle_end(result) end #-------------------------------------------------------------------------- # ?? ?v???o?g???t?F?[?Y?J?n #-------------------------------------------------------------------------- alias xrxs_bp1_start_phase1 start_phase1 def start_phase1 @agi_total = 0 @cp_thread = Scene_Battle_CP.new # ?A?N?^?[?R?}???h?E?B???h?E????? s1 = $data_system.words.attack s2 = $data_system.words.skill s3 = $data_system.words.guard s4 = $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_phase1 end #-------------------------------------------------------------------------- # ?? ?p?[?e?B?R?}???h?t?F?[?Y?J?n #-------------------------------------------------------------------------- alias xrxs_bp1_start_phase2 start_phase2 def start_phase2 xrxs_bp1_start_phase2 @party_command_window.active = false @party_command_window.visible = false # ???? start_phase3 end #-------------------------------------------------------------------------- # ?? ?t???[???X?V (?p?[?e?B?R?}???h?t?F?[?Y) #-------------------------------------------------------------------------- alias xrxs_bp1_update_phase2 update_phase2 def 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 return end xrxs_bp1_update_phase2 end #-------------------------------------------------------------------------- # ?? ????A?N?^?[??R?}???h????? #-------------------------------------------------------------------------- def phase3_next_actor # ???[?v begin # ?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??????????????????x end 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 = false phase3_setup_command_window end #-------------------------------------------------------------------------- # ?? ?O??A?N?^?[??R?}???h????? #-------------------------------------------------------------------------- def phase3_prior_actor # ???[?v begin # ?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??????????????????x end 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 = false phase3_setup_command_window end #-------------------------------------------------------------------------- # ?? ?A?N?^?[?R?}???h?E?B???h?E??Z?b?g?A?b?v #-------------------------------------------------------------------------- alias xrxs_bp1_phase3_setup_command_window phase3_setup_command_window def phase3_setup_command_window # ????????? Audio.se_play($data_system_command_up_se) if $data_system_command_up_se != "" # ??? xrxs_bp1_phase3_setup_command_window end #-------------------------------------------------------------------------- # ?? ?t???[???X?V (?A?N?^?[?R?}???h?t?F?[?Y : ???{?R?}???h) #-------------------------------------------------------------------------- alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command def 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 end end xrxs_bsp1_update_phase3_basic_command end #-------------------------------------------------------------------------- # ?? ???C???t?F?[?Y?J?n #-------------------------------------------------------------------------- alias xrxs_bp1_start_phase4 start_phase4 def start_phase4 xrxs_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_action end # ?s???????? make_action_orders end #-------------------------------------------------------------------------- # ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 1 : ?A?N?V????????) #-------------------------------------------------------------------------- alias xrxs_bp1_update_phase4_step1 update_phase4_step1 def update_phase4_step1 # ?????? @phase4_act_continuation = 0 # ???s???? if judge @cp_thread.stop # ?????????s?k??? : ???\?b?h?I?? return end # ???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 != nil end #-------------------------------------------------------------------------- # ?? ?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_step2 def 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 end end # ?A?N?V????????????? case @active_battler.current_action.kind when 0 # ?U????h???E???????E???????????????????CP @active_battler.cp -= 0 if @phase4_act_continuation == 0 when 1 # ?X?L???g?p???????CP @active_battler.cp -= 65535 if @phase4_act_continuation == 0 when 2 # ?A?C?e???g?p???????CP @active_battler.cp -= 65535 if @phase4_act_continuation == 0 when -1 # CP????????????? @phase4_step = 6 return end # CP???Z???????~???? @cp_thread.stop = true # ?X?e?[?g???R???? @active_battler.remove_states_auto xrxs_bp1_update_phase4_step2 end #-------------------------------------------------------------------------- # ?? ???{?A?N?V???? ????? #-------------------------------------------------------------------------- alias xrxs_bp1_make_basic_action_result make_basic_action_result def 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 return end xrxs_bp1_make_basic_action_result end #-------------------------------------------------------------------------- # ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 5 : ?_???[?W?\??) #-------------------------------------------------------------------------- alias xrxs_bp1_update_phase4_step5 update_phase4_step5 def update_phase4_step5 # ?X???b?v?_???[?W if @active_battler.hp > 0 and @active_battler.slip_damage? @active_battler.slip_damage_effect @active_battler.damage_pop = true end xrxs_bp1_update_phase4_step5 end #-------------------------------------------------------------------------- # ?? ?t???[???X?V (???C???t?F?[?Y ?X?e?b?v 6 : ???t???b?V??) #-------------------------------------------------------------------------- alias xrxs_bp1_update_phase4_step6 update_phase4_step6 def update_phase4_step6 # CP???Z????J???? @cp_thread.stop = false # ?w???v?E?B???h?E???B?? @help_window.visible = false xrxs_bp1_update_phase4_step6 end end # ?????? 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 initialize def initialize xrxs_bp7_initialize # ??Full-View?????????s?? # ????????????????B #self.opacity = 0 #self.back_opacity = 0 end #-------------------------------------------------------------------------- # ?? ???t???b?V?? #-------------------------------------------------------------------------- alias xrxs_bp7_refresh refresh def refresh if @update_cp_only xrxs_bp7_refresh return end # ?`?????~?????????? @draw_ban = true xrxs_bp7_refresh # ?`????~?????? @draw_ban = false # ?`????J?n @item_max = $game_party.actors.size for 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) end end end #============================================================================== # ?? 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.maxhp hp_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 -= 1 y += (height/4).floor self.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 -= 1 y += (height/4).ceil self.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 -= 1 y += (height/4).ceil 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) end #-------------------------------------------------------------------------- # ?? SP???[?^?[ ??`?? #-------------------------------------------------------------------------- def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4) w = width * actor.sp / actor.maxsp hp_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 -= 1 y += (height/4).floor self.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 -= 1 y += (height/4).ceil self.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 -= 1 y += (height/4).ceil 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) end #-------------------------------------------------------------------------- # ?? ???O??`?? #-------------------------------------------------------------------------- alias xrxs_bp7_draw_actor_name draw_actor_name def draw_actor_name(actor, x, y) xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true end #-------------------------------------------------------------------------- # ?? ?X?e?[?g??`?? #-------------------------------------------------------------------------- alias xrxs_bp7_draw_actor_state draw_actor_state def draw_actor_state(actor, x, y, width = 120) xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true end #-------------------------------------------------------------------------- # ?? HP ??`?? #-------------------------------------------------------------------------- alias xrxs_bp7_draw_actor_hp draw_actor_hp def draw_actor_hp(actor, x, y, width = 144) xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true end #-------------------------------------------------------------------------- # ?? SP ??`?? #-------------------------------------------------------------------------- alias xrxs_bp7_draw_actor_sp draw_actor_sp def draw_actor_sp(actor, x, y, width = 144) xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true end end #============================================================================== # ?? ?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????????B distance = (start_x - end_x).abs + (start_y - end_y).abs # ?`??J?n if 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) end else 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)) end end end #-------------------------------------------------------------------------- # ?? ?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 = color self.contents.draw_text(x, y, width, height, string, align) end end 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 :) ) # 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 :) 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 end end #============================================================================== # ** 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 end end #============================================================================== # ** 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 end end #============================================================================== # ** 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 end end #============================================================================== # ** 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 end end #============================================================================== # ** 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 end end #============================================================================== # ** 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 end end 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: :P I / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: :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 end end Share this post Link to post Share on other sites
Snow_Spartan 0 Report post Posted August 29, 2007 Hi, sorry to bother you however i need a bit of help on the scripting i am new here and im not too good with RPG Maker XP im ok but not really good i copied and pasted your script into a blank script in between System_Debug and Main. but when i went to play test it came up with this error message.... " Script ' ' Line 2555: syntaxError occurred " then the game test box shuts itself down could you or anyone help me so i can have the sideview battle system in my game sorry i know i am a noob :P thanks Share this post Link to post Share on other sites
Ghost Member 0 Report post Posted August 29, 2007 yup there is a an error line 271 in the damage section but it's easily fixed just check what the error says I only had two. but the one you mentioned sounds like you haven't made 3 separate scripts sounds like you copied it all in one and pasted it in one, there are 3 parts all named differently read this page again and look close, there are 3 sections, new battle, animated battlers enhanced, and the damage one. good script by the way, Im working on one now and it's a bit like yours in terms of using sprites instead of battlers and it being sideways, but I only use one script. Share this post Link to post Share on other sites
Snow_Spartan 0 Report post Posted August 29, 2007 Well i made 3 seperate scripts and named them like they are supposed to be but now like you said Arbiter i got line 271 damage effects syntaxerror, how do you fix it? sorry i dont know much about scripting thanks Share this post Link to post Share on other sites
Ghost Member 0 Report post Posted August 29, 2007 Well i made 3 seperate scripts and named them like they are supposed to be but now like you said Arbiter i got line 271 damage effects syntaxerror, how do you fix it? sorry i dont know much about scripting thanks yeah I used to be terrible at scripting, I started learning by modifying co-ordinates of things I wanted moving then menu screen then the battle menu's then the battles itself and then I read all the syntax from the pholy website and learned that way (im not the best but I know a fair bit) (if you want to learn, make a new project just for scripting don't use your current project) Go to line 271 and 272 you will find @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math: :P I / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: :P I / 5) replace the above with @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math: :PI / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: :PI / 5) also the 3rd section damage doesn't do much anyway but just delete the space between the P I / 5 = PI / 5 Share this post Link to post Share on other sites
Snow_Spartan 0 Report post Posted August 29, 2007 Nope i still cant get this too work :( sorry for beeing such a pain i replaced @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math: :P I / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: :P I / 5) with the one you gave me @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math: :PI / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: :PI / 5) but it still gave me the line 271 error, is there something that i've missed? Share this post Link to post Share on other sites
Ghost Member 0 Report post Posted August 29, 2007 Nope i still cant get this too work :( sorry for beeing such a pain i replaced @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math: :P I / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math: :P I / 5) with the one you gave me @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math::PI / 5) @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math::PI / 5) but it still gave me the line 271 error, is there something that i've missed? it should work here it is line 271 @_damage_sprite.x += 30 * Math.cos(@_damage_duration * Math::PI / 5) line 272 @_damage_sprite.y += 15 * Math.sin(@_damage_duration * Math::PI / 5) if it doesn't, make a new project and paste the scripts in the new project, make a battle and try to run if it doesn't, google free file hosting and you should find a site called mediafire.com click it and upload the new project when it's uploaded remember to copy the url (not you current the new one you just made) then pm me and I will fix it and post you the working one back. you don't have to sign up just click upload find the new project. name the new project arbiter and upload the folder. Share this post Link to post Share on other sites
isaacsol 10 Report post Posted August 31, 2007 Hnmmmm.... never got the problem before, I'll post it in a project and upload it to rapidshare and provide the link later okay guys. Share this post Link to post Share on other sites
Ghost Member 0 Report post Posted August 31, 2007 Hnmmmm.... never got the problem before, I'll post it in a project and upload it to rapidshare and provide the link later okay guys. um ok but I fixed for him already. Share this post Link to post Share on other sites
Amazo 0 Report post Posted January 4, 2008 This looks very interesting, does the animation work like the earlier FF games (standing still) or later ones (run up and slash)? Does it require extra sprites? Share this post Link to post Share on other sites
isaacsol 10 Report post Posted January 10, 2008 All you have to do to get this to work, is export the Charset's into the battlers folder and RMXP will automatically reassign the RTP, any custom ones you will have to do your self. Here is an example of the battle system in action, there is an error with the windowskin but that has been fixed, it won't affect your game as it was a clash with another script. It doesn't lag when in-game, that was because of my recording software that it lagged in the video: Youtube Video ->Original Video Share this post Link to post Share on other sites
tstorm86 0 Report post Posted January 17, 2008 i got a new_battle line 335 error Share this post Link to post Share on other sites
isaacsol 10 Report post Posted January 19, 2008 Are you using any other major Scripts e.g. SDK? Share this post Link to post Share on other sites
IkoVirus 0 Report post Posted January 23, 2008 could it be the non english code in the "new battle" one, i am haveing alot of trouble with that as well. i have had the advanced side battle in my game for a while , i just want those bars you guys are using o_O....how can i get that? Share this post Link to post Share on other sites
Sicmonkey7 0 Report post Posted January 27, 2008 When I try and load it up it says, "????? 'New_battle' ? 2 ??? SyntaxError ???????? What should I do Share this post Link to post Share on other sites
Zichiker 0 Report post Posted February 4, 2008 I got an error. Scrit 'New_Battle' line 2: SyntaxError occurred. How do I fix this? Share this post Link to post Share on other sites
personmuncher 0 Report post Posted February 4, 2008 Just got this working and had the same problems you guys had I'm assuming you are using firefox because that was my problem Copy the code using internet explorer, and it'll work great ;) Share this post Link to post Share on other sites
Zichiker 0 Report post Posted February 4, 2008 Just got this working and had the same problems you guys hadI'm assuming you are using firefox because that was my problem Copy the code using internet explorer, and it'll work great ;) I have internet explorer. Share this post Link to post Share on other sites
viruzx 0 Report post Posted February 15, 2008 By the way, I also got my error under New_Battle script line 334...its saids that "Syntax Error occured"...Sorry im not really good at scripting also. Share this post Link to post Share on other sites
isaacsol 10 Report post Posted February 17, 2008 Here is a demo of the script, it has the scripts inside, if you still have problems, contact me. Also, these scripts were designed for the Legal version of RPG Maker XP, not Postality Knights version or any other translation. http://rapidshare.com/files/92473689/battle_sys__demo.exe Also, for those who want the HP/SP bars that I use, you need this script by Cogwheel (Please note, that you will have to edit out the other HP/SP bars from the scripts above, I cannot remember which one it is in specifically): # HP/SP/EXPƒQ?[ƒW•\Ž¦ƒXƒNƒŠƒvƒg Ver 1.00 # ”z•zŒ³?EƒTƒ|?[ƒgURL # [url="http://members.jcom.home.ne.jp/cogwheel/"]http://members.jcom.home.ne.jp/cogwheel/[/url] #============================================================================== # ?¡ Game_Actor #------------------------------------------------------------------------------ # ?@ƒAƒNƒ^?[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·?B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors) # ‚Ì“à•”‚ÅŽg—p‚³‚ê?AGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQ?Æ‚³‚ê‚Ü‚·?B #============================================================================== class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end #============================================================================== # ?¡ Window_Base #------------------------------------------------------------------------------ # ?@ƒQ?[ƒ€’†‚Ì‚·‚ׂẴEƒBƒ“ƒhƒE‚̃X?[ƒp?[ƒNƒ‰ƒX‚Å‚·?B #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ?œ HP ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- alias :draw_actor_hp_original :draw_actor_hp def draw_actor_hp(actor, x, y, width = 144) if actor.maxhp != 0 rate = actor.hp.to_f / actor.maxhp else rate = 0 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 grade1 = 1 grade2 = 0 color1 = Color.new(0, 0, 0, 50) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 50) color4 = Color.new(64, 0, 0, 50) color5 = Color.new(216 - 24 * rate, 0 * rate, 0 * rate, 192) color6 = Color.new(255 * rate, 215 * rate, 0 * rate, 192) if actor.maxhp != 0 hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp else hp = 0 end gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, hp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) draw_actor_hp_original(actor, x, y, width) end #-------------------------------------------------------------------------- # ?œ SP ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- # ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•Ï?X alias :draw_actor_sp_original :draw_actor_sp def draw_actor_sp(actor, x, y, width = 144) # •Ï?”rate‚É Œ»?Ý‚ÌSP/MSP‚ð‘ã“ü if actor.maxsp != 0 rate = actor.sp.to_f / actor.maxsp else rate = 1 end # plus_x:X?À•W‚̈ʒu•â?³ rate_x:X?À•W‚̈ʒu•â?³(%) plus_y:Y?À•W‚̈ʒu•â?³ # plus_width:•?‚Ì•â?³ rate_width:•?‚Ì•â?³(%) height:?c•? # align1:•`‰æƒ^ƒCƒv1 0:?¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß # align2:•`‰æƒ^ƒCƒv2 0:?ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß # align3:ƒQ?[ƒWƒ^ƒCƒv 0:?¶‹l‚ß 1:‰E‹l‚ß plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j grade1 = 1 grade2 = 0 # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(0, 64, 0, 192) color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192) color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192) # •Ï?”sp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü if actor.maxsp != 0 sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp else sp = (width + plus_width) * rate_width / 100 end # ƒQ?[ƒW‚Ì•`‰æ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, sp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ draw_actor_sp_original(actor, x, y, width) end #-------------------------------------------------------------------------- # ?œ EXP ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- # ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•Ï?X alias :draw_actor_exp_original :draw_actor_exp def draw_actor_exp(actor, x, y, width = 204) # •Ï?”rate‚É Œ»?Ý‚Ìexp/nextexp‚ð‘ã“ü if actor.next_exp != 0 rate = actor.now_exp.to_f / actor.next_exp else rate = 1 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j grade1 = 1 grade2 = 0 # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192) color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192) # •Ï?”exp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü if actor.next_exp != 0 exp = (width + plus_width) * actor.now_exp * rate_width / 100 / actor.next_exp else exp = (width + plus_width) * rate_width / 100 end # ƒQ?[ƒW‚Ì•`‰æ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, exp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ draw_actor_exp_original(actor, x, y) end #-------------------------------------------------------------------------- # ?œ ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) case align1 when 1 x += (rect_width - width) / 2 when 2 x += rect_width - width end case align2 when 1 y -= height / 2 when 2 y -= height end # ˜g•`‰æ self.contents.fill_rect(x, y, width, height, color1) self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2) if align3 == 0 if grade1 == 2 grade1 = 3 end if grade2 == 2 grade2 = 3 end end if (align3 == 1 and grade1 == 0) or grade1 > 0 color = color3 color3 = color4 color4 = color end if (align3 == 1 and grade2 == 0) or grade2 > 0 color = color5 color5 = color6 color6 = color end # ‹óƒQ?[ƒW‚Ì•`‰æ self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4, color3, color4, grade1) if align3 == 1 x += width - gauge end # ŽÀƒQ?[ƒW‚Ì•`‰æ self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4, color5, color6, grade2) end end #------------------------------------------------------------------------------ # ?@BitmapƒNƒ‰ƒX‚É?V‚½‚È‹@”\‚ð’ljÁ‚µ‚Ü‚·?B #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ?œ ‹éŒ`‚ðƒOƒ‰ƒf?[ƒVƒ‡ƒ“•\Ž¦ # color1 : ƒXƒ^?[ƒgƒJƒ‰?[ # color2 : ƒGƒ“ƒhƒJƒ‰?[ # align : 0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ # 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ # 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“?iŒƒ?d‚ɂ‚«’?ˆÓ?j #-------------------------------------------------------------------------- def gradation_rect(x, y, width, height, color1, color2, align = 0) if align == 0 for i in x...x + width red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1) green = color1.green + (color2.green - color1.green) * (i - x) / (width - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - x) / (width - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - x) / (width - 1) color = Color.new(red, green, blue, alpha) fill_rect(i, y, 1, height, color) end elsif align == 1 for i in y...y + height red = color1.red + (color2.red - color1.red) * (i - y) / (height - 1) green = color1.green + (color2.green - color1.green) * (i - y) / (height - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - y) / (height - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - y) / (height - 1) color = Color.new(red, green, blue, alpha) fill_rect(x, i, width, 1, color) end elsif align == 2 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end elsif align == 3 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end end end end #============================================================================== # ?¡ Spriteƒ‚ƒWƒ…?[ƒ‹ #------------------------------------------------------------------------------ # ?@ƒAƒjƒ??[ƒVƒ‡ƒ“‚ÌŠÇ—?‚ð?s‚¤ƒ‚ƒWƒ…?[ƒ‹‚Å‚·?B #============================================================================== module RPG class Sprite < ::Sprite def damage(value, critical) dispose_damage if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end bitmap = Bitmap.new(160, 48) bitmap.font.name = "Arial Black" bitmap.font.size = 32 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1) if value.is_a?(Numeric) and value < 0 bitmap.font.color.set(176, 255, 144) else bitmap.font.color.set(255, 255, 255) end bitmap.draw_text(0, 12, 160, 36, damage_string, 1) if critical bitmap.font.size = 20 bitmap.font.color.set(0, 0, 0) 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.set(255, 255, 255) bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end @_damage_sprite = ::Sprite.new @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 + self.viewport.ox @_damage_sprite.oy = 20 + self.viewport.oy @_damage_sprite.x = self.x + self.viewport.rect.x @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y @_damage_sprite.z = 3000 @_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 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 sprite.bitmap = bitmap sprite.visible = false @_loop_animation_sprites.push(sprite) end update_loop_animation 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.viewport.rect.x - self.ox + self.src_rect.width / 2 sprite.y = self.y + self.viewport.rect.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 end end 1 aliasmythos reacted to this Share this post Link to post Share on other sites
Cheshire 0 Report post Posted March 28, 2008 Can anyone put these in .txt form or anything? I keep getting weird errors and a bunch of question marks where things would normally be and keeps giving me errors due to that. Or perhaps some way to fix my problem other than giving me .txts. My first post here, I know, but I hope to contribute much more later on. Share this post Link to post Share on other sites
isaacsol 10 Report post Posted March 28, 2008 If you download the demo from the post directly above yours, it has the scripts within an editable project so you can directly copy the script from that project to yours. Share this post Link to post Share on other sites
naichi 0 Report post Posted March 30, 2008 this great man i mad some cool battlers to work whit it Share this post Link to post Share on other sites
Cheshire 0 Report post Posted March 31, 2008 If you download the demo from the post directly above yours, it has the scripts within an editable project so you can directly copy the script from that project to yours. OH wow, I was blind to of missed that. I think you for pointing that out. It has helped a lot. Share this post Link to post Share on other sites
isaacsol 10 Report post Posted March 31, 2008 No worries. Share this post Link to post Share on other sites
undoingearth 0 Report post Posted November 11, 2008 Hey can i get some help ive copied it strait from the demo but the enemys are starting at the bottom of the battle screen and there attacking way to much can i make the bar at the bottom go up faster? Share this post Link to post Share on other sites
OverlordMao 0 Report post Posted November 22, 2008 # HP/SP/EXPƒQ?[ƒW•\Ž¦ƒXƒNƒŠƒvƒg Ver 1.00 # ”z•zŒ³?EƒTƒ|?[ƒgURL # [url="http://members.jcom.home.ne.jp/cogwheel/"]http://members.jcom.home.ne.jp/cogwheel/[/url] #============================================================================== # ?¡ Game_Actor #------------------------------------------------------------------------------ # ?@ƒAƒNƒ^?[‚ðˆµ‚¤ƒNƒ‰ƒX‚Å‚·?B‚±‚̃Nƒ‰ƒX‚Í Game_Actors ƒNƒ‰ƒX ($game_actors) # ‚Ì“à•”‚ÅŽg—p‚³‚ê?AGame_Party ƒNƒ‰ƒX ($game_party) ‚©‚ç‚àŽQ?Æ‚³‚ê‚Ü‚·?B #============================================================================== class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end #============================================================================== # ?¡ Window_Base #------------------------------------------------------------------------------ # ?@ƒQ?[ƒ€’†‚Ì‚·‚ׂẴEƒBƒ“ƒhƒE‚̃X?[ƒp?[ƒNƒ‰ƒX‚Å‚·?B #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ?œ HP ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- alias :draw_actor_hp_original :draw_actor_hp def draw_actor_hp(actor, x, y, width = 144) if actor.maxhp != 0 rate = actor.hp.to_f / actor.maxhp else rate = 0 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 grade1 = 1 grade2 = 0 color1 = Color.new(0, 0, 0, 50) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 50) color4 = Color.new(64, 0, 0, 50) color5 = Color.new(216 - 24 * rate, 0 * rate, 0 * rate, 192) color6 = Color.new(255 * rate, 215 * rate, 0 * rate, 192) if actor.maxhp != 0 hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp else hp = 0 end gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, hp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) draw_actor_hp_original(actor, x, y, width) end #-------------------------------------------------------------------------- # ?œ SP ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- # ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•Ï?X alias :draw_actor_sp_original :draw_actor_sp def draw_actor_sp(actor, x, y, width = 144) # •Ï?”rate‚É Œ»?Ý‚ÌSP/MSP‚ð‘ã“ü if actor.maxsp != 0 rate = actor.sp.to_f / actor.maxsp else rate = 1 end # plus_x:X?À•W‚̈ʒu•â?³ rate_x:X?À•W‚̈ʒu•â?³(%) plus_y:Y?À•W‚̈ʒu•â?³ # plus_width:•?‚Ì•â?³ rate_width:•?‚Ì•â?³(%) height:?c•? # align1:•`‰æƒ^ƒCƒv1 0:?¶‹l‚ß 1:’†‰›‘µ‚¦ 2:‰E‹l‚ß # align2:•`‰æƒ^ƒCƒv2 0:?ã‹l‚ß 1:’†‰›‘µ‚¦ 2:‰º‹l‚ß # align3:ƒQ?[ƒWƒ^ƒCƒv 0:?¶‹l‚ß 1:‰E‹l‚ß plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j grade1 = 1 grade2 = 0 # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(0, 64, 0, 192) color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192) color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192) # •Ï?”sp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü if actor.maxsp != 0 sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp else sp = (width + plus_width) * rate_width / 100 end # ƒQ?[ƒW‚Ì•`‰æ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, sp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ draw_actor_sp_original(actor, x, y, width) end #-------------------------------------------------------------------------- # ?œ EXP ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- # ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ‚ð draw_actor_sp_original ‚Æ–¼‘O•Ï?X alias :draw_actor_exp_original :draw_actor_exp def draw_actor_exp(actor, x, y, width = 204) # •Ï?”rate‚É Œ»?Ý‚Ìexp/nextexp‚ð‘ã“ü if actor.next_exp != 0 rate = actor.now_exp.to_f / actor.next_exp else rate = 1 end plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # ƒOƒ‰ƒf?[ƒVƒ‡ƒ“?Ý’è grade1:‹óƒQ?[ƒW grade2:ŽÀƒQ?[ƒW # (0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“(Œƒ?d)?j grade1 = 1 grade2 = 0 # ?F?Ý’è?Bcolor1:ŠO˜g?Ccolor2:’†˜g # color3:‹óƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor4:‹óƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ # color5:ŽÀƒQ?[ƒWƒ_?[ƒNƒJƒ‰?[?Ccolor6:ŽÀƒQ?[ƒWƒ‰ƒCƒgƒJƒ‰?[ color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192) color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192) # •Ï?”exp‚É•`‰æ‚·‚éƒQ?[ƒW‚Ì•?‚ð‘ã“ü if actor.next_exp != 0 exp = (width + plus_width) * actor.now_exp * rate_width / 100 / actor.next_exp else exp = (width + plus_width) * rate_width / 100 end # ƒQ?[ƒW‚Ì•`‰æ gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, exp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # ƒIƒŠƒWƒiƒ‹‚ÌEXP•`‰æ?ˆ—?‚ðŒÄ‚Ñ?o‚µ draw_actor_exp_original(actor, x, y) end #-------------------------------------------------------------------------- # ?œ ƒQ?[ƒW‚Ì•`‰æ #-------------------------------------------------------------------------- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) case align1 when 1 x += (rect_width - width) / 2 when 2 x += rect_width - width end case align2 when 1 y -= height / 2 when 2 y -= height end # ˜g•`‰æ self.contents.fill_rect(x, y, width, height, color1) self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2) if align3 == 0 if grade1 == 2 grade1 = 3 end if grade2 == 2 grade2 = 3 end end if (align3 == 1 and grade1 == 0) or grade1 > 0 color = color3 color3 = color4 color4 = color end if (align3 == 1 and grade2 == 0) or grade2 > 0 color = color5 color5 = color6 color6 = color end # ‹óƒQ?[ƒW‚Ì•`‰æ self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4, color3, color4, grade1) if align3 == 1 x += width - gauge end # ŽÀƒQ?[ƒW‚Ì•`‰æ self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4, color5, color6, grade2) end end #------------------------------------------------------------------------------ # ?@BitmapƒNƒ‰ƒX‚É?V‚½‚È‹@”\‚ð’ljÁ‚µ‚Ü‚·?B #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ?œ ‹éŒ`‚ðƒOƒ‰ƒf?[ƒVƒ‡ƒ“•\Ž¦ # color1 : ƒXƒ^?[ƒgƒJƒ‰?[ # color2 : ƒGƒ“ƒhƒJƒ‰?[ # align : 0:‰¡‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ # 1:?c‚ɃOƒ‰ƒf?[ƒVƒ‡ƒ“ # 2:ŽÎ‚߂ɃOƒ‰ƒf?[ƒVƒ‡ƒ“?iŒƒ?d‚ɂ‚«’?ˆÓ?j #-------------------------------------------------------------------------- def gradation_rect(x, y, width, height, color1, color2, align = 0) if align == 0 for i in x...x + width red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1) green = color1.green + (color2.green - color1.green) * (i - x) / (width - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - x) / (width - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - x) / (width - 1) color = Color.new(red, green, blue, alpha) fill_rect(i, y, 1, height, color) end elsif align == 1 for i in y...y + height red = color1.red + (color2.red - color1.red) * (i - y) / (height - 1) green = color1.green + (color2.green - color1.green) * (i - y) / (height - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - y) / (height - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - y) / (height - 1) color = Color.new(red, green, blue, alpha) fill_rect(x, i, width, 1, color) end elsif align == 2 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end elsif align == 3 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end end end end #============================================================================== # ?¡ Spriteƒ‚ƒWƒ…?[ƒ‹ #------------------------------------------------------------------------------ # ?@ƒAƒjƒ??[ƒVƒ‡ƒ“‚ÌŠÇ—?‚ð?s‚¤ƒ‚ƒWƒ…?[ƒ‹‚Å‚·?B #============================================================================== module RPG class Sprite < ::Sprite def damage(value, critical) dispose_damage if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end bitmap = Bitmap.new(160, 48) bitmap.font.name = "Arial Black" bitmap.font.size = 32 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1) if value.is_a?(Numeric) and value < 0 bitmap.font.color.set(176, 255, 144) else bitmap.font.color.set(255, 255, 255) end bitmap.draw_text(0, 12, 160, 36, damage_string, 1) if critical bitmap.font.size = 20 bitmap.font.color.set(0, 0, 0) 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.set(255, 255, 255) bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end @_damage_sprite = ::Sprite.new @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 + self.viewport.ox @_damage_sprite.oy = 20 + self.viewport.oy @_damage_sprite.x = self.x + self.viewport.rect.x @_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y @_damage_sprite.z = 3000 @_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 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 sprite.bitmap = bitmap sprite.visible = false @_loop_animation_sprites.push(sprite) end update_loop_animation 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.viewport.rect.x - self.ox + self.src_rect.width / 2 sprite.y = self.y + self.viewport.rect.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 end end Do you think you could have the demo include this? I have no idea where this goes :blink: Share this post Link to post Share on other sites
isaacsol 10 Report post Posted November 23, 2008 You place it in a new script in between Scene_Debug and Main. Share this post Link to post Share on other sites
OverlordMao 0 Report post Posted November 23, 2008 You place it in a new script in between Scene_Debug and Main. I did that, but the Pop-up damage comes up bigger then before... :blink: Any ideas on how to fix that? Share this post Link to post Share on other sites
amaranth 0 Report post Posted July 21, 2012 The Demo link is not working. could you please provide another link? Share this post Link to post Share on other sites