赞 | 170 |
VIP | 6 |
好人卡 | 208 |
积分 | 230 |
经验 | 137153 |
最后登录 | 2024-11-18 |
在线时间 | 8639 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 22968
- 在线时间
- 8639 小时
- 注册时间
- 2011-12-31
- 帖子
- 3367
|
本帖最后由 tseyik 于 2014-10-15 10:12 编辑
http://blog.livedoor.jp/kurement ... hives/32091238.html
範例
把ZERO_REGION_SEE_MODE = 0改成1
Project27.rar
(312.45 KB, 下载次数: 91)
- #==============================================================================
- # ■リージョン可視領域設定 for RGSS3 Ver1.02-β
- # □作成者 kure
- #===============================================================================
- module KURE
- module RegionSee
- REGION_SEE = []
- NORMAL_REGION = []
- NORMAL_MAP = []
-
- #適用區域設定
- #設定以角色中心可見的範囲(図塊)。
- AREA_X = 30
- AREA_Y = 30
-
- #設定不適用這設定之MAPID設定
- NORMAL_MAP = []
-
- #通常區域
- #已設置區設置不適用於
- NORMAL_REGION = []
-
- ##設置多個區域
- #REGION_SEE[區域編號]=和[可見區域]
- REGION_SEE[6] = [1,2]
- REGION_SEE[7] = [2,3]
- REGION_SEE[8] = [2,4]
- REGION_SEE[9] = [4,5]
-
- #未設置區域的處理方法
-
- #表示設定
- # 0 = 進入己設定区域後変不可見
- # 1 = 總是可見
- ZERO_REGION_SEE_MODE = 0
-
- #動作処理
- # 0 = 他のリージョンと同じ動作(リージョン未設定のみ見える)
- # 1 = 全てのマスが見える
- ZERO_REGION_ACT_MODE = 1
-
- end
- end
- #==============================================================================
- # ■ Sprite_Character
- #==============================================================================
- class Sprite_Character < Sprite_Base
- #--------------------------------------------------------------------------
- # ● その他の更新(再定義)
- #--------------------------------------------------------------------------
- def update_other
- self.opacity = @character.opacity
- self.blend_type = @character.blend_type
- self.bush_depth = @character.bush_depth
- self.visible = [email protected] && [email protected]
- end
- end
- #==============================================================================
- # ■ Game_Map
- #==============================================================================
- class Game_Map
- attr_accessor :keep_map_data # マップデータ保存
- #--------------------------------------------------------------------------
- # ● セットアップ(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_transcolor_before_setup setup
- def setup(map_id)
- k_transcolor_before_setup(map_id)
- @keep_map_data = @map.data.clone
- end
- #--------------------------------------------------------------------------
- # ● 指定座標にあるタイル ID の取得(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_transcolor_before_tile_id tile_id
- def tile_id(x, y, z)
- if @keep_map_data
- return @keep_map_data[x, y, z] if @keep_map_data[x, y, z]
- return 0 unless @keep_map_data[x, y, z]
- end
-
- k_transcolor_before_tile_id(x, y, z)
- end
- end
- #==============================================================================
- # ■ Game_CharacterBase
- #==============================================================================
- class Game_CharacterBase
- attr_accessor :transparent2 # 透明状態
- end
- #==============================================================================
- # ■ Game_Player
- #==============================================================================
- class Game_Player < Game_Character
- attr_accessor :keep_passed_region # リージョンID保存
- #--------------------------------------------------------------------------
- # ● 歩数増加(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_transcolor_before_increase_steps increase_steps
- def increase_steps
- refresh_region_tile(@x, @y) unless KURE::RegionSee::NORMAL_MAP.include?($game_map.map_id)
- k_transcolor_before_increase_steps
- end
- #--------------------------------------------------------------------------
- # ● 場所移動の実行(エイリアス再定義)
- #--------------------------------------------------------------------------
- alias k_transcolor_before_perform_transfer perform_transfer
- def perform_transfer
- keep_x = @new_x
- keep_y = @new_y
- keep_id = @new_map_id
- keep_trans = 0
- keep_trans = 1 if transfer?
-
- k_transcolor_before_perform_transfer
- if keep_trans == 1
- refresh_region_tile(keep_x, keep_y) unless KURE::RegionSee::NORMAL_MAP.include?(keep_id)
- end
- end
- #--------------------------------------------------------------------------
- # ● タイルの更新(追加定義)
- #--------------------------------------------------------------------------
- def refresh_region_tile(x,y)
- id = $game_map.region_id(x, y)
-
- if @keep_passed_region != id
- @keep_passed_region = id
- width = $game_map.width
- height = $game_map.height
-
-
- x1 = [0,@x - (KURE::RegionSee::AREA_X / 2).to_i].max
- x2 = [@x + (KURE::RegionSee::AREA_X / 2).to_i,width].min
- y1 = [0,@y - (KURE::RegionSee::AREA_Y / 2).to_i].max
- y2 = [@y + (KURE::RegionSee::AREA_Y / 2).to_i,height].min
-
- rigion_area = Array.new
- #指定リージョンのエリアのみを取得
- for w in x1..x2
- for h in y1..y2
- see = 0
- event = $game_map.events_xy(w,h)
- see = 1 if $game_map.region_id(w, h) == @keep_passed_region
-
- #リージョンの設定
- if KURE::RegionSee::REGION_SEE[@keep_passed_region]
- see = 1 if KURE::RegionSee::REGION_SEE[@keep_passed_region].include?($game_map.region_id(w, h))
- end
-
- #0リージョン上では全てが見える設定の場合
- if @keep_passed_region == 0
- see = 1 if KURE::RegionSee::ZERO_REGION_ACT_MODE == 1
- end
-
- see = 1 if KURE::RegionSee::NORMAL_REGION.include?(@keep_passed_region)
-
- #0リージョンは常に見える設定の場合
- if $game_map.region_id(w, h) == 0
- see = 2 if KURE::RegionSee::ZERO_REGION_SEE_MODE == 1
- end
-
- rigion_area.push([w,h,see]) if see != 0
-
- #一旦タイルイベントを消去
- $game_map.data[w, h, 0] = 0
- $game_map.data[w, h, 1] = 0
- $game_map.data[w, h, 2] = 0
-
- event.each do |ev|
- ev.transparent2 = true
- end
-
- end
- end
-
- #見える範囲を適用する
- rigion_area.each do |area|
- if area[2] == 1
- s_x_area1 = [0,area[0] - 1].max
- s_x_area2 = [width,area[0] + 1].min
- s_y_area1 = [0,area[1] - 1].max
- s_y_area2 = [height,area[1] + 1].min
-
- for sw in s_x_area1..s_x_area2
- for sy in s_y_area1..s_y_area2
- #タイルイベントを復活
- event = $game_map.events_xy(sw,sy)
- $game_map.data[sw, sy, 0] = $game_map.keep_map_data[sw, sy, 0]
- $game_map.data[sw, sy, 1] = $game_map.keep_map_data[sw, sy, 1]
- $game_map.data[sw, sy, 2] = $game_map.keep_map_data[sw, sy, 2]
-
- event.each do |ev|
- ev.transparent2 = false
- end
-
- end
- end
-
- elsif area[2] == 2
- sw = area[0]
- sy = area[1]
- event = $game_map.events_xy(sw,sy)
- $game_map.data[sw, sy, 0] = $game_map.keep_map_data[sw, sy, 0]
- $game_map.data[sw, sy, 1] = $game_map.keep_map_data[sw, sy, 1]
- $game_map.data[sw, sy, 2] = $game_map.keep_map_data[sw, sy, 2]
-
- event.each do |ev|
- ev.transparent2 = false
- end
-
- end
- end
-
- end
- end
-
- end
复制代码 |
评分
-
查看全部评分
|