=begin ■しかし、何も見つからなかった(壷などのオブジェクトを指定して編)Ver.1.0 これはDAIpage様のしかし、何も見つからなかったのスクリプトを足元ではなく指定したオブジェクト(マップタイル)のみで コモンイベントを起動させるようにriruが改造したものです。 「○○は あしもとをしらべた! しかし 何もみつからなかった!」 → 壷を調べる⇒「○○は壷を調べた。しかし何も見つからなかった」というふうに。 ですのでこのスクリプトに関しての質問はDAIpege様のところにはしないようお願いします。 ■しかし、何も見つからなかった RGSS2 DAIpage■ v1.0 ●機能● ・決定ボタンをイベント等が何もない場所で押した場合にコモンイベントを起動します。  「○○は あしもとをしらべた! しかし 何もみつからなかった!」みたいな。 ●使用法● ・カスタマイズでコモンイベントIDを設定して下さい。   ●再定義している箇所●  Game_Playerをエイリアス  ※同じ箇所を変更するスクリプトと併用した場合は競合する可能性があります。 ●更新履歴●  09/09/15:公開 =end #============================================================================ # ■ カスタマイズ項目 #============================================================================ module Riru_MAP_Auto_Event # コモンイベントID ID = 21 # タイル番号 : 0 から 255 までの タイルの番号 # # 左上から 右に向かって 0 1 2 3 4 5 6 7 の並び # 左上から 下に向かって 0 8 16 24 32 … 248 の並び # # 例) 上から 1番目 (0×8) + 左から 1番目 (0) の番号は 0 # 4番目 (3×8) + 8番目 (7) の番号は 31 # ▼ 適応させるタイル番号 (ここでは壷)( , で区切る) TileA = [] TileB = [] TileC = [200,201] TileD = [172] TileE = [] #-------------------------------------------------------------------------- # 対応させるオブジェクトとコモンイベントを増やしたい場合は、以下のようにIDとTileを適当な名前に書き換えて増やしていきます。 #その際他のところに関連付けるのも忘れずに。 #-------------------------------------------------------------------------- ID2 = 100 # ▼ 適応させるタイル番号 (ここでは棚)( , で区切る) TileA2 = [] TileB2 = [] TileC2 = [58,59,60,61,62,63,72,73,74,75,76,77,78,79,80,120,121,122,123] TileD2 = [] TileE2 = [] ID3 = 101 # ▼ 適応させるタイル番号 (ここでは木箱)( , で区切る) TileA3 = [] TileB3 = [] TileC3 = [224,225,226,227,232,233,234,235,240,241,243,251] TileD3 = [170] TileE3 = [] end #============================================================================== # ■ Game_Player #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● 正面のイベント起動判定 #-------------------------------------------------------------------------- alias dai_not_event_check_event_trigger_there check_event_trigger_there def check_event_trigger_there(triggers) dai_not_event_check_event_trigger_there(triggers) check_not_map_event check_not_map_event2 check_not_map_event3 end #-------------------------------------------------------------------------- # ● マップID特殊イベントの起動チェック #-------------------------------------------------------------------------- def check_not_map_event return false if $game_map.interpreter.running? if @direction == 2 if $game_map.common_floor?(x, y + 1) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID end elsif @direction == 4 if $game_map.common_floor?(x - 1, y) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID end elsif @direction == 6 if $game_map.common_floor?(x + 1, y) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID end elsif @direction == 8 if $game_map.common_floor?(x, y - 1) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID end end end #-------------------------------------------------------------------------- # ● マップID特殊イベントの起動チェック #-------------------------------------------------------------------------- def check_not_map_event2 return false if $game_map.interpreter.running? if @direction == 2 if $game_map.common_floor2?(x, y + 1) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID2 end elsif @direction == 4 if $game_map.common_floor2?(x - 1, y) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID2 end elsif @direction == 6 if $game_map.common_floor2?(x + 1, y) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID2 end elsif @direction == 8 if $game_map.common_floor2?(x, y - 1) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID2 end end end #-------------------------------------------------------------------------- # ● マップID特殊イベントの起動チェック #-------------------------------------------------------------------------- def check_not_map_event3 return false if $game_map.interpreter.running? if @direction == 2 if $game_map.common_floor3?(x, y + 1) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID3 end elsif @direction == 4 if $game_map.common_floor3?(x - 1, y) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID3 end elsif @direction == 6 if $game_map.common_floor3?(x + 1, y) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID3 end elsif @direction == 8 if $game_map.common_floor3?(x, y - 1) $game_temp.common_event_id = Riru_MAP_Auto_Event::ID3 end end end end #============================================================================== # ■ Game_Map #============================================================================== class Game_Map #-------------------------------------------------------------------------- # ● 床の判定 #-------------------------------------------------------------------------- def common_floor?(x, y) for i in [2, 1, 0] tile_id = @map.data[x, y, i] next if tile_id == nil return true if $game_temp.common_floor.include?(tile_id) end return false end #-------------------------------------------------------------------------- # ● 床の判定 #-------------------------------------------------------------------------- def common_floor2?(x, y) for i in [2, 1, 0] tile_id = @map.data[x, y, i] next if tile_id == nil return true if $game_temp.common_floor2.include?(tile_id) end return false end #-------------------------------------------------------------------------- # ● 床の判定 #-------------------------------------------------------------------------- def common_floor3?(x, y) for i in [2, 1, 0] tile_id = @map.data[x, y, i] next if tile_id == nil return true if $game_temp.common_floor3.include?(tile_id) end return false end end #============================================================================== # ■ Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :common_floor attr_accessor :common_floor2 attr_accessor :common_floor3 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias :common_floor_temp :initialize def initialize common_floor_temp setting_common_floor setting_common_floor2 setting_common_floor3 end #-------------------------------------------------------------------------- # ● タイルデータ の設定 #-------------------------------------------------------------------------- def setting_common_floor @common_floor = [] for type in 0..4 case type when 0; tiles = Riru_MAP_Auto_Event::TileA when 1; tiles = Riru_MAP_Auto_Event::TileB when 2; tiles = Riru_MAP_Auto_Event::TileC when 3; tiles = Riru_MAP_Auto_Event::TileD when 4; tiles = Riru_MAP_Auto_Event::TileE end for i in tiles do @common_floor.concat(Tilenumber.tile_data(type, i)) end end end #-------------------------------------------------------------------------- # ● タイルデータ の設定 #-------------------------------------------------------------------------- def setting_common_floor2 @common_floor2 = [] for type in 0..4 case type when 0; tiles = Riru_MAP_Auto_Event::TileA2 when 1; tiles = Riru_MAP_Auto_Event::TileB2 when 2; tiles = Riru_MAP_Auto_Event::TileC2 when 3; tiles = Riru_MAP_Auto_Event::TileD2 when 4; tiles = Riru_MAP_Auto_Event::TileE2 end for i in tiles do @common_floor2.concat(Tilenumber.tile_data(type, i)) end end end #-------------------------------------------------------------------------- # ● タイルデータ の設定 #-------------------------------------------------------------------------- def setting_common_floor3 @common_floor3 = [] for type in 0..4 case type when 0; tiles = Riru_MAP_Auto_Event::TileA3 when 1; tiles = Riru_MAP_Auto_Event::TileB3 when 2; tiles = Riru_MAP_Auto_Event::TileC3 when 3; tiles = Riru_MAP_Auto_Event::TileD3 when 4; tiles = Riru_MAP_Auto_Event::TileE3 end for i in tiles do @common_floor3.concat(Tilenumber.tile_data(type, i)) end end end end module Tilenumber #-------------------------------------------------------------------------- # ● タイル暗号 の取得 (配列) # type : 床の種類 (0〜4 : A〜E) # index : タイル番号 #-------------------------------------------------------------------------- def self.tile_data(type, index) if type == 0 # Aタイル if index < 128 result = [] for i in 0...48 result.push(i + index * 48 + 2048) end return result else # パーツ5 の場合 return [index + 1408] end else # Bタイル以降 return [(type - 1) * 256 + index] end return [] end #-------------------------------------------------------------------------- # ● タイルタイプ の取得 # data : タイル暗号 #-------------------------------------------------------------------------- def self.tile_type(data) if data >= 1280 # Aタイル return 0 else return (data / 256 + 1) end return nil end #-------------------------------------------------------------------------- # ● タイル番号 の取得 # data : タイル暗号 #-------------------------------------------------------------------------- def self.tile_number(data) if data >= 1280 # Aタイル if data >= 2048 return (data - 2048) / 48 else return (data - 1408) end else return (data % 256) end return nil end end #//////////////////////////////////////////////////////////////// #作成者: riru #サイト: ガラス細工の夢幻 # URL: http://sky.geocities.jp/likilia_dilsena/ #readmeやスタッフロールの明記,使用報告は任意. #////////////////////////////////////////////////////////////////