#◆◇◆◇◆ レベルアップポップスクリプトVXA ver 1.01 ◇◆◇◆◇ # サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/ # by みんと =begin ■ 更新履歴 ○ ver 1.01(2012/01/21) 多人数PTに対応 ○ ver 1.00(2012/01/21) 公開 ■ 説明 VX版とは違い、アクティブレベルアップVXAなしでも動作します。 アクティブレベルアップVXAを導入している場合は、 アクティブレベルアップVXAよりも下にセクションを作成し、導入してください。 レベルアップした際の詳細な情報を1つずつ素早く表示します。 スキルを習得した場合は習得したスキル名を表示します。 立ち絵の表示にも対応しています。 =end #============================================================================== # ☆ MINTO #------------------------------------------------------------------------------ # 様々なフラグを扱うメインモジュールです。 #============================================================================== module MINTO # レベルアップポップスクリプトVXAを有効化 ( true で有効 / false で無効 ) RGSS["レベルアップポップスクリプトVXA"] = true end # レベルアップポップスクリプトVXAが有効な場合に以降の処理を実行する if MINTO::RGSS["レベルアップポップスクリプトVXA"] == true then #============================================================================== # ☆ カスタマイズ #------------------------------------------------------------------------------ # 機能のカスタマイズをここで行います。 #============================================================================== module MINTO # 使用する立ち絵グラグラフィックファイル名 # Face_Name_L[ID] = "ファイル末尾名" # すべてピクチャーフォルダを参照します。 # ※ ファイル名は機械的に参照します。 # たとえば、Face_Name[1] = "L" と設定し、 # ファイル名がActor1でインデックスが0の場合、 # 実際のファイル名は Actor1-0L となります。 # 原則、全アクター分設定してください。 # nil の場合は「現在の設定グラフィック」を参照します。 Face_Name_L = [] # 変更しない Face_Name_L[1] = nil Face_Name_L[2] = nil Face_Name_L[3] = nil Face_Name_L[4] = nil Face_Name_L[5] = nil Face_Name_L[6] = "L" Face_Name_L[7] = "L" Face_Name_L[8] = "L" # パラメータ上昇時のSE(名前、音量、ピッチ) SE_Data = ["Audio/SE/Heal7", 100, 150] # スキル習得時のSE(名前、音量、ピッチ) Skill_SE_Data = ["Audio/SE/Up4", 100, 150] end #============================================================================== # ■ Bitmap #------------------------------------------------------------------------------ #  画像そのものを扱う組み込みクラスです。 #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ● 指定範囲のクリア #-------------------------------------------------------------------------- def rect_clear(x, y, width, height) # 対象の範囲を消す rect = Rect.new(x, y, width, height) self.fill_rect(rect, Color.new(0, 0, 0, 0)) end end #============================================================================== # ■ Window #------------------------------------------------------------------------------ #  ゲーム内の全てのウィンドウのスーパークラスです。 # 内部的には複数のスプライトで構成されています。 #============================================================================== class Window #-------------------------------------------------------------------------- # ● ウィンドウのセンタリング #-------------------------------------------------------------------------- def centering # ウィンドウを画面の中央に配置する self.x = (Graphics.width - self.width) / 2 self.y = (Graphics.height - self.height) / 2 end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :after_battle_phase # アフターバトルフェーズ中フラグ end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 基本通常能力値の取得 #-------------------------------------------------------------------------- def base_param(param_id) return param_base(param_id) end #-------------------------------------------------------------------------- # ● レベルアップメッセージの表示 # new_skills : 新しく習得したスキルの配列 #-------------------------------------------------------------------------- def display_level_up(new_skills) # 何もなかった事にする end end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● 全滅判定の取得 #-------------------------------------------------------------------------- def all_dead? # スーパークラスの処理に以降 bool = super # 勝利確定の場合 if bool then # アフターバトルフェーズ中でない場合 unless $game_temp.after_battle_phase then # アフターバトルフェーズを予約する $game_temp.after_battle_phase = true # アクティブレベルアップVXAが有効な場合 if MINTO::RGSS["Active_Lv_UpVX"] # アフターバトルフェーズ準備 SceneManager.scene.reservation_after_battle_phase end # 第二アフターバトルフェーズ準備 SceneManager.scene.reservation_second_after_battle_phase end end # メソッドを返す return bool end end #============================================================================== # ■ Window_Lvup_Data #------------------------------------------------------------------------------ # Lvup時のデータを表示するウィンドウです。 #============================================================================== class Window_Lvup_Data < Window_Base #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :data # データ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, 512, 320) self.contents = Bitmap.new(width - 32, height - 32) self.z = 10016 self.visible = false @data = {} centering end #-------------------------------------------------------------------------- # ● グラフィックの作成 # actor : アクター # x : 描写先のX座標 # y : 描写先のY座標 #-------------------------------------------------------------------------- def graphic_set(actor, x, y) # 顔グラフィック末尾名が有効な場合 unless MINTO::Face_Name_L[actor.id].nil? then # ファイル名を作成 file_name = "#{actor.face_name}-#{actor.face_index}" # ファイル末尾名を取得 file_name += MINTO::Face_Name_L[actor.id] # 顔グラフィックを読み込む face = Cache.picture(file_name) # 顔グラフィックを描写 self.contents.blt(x, y, face, face.rect) # 顔グラフィック末尾名が無効な場合 else # 現在の設定グラフィックを描写 draw_face(actor.face_name, actor.face_index, x, y) end end #-------------------------------------------------------------------------- # ● リフレッシュ # actor : アクター #-------------------------------------------------------------------------- def refresh(actor) x = 160 self.contents.clear # アクター名を描写 self.contents.font.color = normal_color self.contents.draw_text(x * 0, 24 * 0, 224, 24, actor.name) # アクターグラフィックを描写 graphic_set(actor, 240, 0) # 用語を描写 self.contents.font.color = system_color self.contents.draw_text(x * 0, 24 * 1, 96, 24, "Level") for i in 0...8 do self.contents.draw_text(x * 0, 24 * (i + 2), 96, 24, Vocab::param(i)) end self.contents.font.color = normal_color # パラメータを描写 for i in 0...@data[actor].size do draw_status(actor, i) end end #-------------------------------------------------------------------------- # ● 能力の描写 # actor : アクター # index : 項目 #-------------------------------------------------------------------------- def draw_status(actor, index) # 描写座標を設定 x = 96 y = 24 + (index * 24) # 描写範囲をクリア self.contents.rect_clear(x, y, 48, 24) # 能力値を描写 self.contents.draw_text(x, y, 96, 24, @data[actor][index].to_s) end end #============================================================================== # ■ Window_BattleCenter_Help #------------------------------------------------------------------------------ #  戦闘画面で任意の文章を表示するウィンドウです。 #============================================================================== class Window_BattleCenter_Help < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, 64, 56) self.z = 20000 self.visible = false create_contents @message_duration = 0 @save_text = "" @text = [] @text_y = 0 @text_x = 0 @text_type = 0 @text_index = 0 @text_width = [] @speed = 1 end #-------------------------------------------------------------------------- # ● テキスト設定 # text : スプライトに表示する文字列 #-------------------------------------------------------------------------- def set_text(text) # 求められたテキストが無効な場合 if text.to_s == "" then # 表示カウントを設定 @message_duration = 8 # メソッドを終了 return end self.active = true # 終了記号を追加 text += "\\bw" # スプライトを可視状態にする self.visible = true # 各データを初期化 @save_text = "" @text = [] @text_width = [] @text_index = 0 @text_type = 0 @speed = 1 self.pause = false self.opacity = 192 self.contents_opacity = 255 # 表示カウントを設定 @message_duration = 16 # 文字を複製 data = text.dup # 各制御文字を仮変換 data.gsub!(/\\\\/) { "\000" } data.gsub!(/\\[Cc]\[([0-9]+)\]/) { "" } data.gsub!(/\\[Bb][Ww]/) { "" } # ウィンドウのサイズを調節 self.width = 32 + (self.contents.text_size(data).width) self.height = 56 # センター表示 centering # ビットマップを再作成 create_contents refresh(text.dup) end #-------------------------------------------------------------------------- # ● リフレッシュ # text : スプライトに表示する文字列 #-------------------------------------------------------------------------- def refresh(text) # 基本情報を初期化 self.contents.clear self.contents.font.color = normal_color self.contents.font.bold = false self.contents.font.italic = false @text_x = 0 @text_y = 0 # 文章のインデックスを初期化 @text_index = 0 # 便宜上、"\\\\" を "\000" に変換 text.gsub!(/\\\\/) { "\000" } # 各制御文字を実際のものに変換 text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" } text.gsub!(/\\[Bb][Ww]/) { "\017" } @save_text = text.dup end #-------------------------------------------------------------------------- # ● テキストの更新 #-------------------------------------------------------------------------- def text_update @text = @save_text.split(//) # 無効な文字列の場合 if @text[@text_index] == nil then # メソッドを返す return false end # スプライトを可視状態にする self.visible = true # テキストを取得 c = @text[@text_index] # \\ の場合 if c == "\000" then # 本来の文字に戻す c = "\\" # \C[n] の場合 elsif c == "\001" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 文字色のIDを取得 color = $1.to_i # 文字色のIDが有効な場合 if color >= 0 then # 文字色を変更 self.contents.font.color = text_color(color) end # インデックスを進める @text_index += 1 # メソッドを返す return true # \BW の場合 elsif c == "\017" then # 文章の表示速度を初期化 @speed = 0 # ポーズサインを表示する self.pause = true # ボタン待ちフラグをオン @press = true # インデックスを進める @text_index += 1 # メソッドを返す return true end # 文字を描画 self.contents.draw_text(@text_x, 0, 40, 24, c) # @text_x に描画した文字の幅を加算 @text_x += self.contents.text_size(c).width # インデックスを進める @text_index += 1 return true end #-------------------------------------------------------------------------- # ● ウェイトの終了 #-------------------------------------------------------------------------- def wait_end # ボタン入力待ちフラグをオフ @press = false # ポーズサインを非表示にする self.pause = false # ウィンドウを不可視にする self.visible = false # ボタン入力待ちフラグをオフ @press = false end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ボタン入力待ちフラグがオンの場合 if @press == true then super # C ボタンが押された場合 if Input.trigger?(Input::C) == true then # ウェイトの終了 wait_end end # メソッドを返す return end # 更新が可能なフレームでない場合 if @speed != 0 and (Graphics.frame_count % @speed != 0) then # メソッドを返す return end # テロップを更新中の場合 if text_update == true then # スピードが 0 の場合 if @speed == 0 then update end # メソッドを返す return else # 文章の表示速度を最速化 @speed = 1 end end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- alias :terminate_MITO_RGSS3_04 :terminate def terminate # 元の処理を実行 terminate_MITO_RGSS3_04 # レベルアップウィンドウが有効な場合 unless @lvup_window.nil? # レベルアップウィンドウを解放 @lvup_window.dispose # センターヘルプウィンドウを解放 @center_help_window.dispose end end #-------------------------------------------------------------------------- # ● 終了前処理 #-------------------------------------------------------------------------- alias :pre_terminate_MITO_RGSS3_04 :pre_terminate def pre_terminate # アフターバトルフェーズ中の場合 if $game_temp.after_battle_phase == true then # アクティブレベルアップVXAが有効な場合 if MINTO::RGSS["Active_Lv_UpVX"] # アフターバトルフェーズの開始 start_after_battle_phase # ポーズサインを表示する @active_gauge_window.pause = true # ループ処理 loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # ウィンドウを更新 @active_gauge_window.update # C ボタンが押された場合 if Input.trigger?(Input::C) == true then break end end end # 第二アフターバトルフェーズの開始 start_second_after_battle_phase end # アフターバトルフェーズをクリア $game_temp.after_battle_phase = false # 元の処理を実行 pre_terminate_MITO_RGSS3_04 end #-------------------------------------------------------------------------- # ● 第二アフターバトルフェーズの準備 #-------------------------------------------------------------------------- def reservation_second_after_battle_phase # レベルアップウィンドウを作成 @lvup_window = Window_Lvup_Data.new # センターヘルプウィンドウを作成 @center_help_window = Window_BattleCenter_Help.new @last_skills_array = [] # ループ処理(パーティー) for i in 0...$game_party.all_members.size do # アクターを取得 actor = $game_party.all_members[i] # 最終能力値を保存 save_last_parameter(actor) # スキルを保存 @last_skills_array[i] = actor.skills.dup end end #-------------------------------------------------------------------------- # ● 第二アフターバトルフェーズの開始 #-------------------------------------------------------------------------- def start_second_after_battle_phase # レベルアップモーション level_up_motion end #-------------------------------------------------------------------------- # ● 最終能力値の記憶 # actor : アクター #-------------------------------------------------------------------------- def save_last_parameter(actor) @lvup_window.data[actor] = [] @lvup_window.data[actor][0] = actor.level @lvup_window.data[actor][1] = actor.base_param(0) @lvup_window.data[actor][2] = actor.base_param(1) @lvup_window.data[actor][3] = actor.base_param(2) @lvup_window.data[actor][4] = actor.base_param(3) @lvup_window.data[actor][5] = actor.base_param(4) @lvup_window.data[actor][6] = actor.base_param(5) @lvup_window.data[actor][7] = actor.base_param(6) @lvup_window.data[actor][8] = actor.base_param(7) end #-------------------------------------------------------------------------- # ● 現在のパラメータの取得 # actor : アクター # index : 項目 #-------------------------------------------------------------------------- def look_parameter(actor, index) # 項目に応じて分岐 case index when 0 then return actor.level else return actor.base_param(index - 1) end end #-------------------------------------------------------------------------- # ● 習得したスキルの表示 # actor : アクター #-------------------------------------------------------------------------- def learning_skills_pop(actor) learning_skills = [] # ループ処理 for skill in actor.skills do # 未収得のスキルの場合 unless @last_skills_array[actor.index].include?(skill) then # 習得したスキルを取得 learning_skills.push(skill) end end # スキルを習得していない場合 if learning_skills.empty? then # メソッドを返す return end # ループ処理 for skill in learning_skills do wait_count = 128 # 習得MEを演奏 data = MINTO::Skill_SE_Data Audio.se_play(data[0], data[1], data[2]) # スキル名を表示 @center_help_window.set_text("\\c[1]#{skill.name}\\c[0]を習得した!") # 表示が終わるまでループ while @center_help_window.visible == true do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # センターヘルプウィンドウを更新 @center_help_window.update wait_count -= 1 if wait_count.zero? then @center_help_window.wait_end end end end end #-------------------------------------------------------------------------- # ● レベルアップモーション #-------------------------------------------------------------------------- def level_up_motion # ポップ作成 @pop = Mint_Pop.new # ループ処理(パーティー) for id in 0...$game_party.all_members.size do # アクターを取得 actor = $game_party.all_members[id] # レベルが上がっていない場合 if @lvup_window.data[actor][0] == actor.level then # 次のアクターへ next end # パラメータウィンドウをリフレッシュ @lvup_window.refresh(actor) # レベルが上がっている場合 if @lvup_window.data[actor][0] < actor.level then # パラメータウィンドウを表示 @lvup_window.visible = true # ループ処理 for i in (0..8) do # 描写座標を設定 x = 144 y = 66 + (i * 24) # 上昇したパラメータを読み込む parameter = look_parameter(actor, i) # 結果を収納する string = "+#{parameter - @lvup_window.data[actor][i]}" # 上昇後のパラメータを設定 @lvup_window.data[actor][i] = parameter # パラメータウィンドウをリフレッシュ @lvup_window.draw_status(actor, i) # ポップ描写 @pop.string_pop(string, x, y) # ウェイトカウントを設定 wait = i == 8 ? 160 : 6 # ポップSEを演奏 data = MINTO::SE_Data Audio.se_play(data[0], data[1], data[2]) # フレーム更新 wait.times do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # スプライトセットを更新 @spriteset.update # ポップを更新 @pop.update # パラメータウィンドウを更新 @lvup_window.update # 最終インデックスの場合 if i == 8 then # ポーズサインを表示する @lvup_window.pause = true # C ボタンが押された場合 if Input.trigger?(Input::C) == true then # ポーズサインを非表示にする @lvup_window.pause = false # 更新を中断 break end end end end end # 習得したスキルを表示 learning_skills_pop(actor) # ポップを解放 @pop.dispose end # ポーズサインを表示する @lvup_window.pause = true # ループ処理 loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # ウィンドウを更新 @lvup_window.update # C ボタンが押された場合 if Input.trigger?(Input::C) == true then break end end # パラメータウィンドウを閉じる @lvup_window.visible = false end end #============================================================================== # ■ Mint_Pop #------------------------------------------------------------------------------ #  数字のスプライト表示を扱うクラスです。 #============================================================================== class Mint_Pop #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @string_pop_sprite = [] @string_pop_duration = [] end #-------------------------------------------------------------------------- # ● ストリングポップ # string : 求められた文字列 # x : X座標 # y : Y座標 #-------------------------------------------------------------------------- def string_pop(string = "", x = 0, y = 0) # string が無効なら処理を終了 return if string == "" wlh = 24 # スプライトを生成 string_pop_sprite = Sprite.new # 文字を描写 string_pop_sprite.bitmap = Bitmap.new(96, 40) string_pop_sprite.bitmap.font.size = 17 string_pop_sprite.bitmap.font.shadow = false string_pop_sprite.bitmap.font.color.set(0, 0, 0) string_pop_sprite.bitmap.draw_text(-1, 12-1, 96, wlh, string, 1) string_pop_sprite.bitmap.draw_text(+1, 12-1, 96, wlh, string, 1) string_pop_sprite.bitmap.draw_text(-1, 12+1, 96, wlh, string, 1) string_pop_sprite.bitmap.draw_text(+1, 12+1, 96, wlh, string, 1) string_pop_sprite.bitmap.font.color.set(128, 255, 224) string_pop_sprite.bitmap.draw_text(0, 12, 96, wlh, string, 1) # 座標データを代入 string_pop_sprite.x = x string_pop_sprite.y = y string_pop_sprite.z = 10032 # 配列の先頭にシフト @string_pop_sprite.unshift(string_pop_sprite) @string_pop_duration.unshift(40) end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # ループ処理 for i in 0...@string_pop_sprite.size do # 有効なスプライトの場合 unless @string_pop_sprite[i].nil? then # スプライトを解放 @string_pop_sprite[i].bitmap.dispose @string_pop_sprite[i].dispose @string_pop_sprite[i] = nil @string_pop_duration[i] = nil end end # 配列内容をクリア @string_pop_sprite.clear @string_pop_duration.clear end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # 1つでもストリングポップが表示中の場合 if @string_pop_sprite.size > 0 # 表示中のストリングポップを1つずつ処理する for i in 0...@string_pop_sprite.size # ストリングポップを代入 string = @string_pop_sprite[i] # カウントが0の場合 if @string_pop_duration[i] == 0 # 次の処理へ next end # カウントを減らす @string_pop_duration[i] -= 1 # 残りカウントに応じて分岐 case @string_pop_duration[i] when 36..39 string.y -= 4 string.blend_type = 1 when 33..37 string.y -= 2 string.blend_type = 1 when 32..34 string.y += 2 string.blend_type = 0 when 25..32 string.y += 4 string.blend_type = 0 end end end end end end