#============================================================================== # ● カー子顔グラ・歩行グラ自動変換 # # 変数で顔グラ・歩行グラを分岐させたい場合 # 「変換元」の顔グラや歩行グラを使用すると自動で切り替えるスクリプトです # # 再定義はあまり使用していないので # スクリプト素材の下の方に置く方がいいかと思われます # # 2010/11/07 初版 # 2010/11/08 イベントに初期設定したグラフィックに対応 # Actorに対応 # # STRRGSS2 ARCHIVERS 様の「STR22Core_MWEXT++」を使用される方は # このスクリプトの216行目以下のコメントを外してください # #============================================================================== module A1 module Carbuncle # カーバンクルの状態変数番号 # 0 = 宝珠あり・耳あり # 1 = 宝珠なし・耳あり # 2 = 宝珠なし・耳なし CARBUNCLE_STATE_ID = 25 #================================================================================== # 顔グラ定義 # 書式1:変換元FileName => [ [変換後FileName,Index],[変換後FileName,Index] ] # 書式2:変換元FileName_Index => [ [変換後FileName,Index],[変換後FileName,Index] ] # # 書式1の場合、変換後のIndexはnilを指定 #================================================================================== C_FACE = { "カー子F_VX" => [ ["カー子F_VX_Ex2",nil],["カー子F_VX_Ex3",nil] ], "カー子F_VX_Ex_0" => [ ["カー子F_VX_Ex",2] ,["カー子F_VX_Ex",4] ], "カー子F_VX_Ex_1" => [ ["カー子F_VX_Ex",3] ,["カー子F_VX_Ex",5] ], } #================================================================================== # 歩行グラフィック定義 # 書式1:変換元FileName => [ [変換後FileName,Index],[変換後FileName,Index] ] # 書式2:変換元FileName_Index => [ [変換後FileName,Index],[変換後FileName,Index] ] # # 書式1の場合、変換後のIndexはnilを指定 #================================================================================== C_CHAR = { "[2K-VX]-カー子C_0" => [ ["[2K-VX]-カー子C",1], ["[2K-VX]-カー子C",2] ], "[2K-VX]-カー子C_4" => [ ["[2K-VX]-カー子C",5], ["[2K-VX]-カー子C",6] ], "[2K-VX]-カー子C_Ex_4" => [ ["[2K-VX]-カー子C_Ex",5],["[2K-VX]-カー子C_Ex",6] ], } #================================================================================== # 歩行グラフィック・向き指定定義 # 書式:変換元FileName_Index_direction => [変換後direction,変換後direction,変換後direction] # # direction:下向き = 2 左向き = 4 右向き = 6 上向き = 8 #================================================================================== C_PATTERN = { "[2K-VX]-カー子C_Ex_1_8" => [0,1,2] } end end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中のすべてのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 顔グラフィックの描画 # face_name : 顔グラフィック ファイル名 # face_index : 顔グラフィック インデックス # x : 描画先 X 座標 # y : 描画先 Y 座標 # size : 表示サイズ #-------------------------------------------------------------------------- alias a1_carbuncle_draw_face draw_face def draw_face(face_name, face_index, x, y, size = 96) face_info = $game_temp.get_change_face(face_name, face_index) a1_carbuncle_draw_face(face_info[0], face_info[1], x, y, size = 96) end end #============================================================================== # ■ Game_Character #------------------------------------------------------------------------------ #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event # クラスのスーパークラスとして使用されます。 #============================================================================== class Game_Character #-------------------------------------------------------------------------- # ● グラフィックの変更 # character_name : 新しい歩行グラフィック ファイル名 # character_index : 新しい歩行グラフィック インデックス #-------------------------------------------------------------------------- alias a1_carbuncle_set_graphic set_graphic def set_graphic(character_name, character_index) character_info = $game_temp.get_change_graphic(character_name, character_index) bak = @original_pattern @original_pattern = $game_temp.get_change_pattern(character_info[0],character_info[1],@direction) @pattern = @original_pattern if bak != @original_pattern a1_carbuncle_set_graphic(character_info[0], character_info[1]) end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● グラフィックの変更 # character_name : 新しい歩行グラフィック ファイル名 # character_index : 新しい歩行グラフィック インデックス # face_name : 新しい顔グラフィック ファイル名 # face_index : 新しい顔グラフィック インデックス #-------------------------------------------------------------------------- alias a1_carbuncle_set_graphic set_graphic def set_graphic(character_name, character_index, face_name, face_index) face_info = $game_temp.get_change_face(face_name, face_index) character_info = $game_temp.get_change_graphic(character_name, character_index) a1_carbuncle_set_graphic(character_info[0], character_info[1], face_info[0], face_info[1]) end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 顔グラフィック名・Index取得 #-------------------------------------------------------------------------- def get_change_face(face_name, face_index) name_h = A1::Carbuncle::C_FACE[face_name] name_h = A1::Carbuncle::C_FACE[face_name + "_" + face_index.to_s] if name_h == nil val = $game_variables[A1::Carbuncle::CARBUNCLE_STATE_ID] if name_h != nil and val > 0 face_name = name_h[val-1][0] face_index = name_h[val-1][1] if name_h[val-1][1] != nil end return [face_name,face_index] end #-------------------------------------------------------------------------- # ● 歩行グラフィック名・Index取得 #-------------------------------------------------------------------------- def get_change_graphic(character_name, character_index) name_h = A1::Carbuncle::C_CHAR[character_name] name_h = A1::Carbuncle::C_CHAR[character_name + "_" + character_index.to_s] if name_h == nil val = $game_variables[A1::Carbuncle::CARBUNCLE_STATE_ID] if name_h != nil and val > 0 character_name = name_h[val-1][0] character_index = name_h[val-1][1] end return [character_name,character_index] end #-------------------------------------------------------------------------- # ● original_pattern取得 #-------------------------------------------------------------------------- def get_change_pattern(character_name, character_index,direction) pattern_h = A1::Carbuncle::C_PATTERN[character_name + "_" + character_index.to_s + "_" + direction.to_s] if pattern_h != nil return pattern_h[val] else return 1 end end end #============================================================================== # ■ Game_Map #------------------------------------------------------------------------------ #  マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。 # このクラスのインスタンスは $game_map で参照されます。 #============================================================================== class Game_Map #-------------------------------------------------------------------------- # ● イベントのセットアップ #-------------------------------------------------------------------------- def setup_events @events = {} # マップイベント for i in @map.events.keys @events[i] = Game_Event.new(@map_id, @map.events[i]) @events[i].set_graphic(@events[i].character_name,@events[i].character_index) end @common_events = {} # コモンイベント for i in 1...$data_common_events.size @common_events[i] = Game_CommonEvent.new(i) end end end #============================================================================== # ■ Sprite_STRFace #============================================================================== #class Sprite_STRFace < Sprite_Base # #-------------------------------------------------------------------------- # # ● フェイス設定 # #-------------------------------------------------------------------------- # alias a1_carbuncle_set_face set_face # def set_face(name, index, w, h) # # face_info = $game_temp.get_change_face(name, index) # a1_carbuncle_set_face(face_info[0], face_info[1], w, h) # end #end