Noob Saibot 38 Report post Posted April 13, 2010 Here is a script I found in the archive of RMXPU.net, enjoy. Introduction I present a Sideview battle system. You'd say: Hey! We already have ANIMATED systems :content: But I know what to say.. so I'll describe it. Description A sideview battle system that depends on the actor's characterset. We're free of battlers :XD: Features * SDK Compatible (Needs the SDK to work) * The actor's place is changeable even during the game * It has a FF6-look CBS menu * Easy * Language:ENG Code #============================================================================== # ** Sideview System # ** Sideview Battle System Unanimated #------------------------------------------------------------------------------ # Ordaz , Paradox2D6 and Squall (Credits) # Version 1.14 # 3/10/2006 #============================================================================== #------------------------------------------------------------------------------ # * SDK Log Script #------------------------------------------------------------------------------ SDK.log(' Unanimated Sideview Battle System', 'Ordaz', 1, '2006-10-03') #------------------------------------------------------------------------------ # * Begin SDK Enable Test #------------------------------------------------------------------------------ if SDK.state(" Unanimated Sideview Battle System") == true #------------------------------------------------------------------------------ # * Actual Processing #------------------------------------------------------------------------------ module SDVA X_LINE = 400 # 横位置のバトラー表示座標 Y_LINE = 225 # 縦位置のバトラー表示座標 X_SPACE = 20 # 横位置のバトラー同士の間隔 Y_SPACE = 30 # 縦位置のバトラー同士の間隔 X_POSITION = 50 # 隊列[前衛・中衛・後衛]の横間隔 Y_POSITION = 0 # 隊列[前衛・中衛・後衛]の縦間隔 ATTACK_MOVE = true # 攻撃時に前へ踏み出すか( true / false ) SKILL_MOVE = false # スキル使用時に前へ踏み出すか( true / false ) ITEM_MOVE = false # アイテム使用時に前へ踏み出すか( true / false ) MOVE_STEP = 3 # 移動歩数 MOVE_PIXEL = 10 # 一歩あたりのピクセル数 PARTY_POS = 1 # キャラクターの向き( 0:下 / 1:左 / 2:右 / 3:上 ) WINDOWPOS_CHANGE = true # コマンドウインドウをバトラーの横に表示するか( true / false ) end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● Draw X Coordinate #-------------------------------------------------------------------------- def screen_x if self.index != nil # 隊列を取得 pos = $data_classes[self.class_id].position x_pos = pos * SDVA::X_POSITION scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos # 移動アクションのとき if self.current_action.move_action == true # 横に移動 scr_x += @shift_x end return scr_x else return 0 end end #-------------------------------------------------------------------------- # ●Draw Y Coordinate #-------------------------------------------------------------------------- def screen_y if self.index != nil # 隊列を取得 pos = $data_classes[self.class_id].position y_pos = pos * SDVA::Y_POSITION scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos # 移動アクションのとき if self.current_action.move_action == true # 縦に移動 scr_y += @shift_y end return scr_y else return 0 end end #-------------------------------------------------------------------------- # ● Draw Z Coordinate #-------------------------------------------------------------------------- def screen_z if self.index != nil return self.index else return 0 end end end #============================================================================== # ■ Game_Battler (分割定義 1) #============================================================================== class Game_Battler #------------------------------------------------------------------------------ # * Public Variables #------------------------------------------------------------------------------ attr_reader :pattern # 歩行パターン attr_reader :trans_x # X方向の移動距離 attr_reader :moving # 移動中フラグ #-------------------------------------------------------------------------- # ● Initialize Battle #-------------------------------------------------------------------------- alias initialize_sdva initialize def initialize initialize_sdva move_reset end #-------------------------------------------------------------------------- # ● Move Process #-------------------------------------------------------------------------- def move @moving = 1 if @step < SDVA::MOVE_STEP # 歩数を満たすまで移動 @pattern = (@pattern + 1) % 4 @step += 1 move_step else # 移動終了 @pattern = 1 @moving = 2 end end #-------------------------------------------------------------------------- # ● Sets up the position of your character #-------------------------------------------------------------------------- def move_step # パーティの向きによって移動座標を変える case SDVA::PARTY_POS when 0 @shift_y = @step * SDVA::MOVE_PIXEL when 1 @shift_x = -(@step * SDVA::MOVE_PIXEL) when 2 @shift_x = @step * SDVA::MOVE_PIXEL when 3 @shift_y = -(@step * SDVA::MOVE_PIXEL) end end #-------------------------------------------------------------------------- # ● Ending Movement module #-------------------------------------------------------------------------- def move_reset @moving = 0 @pattern = 0 @step = 0 @shift_x = 0 @shift_y = 0 end end #============================================================================== # ■ Game_BattleAction #============================================================================== class Game_BattleAction #-------------------------------------------------------------------------- # ● Public Insurance Variables #-------------------------------------------------------------------------- attr_accessor :move_action # 移動するアクションか #-------------------------------------------------------------------------- # ● Clear The System #-------------------------------------------------------------------------- alias clear_sdva clear def clear clear_sdva @move_action = false end end #============================================================================== # ■ Sprite_Battler #============================================================================== class Sprite_Battler < RPG::Sprite #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias update_sdva update def update # バトラーがアクターに含まれるとき if @battler.is_a?(Game_Actor) # ファイル名か色相が現在のものと異なる場合 # 行動中の場合 if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue or @battler.current_action.basic == 0 or @battler.current_action.kind != 3 # ビットマップを取得、設定 @character_name = @battler.character_name @character_hue = @battler.character_hue # 歩行グラフィックを描画 self.bitmap = RPG::Cache.character(@character_name, @character_hue) cw = self.bitmap.width / 4 ch = self.bitmap.height / 4 @width = cw @height = ch if @battler.current_action.move_action == true # 歩かせる @battler.move else @battler.move_reset end # 転送元の矩形を設定 sx = @battler.pattern * cw sy = SDVA::PARTY_POS * ch self.src_rect.set(sx, sy, cw, ch) self.ox = @width / 2 self.oy = @height # 隠れ状態なら不透明度を 0 にする if @battler.hidden self.opacity = 0 end end end update_sdva end end #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● Initializing the windows and the Bars #-------------------------------------------------------------------------- alias phase3_setup_command_window_sdva phase3_setup_command_window def phase3_setup_command_window phase3_setup_command_window_sdva if SDVA::WINDOWPOS_CHANGE # アクターコマンドウィンドウの位置を設定 case SDVA::PARTY_POS when 0 x_pos = @active_battler.screen_x - (@actor_command_window.width/2) y_pos = @active_battler.screen_y when 1 x_pos = @active_battler.screen_x - @actor_command_window.width - 16 y_pos = @active_battler.screen_y - @actor_command_window.height when 2 x_pos = @active_battler.screen_x + 16 y_pos = @active_battler.screen_y - @actor_command_window.height when 3 x_pos = @active_battler.screen_x - (@actor_command_window.width/2) y_pos = @active_battler.screen_y - @actor_command_window.height - 48 end @actor_command_window.x = x_pos >= 0 ? x_pos : 0 @actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width @actor_command_window.y = y_pos >= 0 ? y_pos : 0 @actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height # ステータスウインドウに隠れないように @actor_command_window.z = 9999 end end #-------------------------------------------------------------------------- # ● Events Move #-------------------------------------------------------------------------- alias update_phase4_step3_sdva update_phase4_step3 def update_phase4_step3 if SDVA::ATTACK_MOVE if @active_battler.current_action.basic == 0 @active_battler.current_action.move_action = true end end if SDVA::SKILL_MOVE if @active_battler.current_action.kind == 1 @active_battler.current_action.move_action = true end end if SDVA::ITEM_MOVE if @active_battler.current_action.kind == 2 @active_battler.current_action.move_action = true end end # バトラーがアクターに含まれ、移動アクション中 if @active_battler.is_a?(Game_Actor) and @active_battler.current_action.move_action # 移動終了時 if @active_battler.moving == 2 update_phase4_step3_sdva end elsif @active_battler.moving == 0 update_phase4_step3_sdva end end #-------------------------------------------------------------------------- # ● Enemies Phase #-------------------------------------------------------------------------- alias update_phase4_step6_sdva update_phase4_step6 def update_phase4_step6 @active_battler.current_action.move_action = false @active_battler.move_reset update_phase4_step6_sdva end end #============================================================================== # ■ Spriteset_Battle #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias initialize_sdva initialize def initialize initialize_sdva @viewport2.z = 1 end end #============================================================================== # ■ Arrow_Actor #============================================================================== class Arrow_Actor < Arrow_Base #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- alias update_sdva update def update update_sdva # カーソル下 if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) @index += 1 @index %= $game_party.actors.size end # カーソル上 if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) @index += $game_party.actors.size - 1 @index %= $game_party.actors.size end end end #============================================================================== # ■ Arrow_Enemy #============================================================================== class Arrow_Enemy < Arrow_Base #-------------------------------------------------------------------------- # ● Enemy Cursor #-------------------------------------------------------------------------- alias update_sdva update def update update_sdva # Change Choice if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) $game_troop.enemies.size.times do @index += 1 @index %= $game_troop.enemies.size break if self.enemy.exist? end end # Change Choice #2 if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) $game_troop.enemies.size.times do @index += $game_troop.enemies.size - 1 @index %= $game_troop.enemies.size break if self.enemy.exist? end end end end #-------------------------------------------------------------------------- # ● Damage Class (Written By Squall #-------------------------------------------------------------------------- class RPG::Sprite < ::Sprite #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize(viewport = nil) super(viewport) @_whiten_duration = 0 @_appear_duration = 0 @_escape_duration = 0 @_collapse_duration = 0 @_damage_durations = [] @_animation_duration = 0 @_blink = false end #-------------------------------------------------------------------------- # ● Dispose #-------------------------------------------------------------------------- def dispose dispose_damage(0...@_damage_durations.size) dispose_animation dispose_loop_animation super end #-------------------------------------------------------------------------- # ● Effect #-------------------------------------------------------------------------- def effect? damage_duration = 0 for value in @_damage_durations damage_duration += value end @_whiten_duration > 0 or @_appear_duration > 0 or @_escape_duration > 0 or @_collapse_duration > 0 or damage_duration > 0 or @_animation_duration > 0 end #-------------------------------------------------------------------------- # ● Damage #-------------------------------------------------------------------------- def damage(value, critical) dispose_damage(0...@_damage_durations.size) @_damage_sprites = [] if value.is_a?(Numeric) damage_string = value.abs.to_s else damage_string = value.to_s end if critical damage_string += " CRITICAL HIT" end for i in 0...damage_string.size letter = damage_string[i..i] bitmap = Bitmap.new(48, 48) bitmap.font.size = 24 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, 12-1, 48, 48, letter, 1) bitmap.draw_text(+1, 12-1, 48, 48, letter, 1) bitmap.draw_text(-1, 12+1, 48, 48, letter, 1) bitmap.draw_text(+1, 12+1, 48, 48, letter, 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, 48, 48, letter, 1) @_damage_sprites[i] = ::Sprite.new(self.viewport) @_damage_sprites[i].bitmap = bitmap @_damage_sprites[i].visible = false @_damage_sprites[i].ox = 16 @_damage_sprites[i].oy = 16 @_damage_sprites[i].x = self.x - self.ox / 2 + i * 12 @_damage_sprites[i].y = self.y - self.oy / 2 @_damage_sprites[i].z = 3000 @_damage_durations[i] = 40 + i * 2 end end #-------------------------------------------------------------------------- # ● Dispose Damage #-------------------------------------------------------------------------- def dispose_damage(index) return if @_damage_sprites == nil if @_damage_sprites[index].is_a?(::Sprite) and @_damage_sprites[index].bitmap != nil @_damage_sprites[index].bitmap.dispose @_damage_sprites[index].dispose @_damage_durations[index] = 0 end end #-------------------------------------------------------------------------- # ● Update #-------------------------------------------------------------------------- def update super 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 for i in 0...@_damage_durations.size damage_sprite = @_damage_sprites[i] next if @_damage_durations[i] == nil if @_damage_durations[i] > 0 @_damage_durations[i] -= 1 damage_sprite.visible = (@_damage_durations[i] <= 40) case @_damage_durations[i] when 38..39 damage_sprite.y -= 4 when 36..37 damage_sprite.y -= 2 when 34..35 damage_sprite.y += 2 when 28..33 damage_sprite.y += 4 end damage_sprite.opacity = 256 - (12 - @_damage_durations[i]) * 32 if @_damage_durations[i] == 0 dispose_damage(i) end end end 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 end #-------------------------------------------------------------------------- # ● Ends Damage Class (Written by Squall) #-------------------------------------------------------------------------- #-------------------------------------------------------------------------- # ● CBS Menu System (By ParaDog) #-------------------------------------------------------------------------- module PARA_CTB # HP Color HP_COLOR_LEFT = Color.new(0, 40, 0, 255) # HP Color 2 HP_COLOR_RIGHT= Color.new(0, 150, 0, 255) # SP Color SP_COLOR_LEFT = Color.new(0, 0, 40, 255) # SP Color 2 SP_COLOR_RIGHT= Color.new(0, 0, 150, 255) #Frames Initialize FRAME_COLOR = Color.new(192, 192, 192, 255) # Frame Border size FRAME_BORDER = 1 # Background Color BACK_COLOR = Color.new(128, 128, 128, 128) # Font Size NAME_FONT_SIZE =17 # HP/SP Font size HPSP_FONT_SIZE =18 # Enemies name Font ENEMY_FONT_SIZE =16 # Draws the MAX HP of enemies MAX_DRAW = false #-------------------------------------------------------------------------------- # * Party Things #-------------------------------------------------------------------------------- # Party Size (Default 4) PARTY_SIZE = 4 # Enemy Group Naming ENEMY_GROUPING = false #Sets your opinion if you want ENEMY_DRAWING_MATER = 0 # Draws Actor's HP / MP in help menu (Default : True) HELP_DRAWING_MATER_ACTOR = true # Draws Enemy's HP/MP in help menu (Default : False) HELP_DRAWING_MATER_ENEMY = false # Window Positioning Change WINDOWPOS_CHANGE = false WINDOWPOS_X = 100 # X座標 WINDOWPOS_Y = 320 # Y座標 # Sets Menu Opacity WINDOW_OPACITY = 160 end #-------------------------------------------------------------------------- # ● Ends The Variables #-------------------------------------------------------------------------- #============================================================================== # ■ Scene_Battle #============================================================================== class Scene_Battle #-------------------------------------------------------------------------- # ● CTB Main #-------------------------------------------------------------------------- alias main_ctb main def main # Starts CTB Window @status_window2 = Window_BattleStatus_enemy.new main_ctb # Dispose CTB Window @status_window2.dispose end #-------------------------------------------------------------------------- # ● CTB Update #-------------------------------------------------------------------------- alias ctb_update update def update # Interepter call if $game_system.battle_interpreter.running? $game_system.battle_interpreter.update if $game_temp.forcing_battler == nil unless $game_system.battle_interpreter.running? unless judge setup_battle_event end end if @phase != 5 @status_window2.refresh end end end ctb_update end #-------------------------------------------------------------------------- # ● Phases #-------------------------------------------------------------------------- alias phase3_setup_command_window_ctb phase3_setup_command_window def phase3_setup_command_window @actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY phase3_setup_command_window_ctb if PARA_CTB::WINDOWPOS_CHANGE # アクターコマンドウィンドウの位置を設定 @actor_command_window.x = PARA_CTB::WINDOWPOS_X @actor_command_window.y = PARA_CTB::WINDOWPOS_Y # ステータスウインドウに隠れないように @actor_command_window.z = 9999 end end #-------------------------------------------------------------------------- # ● Phases #-------------------------------------------------------------------------- alias update_phase1_ctb update_phase1 def update_phase1 # エネミー名リストを更新 @status_window2.refresh update_phase1_ctb end #-------------------------------------------------------------------------- # ● Phase six #-------------------------------------------------------------------------- alias update_phase4_step6_ctb update_phase4_step6 def update_phase4_step6 # エネミー名リストを更新 @status_window2.refresh update_phase4_step6_ctb end end #============================================================================== # ■ Window_BattleStatus #============================================================================== class Window_BattleStatus < Window_Base #-------------------------------------------------------------------------- # ● Initialize #-------------------------------------------------------------------------- def initialize super(160, 320, 480, 160) self.contents = Bitmap.new(width - 32, height - 32) @level_up_flags = [] for i in 0..$game_party.actors.size @level_up_flags.push(false) end @before_hp = [] @before_sp = [] @before_states = [] @now_hp = [] @now_sp = [] @now_states = [] refresh end #-------------------------------------------------------------------------- # ● Refreshes The Party members #-------------------------------------------------------------------------- def refresh @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] line_height = 120 / PARA_CTB::PARTY_SIZE actor_y = i * line_height + 4 # 現在のステータスを配列に @now_hp[i] = actor.hp @now_sp[i] = actor.sp @now_states[i] = actor.states # レベルアップ if @level_up_flags[i] self.contents.fill_rect(344, actor_y, 100, 32, Color.new(0, 0, 0, 0)) self.contents.font.color = normal_color self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!") end end # バトルステータスの軽量化処理 # ステータスの配列が変化したときのみ描画処理 if @before_hp == nil or @before_sp == nil or @before_states == nil or @before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states self.contents.clear for i2 in 0...$game_party.actors.size actor = $game_party.actors[i2] line_height = 120 / PARA_CTB::PARTY_SIZE actor_y = i2 * line_height + 4 self.contents.font.size = PARA_CTB::NAME_FONT_SIZE # 名前を描画 draw_actor_name(actor, 4, actor_y+16-PARA_CTB::NAME_FONT_SIZE) # HPを描画 hp_color1 = PARA_CTB::HP_COLOR_LEFT hp_color2 = PARA_CTB::HP_COLOR_RIGHT draw_meter(actor.hp, actor.maxhp, 125, actor_y+14, 80, 8, hp_color1, hp_color2) draw_actor_hp(actor, 102, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100) # SPを描画 sp_color1 = PARA_CTB::SP_COLOR_LEFT sp_color2 = PARA_CTB::SP_COLOR_RIGHT draw_meter(actor.sp, actor.maxsp, 245, actor_y+14, 80, 8, sp_color1, sp_color2) draw_actor_sp(actor, 222, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100) # 変化後のステータスを配列に @before_hp[i2] = actor.hp @before_sp[i2] = actor.sp @before_states[i2] = actor.states # レベルアップ if @level_up_flags[i2] == false draw_actor_state(actor, 344, actor_y) end end end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super end #-------------------------------------------------------------------------- # ● HP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 描画先の幅 #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 144) # 文字列 "HP" を描画 self.contents.font.color = system_color self.contents.font.size = 16 self.contents.draw_text(x, y+2, 32, 32, $data_system.words.hp) self.contents.font.color = normal_color self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE if PARA_CTB::MAX_DRAW # MaxHP を描画 self.contents.draw_text(x, y, width, 32, actor.maxhp.to_s, 2) text_size = self.contents.text_size(actor.maxhp.to_s) text_x = x + width - text_size.width - 12 self.contents.draw_text(text_x, y, 12, 32, "/", 1) # HP を描画 self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color text_x = text_x - text_size.width self.contents.draw_text(text_x, y, text_size.width, 32, actor.hp.to_s, 2) else self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.draw_text(x, y, width, 32, actor.hp.to_s, 2) end end #-------------------------------------------------------------------------- # ● SP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 描画先の幅 #-------------------------------------------------------------------------- def draw_actor_sp(actor, x, y, width = 144) # 文字列 "SP" を描画 self.contents.font.color = system_color self.contents.font.size = 16 self.contents.draw_text(x, y+2, 32, 32, $data_system.words.sp) self.contents.font.color = normal_color self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE if PARA_CTB::MAX_DRAW # MaxSP を描画 self.contents.draw_text(x, y, width, 32, actor.maxsp.to_s, 2) text_size = self.contents.text_size(actor.maxsp.to_s) text_x = x + width - text_size.width - 12 self.contents.draw_text(text_x, y, 12, 32, "/", 1) # SP を描画 self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color text_x = text_x - text_size.width self.contents.draw_text(text_x, y, text_size.width, 32, actor.sp.to_s, 2) else self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color self.contents.draw_text(x, y, width, 32, actor.sp.to_s, 2) end end end #============================================================================== # □ 敵の名前を表示するウインドウ #============================================================================== class Window_BattleStatus_enemy < Window_Base #-------------------------------------------------------------------------- # ○ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 320, 160, 160) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # ○ リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE @exist_enemies = [] if $game_troop.enemies != nil if PARA_CTB::ENEMY_GROUPING ememy_list = [] ememy_list_index = [] # エネミーをグループ化 for i in 0...$game_troop.enemies.size enemy = $game_troop.enemies[i] if enemy.exist? if ememy_list.include?(enemy.name) ememy_list_index[ememy_list.index(enemy.name)] += 1 else # エネミー名を記録 ememy_list.push(enemy.name) ememy_list_index[ememy_list.index(enemy.name)] = 1 end end end # エネミーの名前と数を描画 enemy_index = 0 for enemy_name in ememy_list enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4 if ememy_list_index[enemy_index] > 1 enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s end self.contents.draw_text(4, enemy_y, 160, 20, enemy_name) enemy_index += 1 end else # エネミーの名前を描画 enemy_index = 0 for i in 0...$game_troop.enemies.size enemy = $game_troop.enemies[i] if enemy.exist? @exist_enemies.push(enemy) line_height = PARA_CTB::ENEMY_FONT_SIZE + 6 if PARA_CTB::ENEMY_DRAWING_MATER != 0 line_height += 10 end enemy_y = enemy_index * line_height + 4 self.contents.draw_text(4, enemy_y, 160, 20, enemy.name) enemy_index += 1 # HPゲージを描画 if PARA_CTB::ENEMY_DRAWING_MATER == 1 hp_color1 = PARA_CTB::HP_COLOR_LEFT hp_color2 = PARA_CTB::HP_COLOR_RIGHT y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3 draw_meter(enemy.hp, enemy.maxhp, 4, y, 80, 8, hp_color1, hp_color2) end end end end end end end #============================================================================== # ■ Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ○ ゲージを描画 #-------------------------------------------------------------------------- def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color ) self.contents.fill_rect(x, y, width, height, PARA_CTB::FRAME_COLOR) self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER, y+PARA_CTB::FRAME_BORDER, width-PARA_CTB::FRAME_BORDER*2, height-PARA_CTB::FRAME_BORDER*2, PARA_CTB::BACK_COLOR) now = now > max ? max : now percentage = max != 0 ? (width-2) * now / max.to_f : 0 if start_color == end_color self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color) else for i in 1..percentage r = start_color.red + (end_color.red - start_color.red) / percentage * i g = start_color.green + (end_color.green - start_color.green) / percentage * i b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a)) end end end end #============================================================================== # ■ Window_Help #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ● アクター設定 # actor : ステータスを表示するアクター #-------------------------------------------------------------------------- alias set_actor_ctb set_actor def set_actor(actor) if PARA_CTB::HELP_DRAWING_MATER_ACTOR self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_state(actor, 140, 0) hp_color1 = PARA_CTB::HP_COLOR_LEFT hp_color2 = PARA_CTB::HP_COLOR_RIGHT draw_meter(actor.hp, actor.maxhp, 316, 18, 112, 8, hp_color1, hp_color2) draw_actor_hp(actor, 284, 0) sp_color1 = PARA_CTB::SP_COLOR_LEFT sp_color2 = PARA_CTB::SP_COLOR_RIGHT draw_meter(actor.sp, actor.maxsp, 492, 18, 112, 8, sp_color1, sp_color2) draw_actor_sp(actor, 460, 0) @actor = actor @text = nil self.visible = true else set_actor_ctb(actor) end end #-------------------------------------------------------------------------- # ● エネミー設定 # enemy : 名前とステートを表示するエネミー #-------------------------------------------------------------------------- alias set_enemy_ctb set_enemy def set_enemy(enemy) if PARA_CTB::HELP_DRAWING_MATER_ENEMY self.contents.clear draw_actor_name(enemy, 4, 0) draw_actor_state(enemy, 140, 0) hp_color1 = PARA_CTB::HP_COLOR_LEFT hp_color2 = PARA_CTB::HP_COLOR_RIGHT draw_meter(enemy.hp, enemy.maxhp, 316, 18, 112, 8, hp_color1, hp_color2) draw_actor_hp(enemy, 284, 0) sp_color1 = PARA_CTB::SP_COLOR_LEFT sp_color2 = PARA_CTB::SP_COLOR_RIGHT draw_meter(enemy.sp, enemy.maxsp, 492, 18, 112, 8, sp_color1, sp_color2) draw_actor_sp(enemy, 460, 0) self.visible = true else set_enemy_ctb(enemy) end end end #------------------------------------------------------------------------------ # ● End SDK Enable Test #------------------------------------------------------------------------------ end Upgrades ATB Gauge (as shown below. Click here to view the upgrade code Install the upgrade: 1-Find module PARA_CTB 2-Replace it and EVERYTHING below it except "End SDK Enable Test". 3- Save and test your game. Credits Ordaz (It's me) ParaDog Squall (For his damage font) Bugs This system is an enemy for RTAB system :stunned: Original Post: RMXPU.net Archive Share this post Link to post Share on other sites