#============================================================================== # ■ RGSS2 使用不可キャラクターフェイス半透明化&テキスト表示 Ver1.00 by 星潟 #------------------------------------------------------------------------------ # アイテム画面とスキル画面で使用しても効果のないキャラクターは # 顔グラフィックが半透明になり # 使用不可能な事を示すテキストを表示するように仕様を変更します。 # 基本的にデフォルト仕様しか対応していません。 #============================================================================== module T_UNUSE_ITEM #使用できないキャラクターの顔グラフィック上に表示する #テキストを設定します。 WORD = "-DISABLE-" #テキストのY座標表示位置を調整します。 #0〜3までの値が適正範囲です。(小数点設定可) LINE = 3 end class Game_Temp attr_accessor :temp_unuse_actor attr_accessor :temp_unuse_item attr_accessor :temp_unuse_face_flag end class Window_Base < Window #-------------------------------------------------------------------------- # アクターの顔グラフィック描写 #-------------------------------------------------------------------------- alias draw_actor_face_unuse_inv_face draw_actor_face def draw_actor_face(actor, x, y, size = 96) #一時アイテム/スキル情報が存在する時は #情報に応じてテストを行い、顔グラフィック描写フラグを変更する。 if $game_temp.temp_unuse_item != nil if $game_temp.temp_unuse_item.is_a?(RPG::Skill) user = $game_temp.temp_unuse_actor $game_temp.temp_unuse_face_flag = actor.skill_test(user, $game_temp.temp_unuse_item) end $game_temp.temp_unuse_face_flag = actor.item_test(actor, $game_temp.temp_unuse_item) if $game_temp.temp_unuse_item.is_a?(RPG::Item) end flag = $game_temp.temp_unuse_face_flag != nil && !$game_temp.temp_unuse_face_flag #本来の処理を実行する。 draw_actor_face_unuse_inv_face(actor, x, y, size) #使用不可メッセージを描写。 self.contents.draw_text(x, y + WLH * T_UNUSE_ITEM::LINE, 96, WLH, T_UNUSE_ITEM::WORD, 1) if flag #顔グラフィック描写フラグを消去する。 $game_temp.temp_unuse_face_flag = nil end #-------------------------------------------------------------------------- # 顔グラフィック描写 #-------------------------------------------------------------------------- alias draw_face_unuse_inv_face draw_face def draw_face(face_name, face_index, x, y, size = 96) #顔グラフィック描写フラグが存在しないか、有効な場合 if $game_temp.temp_unuse_face_flag == nil or $game_temp.temp_unuse_face_flag #本来の処理を実行する。 draw_face_unuse_inv_face(face_name, face_index, x, y, size) else #本来の処理のコピーで必要な部分を変更する。 bitmap = Cache.face(face_name) rect = Rect.new(0, 0, 0, 0) rect.x = face_index % 4 * 96 + (96 - size) / 2 rect.y = face_index / 4 * 96 + (96 - size) / 2 rect.width = size rect.height = size #顔グラフィックを半透明で表示する。 self.contents.blt(x, y, bitmap, rect, 128) bitmap.dispose end end end class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # 終了 #-------------------------------------------------------------------------- alias terminate_unuse_inv_face terminate def terminate #アイテム情報を消去する。 $game_temp.temp_unuse_item = nil #本来の処理を実行する。 terminate_unuse_inv_face end #-------------------------------------------------------------------------- # アイテムの決定 #-------------------------------------------------------------------------- alias determine_item_unuse_inv_face determine_item def determine_item #アイテムの情報を記録する。 $game_temp.temp_unuse_item = @item #本来の処理を実行する。 determine_item_unuse_inv_face end #-------------------------------------------------------------------------- # ターゲットウィンドウの表示 #-------------------------------------------------------------------------- alias show_target_window_unuse_inv_face show_target_window def show_target_window(right) #ターゲットウィンドウをリフレッシュし、顔グラフィックを変更しておく。 @target_window.refresh #本来の処理を実行する。 show_target_window_unuse_inv_face(right) end end class Scene_Skill < Scene_Base #-------------------------------------------------------------------------- # 終了 #-------------------------------------------------------------------------- alias terminate_unuse_inv_face terminate def terminate #使用者情報を消去する。 $game_temp.temp_unuse_actor = nil #スキル情報を消去する。 $game_temp.temp_unuse_item = nil #本来の処理を実行する。 terminate_unuse_inv_face end #-------------------------------------------------------------------------- # スキルの決定 #-------------------------------------------------------------------------- alias determine_skill_unuse_inv_face determine_skill def determine_skill #使用者情報を記録する。 $game_temp.temp_unuse_actor = @actor #スキルの情報を記録する。 $game_temp.temp_unuse_item = @skill #本来の処理を実行する。 determine_skill_unuse_inv_face end #-------------------------------------------------------------------------- # ターゲットウィンドウの表示 #-------------------------------------------------------------------------- alias show_target_window_unuse_inv_face show_target_window def show_target_window(right) #ターゲットウィンドウをリフレッシュし、顔グラフィックを変更しておく。 @target_window.refresh #本来の処理を実行する。 show_target_window_unuse_inv_face(right) end end