#============================================================================== # ■ RGSS3 メニューカスタマイズ 基本スクリプト Ver1.00 by 星潟 #------------------------------------------------------------------------------ # メニューレイアウトを大幅に変更します。 # 共通部分を設定する為のスクリプトで、これ単独では機能しません。 #============================================================================== # 最低でも、以下のいずれかの # 設定スクリプトを追加で導入して下さい。 #------------------------------------------------------------------------------ # 画面サイズ544×416向け 縦型アクター少数表示 # 画面サイズ544×416向け 縦型アクター多数表示 # 画面サイズ544×416向け 横型アクター少数表示 # 画面サイズ544×416向け 横型アクター多数表示 # 画面サイズ544×416向け 横型ピクチャ特化 # 画面サイズ640×480向け 縦型アクター少数表示 # 画面サイズ640×480向け 縦型アクター多数表示 # 画面サイズ640×480向け 横型アクター少数表示 # 画面サイズ640×480向け 横型アクター多数表示 # 画面サイズ640×480向け 横型ピクチャ特化 #============================================================================== module MenuCustomize #アクターメニュー画像変数IDの設定用キーワードを指定 Word1 = "アクターメニュー画像変数ID" #ステートメニュー画像優先度の設定用キーワードを指定 Word2 = "ステートメニュー画像優先度" #装備メニュー画像優先度の設定用キーワードを指定 Word3 = "装備メニュー画像優先度" #★オリジナル画像のフォルダと内容に関する設定--------------------------------- #オリジナル画像をどのフォルダから呼び出すかを指定 #0の場合はバトラー画像フォルダ #1の場合はピクチャ画像フォルダ #2の場合はシステム画像フォルダ OBGFolderType = 0 #オリジナル画像のファイル名の先頭につける文字列を指定 OBGFileBase = "" #オリジナル画像の判別用IDの間に入れる文字列を指定 OBGIDConnect = "-" #オリジナル画像をアクター1人につき #何種類の識別IDで判定するかを指定 #"actor_id" #"class_id" #"smo_graphic_vid" #"smo_graphic_sp" #"smo_graphic_eid" #"face_name" #"face_index" #基本、上記6種類を好みの順で , で区切って設定する。 #あくまでスクリプトとしての読み込みなので #スクリプトへの理解があれば、アクターで読みこめるものを任意で入れてもいい。 #例共通.OBGFileBaseが"MenuActorGraphic"、OBGIDConnectが"-"とする。 #例1.OBGFileType = ["id","class_id","smo_graphic_vid","smo_graphic_sp","smo_graphic_eid"] #この場合、アクターIDが1、職業IDが2、 #アクターに対応した変数(スクリプト最上部あたりを確認)に格納された値が3、 #ステートの中で最も画像優先度(スクリプト最上部あたりを確認)が高い物の値が4、 #装備の中で最も優先度が高い物の値が5の時 #呼び出される画像はMAG1-2-3-4-5となる。 #例2.OBGFileType = ["face_name","face_index + 1"] #この場合、顔グラフィックのファイル名が"Actor1"、 #顔グラフィックのインデックスが5の時 #(左上を0として数えはじめ、右側に数えて行く。つまり5は2段目の左から2番目) #face_nameはActor1、face_index + 1は6となるので #呼び出される画像はMAGActor1-6となる。 OBGFileType = ["face_name","face_index + 1"] end class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # 開始処理 #-------------------------------------------------------------------------- alias start_menu_custumize start def start start_menu_custumize @command_window.x = MenuCustomize::MCX @command_window.y = MenuCustomize::MCY @command_window.opacity = MenuCustomize::MCO @gold_window.x = MenuCustomize::GWX @gold_window.y = MenuCustomize::GWY @gold_window.menu_custumize_window_width = MenuCustomize::GWW @gold_window.opacity = MenuCustomize::GWO @status_window.x = MenuCustomize::MSX @status_window.y = MenuCustomize::MSY @status_window.opacity = MenuCustomize::MSO create_menu_custumize_dummy_window(@command_window,@status_window) end #-------------------------------------------------------------------------- # 特殊作業用にウィンドウを作成 #-------------------------------------------------------------------------- def create_menu_custumize_dummy_window(command_window,status_window) @menu_custumize_dummy_window = Window_MenuCustomizeDummy.new(command_window,status_window) end end class Window_Selectable < Window_Base #-------------------------------------------------------------------------- # 項目を描画する矩形の取得(テキスト用) #-------------------------------------------------------------------------- alias item_rect_for_text_menu_customize item_rect_for_text def item_rect_for_text(index) r = item_rect_for_text_menu_customize(index) if @menu_command_item_rect_icon_add_flag r.x += MenuCustomize::MCT r.width += MenuCustomize::MCT * 2 end r end end class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width MenuCustomize::MCW end #-------------------------------------------------------------------------- # 桁数の取得 #-------------------------------------------------------------------------- def col_max MenuCustomize::MCC end #-------------------------------------------------------------------------- # 表示行数の取得 #-------------------------------------------------------------------------- def visible_line_number (@list.size / col_max) + ((@list.size % col_max) == 0 ? 0 : 1) end #-------------------------------------------------------------------------- # 横に項目が並ぶときの空白の幅を取得 #-------------------------------------------------------------------------- def spacing MenuCustomize::MCS end end class Window_Gold < Window_Base attr_accessor :menu_custumize_window_width #-------------------------------------------------------------------------- # ウィンドウ幅の取得 #-------------------------------------------------------------------------- alias window_width_menu_custumize window_width def window_width return @menu_custumize_window_width if @menu_custumize_window_width window_width_menu_custumize end #-------------------------------------------------------------------------- # ウィンドウ幅の変更 #-------------------------------------------------------------------------- def menu_custumize_window_width=(new_width) @menu_custumize_window_width = new_width self.width = window_width create_contents refresh end end class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width MenuCustomize::MSW end #-------------------------------------------------------------------------- # ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height MenuCustomize::MSH end #-------------------------------------------------------------------------- # 桁数の取得 #-------------------------------------------------------------------------- def col_max MenuCustomize::MSC end def item_width MenuCustomize::MSIW end def item_height MenuCustomize::MSIH end def spacing MenuCustomize::MSS end #-------------------------------------------------------------------------- # 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) actor = $game_party.members[index] enabled = $game_party.battle_members.include?(actor) rect = item_rect(index) draw_item_background(index) #独自画像 if MenuCustomize::MSIOBGF draw_actor_original_big_graphic(actor, rect.x + MenuCustomize::MSIOBGX, rect.y + MenuCustomize::MSIOBGY, MenuCustomize::MSIOBGW, MenuCustomize::MSIOBGH, enabled) end #顔グラフィック if MenuCustomize::MSIFF draw_actor_face(actor, rect.x + MenuCustomize::MSIFX, rect.y + MenuCustomize::MSIFY, enabled) end #歩行グラフィック if MenuCustomize::MSICHF self.contents.force_opacity_half = true if MenuCustomize::MSICHOHALF && !enabled draw_actor_graphic(actor, rect.x + MenuCustomize::MSICHX, rect.y + MenuCustomize::MSICHY) self.contents.force_opacity_half = false end #名前 if MenuCustomize::MSINF draw_actor_name(actor, rect.x + MenuCustomize::MSINX, rect.y + MenuCustomize::MSINY, MenuCustomize::MSINW) end #職業 if MenuCustomize::MSICF draw_actor_class(actor, rect.x + MenuCustomize::MSICX, rect.y + MenuCustomize::MSICY, MenuCustomize::MSICW) end #EXP if MenuCustomize::MSIEF ex = MenuCustomize::MSIEX ey = MenuCustomize::MSIEY ew = MenuCustomize::MSIEW if actor.max_level? rate = 1.0 if MenuCustomize::MSIEGF value = "-------" if MenuCustomize::MSIEVF else current_exp = actor.current_level_exp next_exp = actor.next_level_exp now_exp = actor.exp - current_exp rate = now_exp.to_f / (next_exp - current_exp) if MenuCustomize::MSIEGF value = next_exp - actor.exp if MenuCustomize::MSIEVF end if MenuCustomize::MSIEGF c1a = MenuCustomize::MSIEGC1 er = Rect.new(rect.x + MenuCustomize::MSIEX, rect.y + MenuCustomize::MSIEY + MenuCustomize::MSIEGY, ew, MenuCustomize::MSIEGH) contents.fill_rect(er, Color.new(c1a[0],c1a[1],c1a[2])) c2a = MenuCustomize::MSIEGC2 c3a = MenuCustomize::MSIEGC3 er.width *= rate contents.gradient_fill_rect(er, Color.new(c2a[0],c2a[1],c2a[2]), Color.new(c3a[0],c3a[1],c3a[2])) end if MenuCustomize::MSIEVF change_color(system_color) er = Rect.new(rect.x + MenuCustomize::MSIEX, rect.y + MenuCustomize::MSIEY,MenuCustomize::MSIEW,line_height) draw_text(er,MenuCustomize::MSIEVT) change_color(normal_color) draw_text(er,value,2) end end #レベル if MenuCustomize::MSILF draw_actor_level(actor, rect.x + MenuCustomize::MSILX, rect.y + MenuCustomize::MSILY) end #HP if MenuCustomize::MSIHF draw_actor_hp(actor, rect.x + MenuCustomize::MSIHX, rect.y + MenuCustomize::MSIHY, MenuCustomize::MSIHW) end #MP if MenuCustomize::MSIMF draw_actor_mp(actor, rect.x + MenuCustomize::MSIMX, rect.y + MenuCustomize::MSIMY, MenuCustomize::MSIMW) end #TP if MenuCustomize::MSITF draw_actor_tp(actor, rect.x + MenuCustomize::MSITX, rect.y + MenuCustomize::MSITY, MenuCustomize::MSITW) end #ステート if MenuCustomize::MSISF draw_actor_icons(actor, rect.x + MenuCustomize::MSISX, rect.y + MenuCustomize::MSISY, MenuCustomize::MSISW) end end #-------------------------------------------------------------------------- # オリジナルグラフィックの描写 #-------------------------------------------------------------------------- def draw_actor_original_big_graphic(actor,x,y,w,h,enabled = true) bitmap_name = actor.menu_original_big_graphic begin case MenuCustomize::OBGFolderType when 0;bitmap = Cache.battler(bitmap_name,actor.battler_hue) when 1;bitmap = Cache.picture(bitmap_name) when 2;bitmap = Cache.system(bitmap_name) end rescue print sprintf("指定フォルダに%sというファイルはありません\r\n",bitmap_name) return end rwa = (w - bitmap.width) / 2 rha = (h - bitmap.height) contents.blt(x + rwa,y + rha,bitmap,Rect.new(rwa,rha > 0 ? 0 : rha,w,h),enabled ? 255 : 128) end end class Window_MenuCustomizeDummy < Window_Base attr_accessor :command_window attr_accessor :status_window #-------------------------------------------------------------------------- # 初期化 #-------------------------------------------------------------------------- def initialize(command_window,status_window) @command_window = command_window @status_window = status_window super(Graphics.width * 2, Graphics.height * 2,24,24) self.visible = false end #-------------------------------------------------------------------------- # 更新 #-------------------------------------------------------------------------- def update super end #-------------------------------------------------------------------------- # 解放 #-------------------------------------------------------------------------- def dispose super end end class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # オリジナルグラフィックの描写 #-------------------------------------------------------------------------- def menu_original_big_graphic t = MenuCustomize::OBGFileBase.clone MenuCustomize::OBGFileType.each_with_index {|w,i| t += MenuCustomize::OBGIDConnect if i != 0 t += eval(w).to_s} t end #-------------------------------------------------------------------------- # オリジナルグラフィックのステート用判定値 #-------------------------------------------------------------------------- def smo_graphic_sp v = 0 states.each {|s| v = s.smo_graphic_sp if v < s.smo_graphic_sp} v end #-------------------------------------------------------------------------- # オリジナルグラフィックの変数用判定値 #-------------------------------------------------------------------------- def smo_graphic_vid v = $data_actors[id].smo_graphic_vid v != 0 ? $game_variables[v] : 0 end #-------------------------------------------------------------------------- # オリジナルグラフィックの装備用判定値 #-------------------------------------------------------------------------- def smo_graphic_eid v = 0 equips.compact.each {|e| v = e.smo_graphic_eid if v < e.smo_graphic_eid} v end end class RPG::Actor < RPG::BaseItem #-------------------------------------------------------------------------- # オリジナルグラフィックの変数用判定値 #-------------------------------------------------------------------------- def smo_graphic_vid @smo_graphic_vid ||= /<#{MenuCustomize::Word1}[::](\d+)>/ =~ note ? $1.to_i : 0 end end class RPG::State < RPG::BaseItem #-------------------------------------------------------------------------- # オリジナルグラフィックのステート用判定値 #-------------------------------------------------------------------------- def smo_graphic_sp @smo_graphic_sp ||= /<#{MenuCustomize::Word2}[::](\d+)>/ =~ note ? $1.to_i : 0 end end class RPG::EquipItem < RPG::BaseItem #-------------------------------------------------------------------------- # オリジナルグラフィックの装備用判定値 #-------------------------------------------------------------------------- def smo_graphic_eid @smo_graphic_eid ||= /<#{MenuCustomize::Word3}[::](\d+)>/ =~ note ? $1.to_i : 0 end end class Bitmap attr_accessor :force_opacity_half unless method_defined?(:blt_force_opacity_half) alias blt_force_opacity_half blt def blt(x, y, src_bitmap, src_rect, opacity = 255) opacity /= 2 if @force_opacity_half blt_force_opacity_half(x, y, src_bitmap, src_rect, opacity) end end end