以下引用zphyp120于2008-12-19 23:18:28的发言:
狠掐LZ
XY_SWITCH = 25 # 当25号开关打开,本脚本才开始工作。
以下引用西江月于2008-12-20 15:56:35的发言:
不会吧,我的可以同时显示啊!
以下引用heronba于2008-12-20 15:23:26的发言:
复制代码
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ 縮小地图的表示(ver 0.999)
- # by ピニョン clum-sea
- #==============================================================================
- #==============================================================================
- # □ 前期定义
- #==============================================================================
- module PLAN_Map_Window
- WIN_X = 8 # 地图的 X 座標
- WIN_Y = 8 # 地图的 Y 座標
- WIN_WIDTH = 8*25 # 地图的宽度
- WIN_HEIGHT = 6*25 # 地图的高度
- ZOOM = 6.0 # 地图的放缩比例
- WINDOWSKIN = "" # 自定义地图窗口素材,如果留空则是默认的
- ON_OFF_KEY = Input::A # 打开地图的按钮,A就是键盘的Z键
- SWITCH = 100 # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
- # 使用地图功能,关闭则可以使用地图功能
- WINDOW_MOVE = true # 窗口中的地图跟随移动,(true:跟随, false:固定)
- OVER_X = 632 - WIN_WIDTH # 移動后的 X 座標(初期位置と往復します)
- OVER_Y = 8 # 移動后的 Y 座標(初期位置と往復します)
- OPACITY = 192 # 窗口的透明度
- C_OPACITY = 192 # 地图的透明度
- VISIBLE = true # 最初是否可见
- end
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- attr_accessor :map_visible # 地图的表示状態
- alias plan_map_window_initialize initialize
- def initialize
- plan_map_window_initialize
- @map_visible = false
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- alias plan_map_window_main main
- def main
- @map_window = Window_Map.new
- @map_window.visible = $game_temp.map_visible
- plan_map_window_main
- @map_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- alias plan_map_window_update update
- def update
- $game_temp.map_visible = @map_window.visible
- plan_map_window_update
- unless $game_switches[PLAN_Map_Window::SWITCH]
- if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
- if @map_window.visible
- @map_window.visible = false
- else
- @map_window.visible = true
- end
- end
- else
- if @map_window.visible
- @map_window.visible = false
- end
- end
- if @map_window.visible
- @map_window.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 场所移动的变化
- #--------------------------------------------------------------------------
- alias plan_map_window_transfer_player transfer_player
- def transfer_player
- visible = @map_window.visible
- @map_window.visible = false
- plan_map_window_transfer_player
- @map_window.dispose
- @map_window = Window_Map.new
- @map_window.visible = visible
- end
- end
- #==============================================================================
- # ■ Window_Map
- #==============================================================================
- class Window_Map < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize
- x = PLAN_Map_Window::WIN_X
- y = PLAN_Map_Window::WIN_Y
- w = PLAN_Map_Window::WIN_WIDTH
- h = PLAN_Map_Window::WIN_HEIGHT
- super(x, y, w, h)
- unless PLAN_Map_Window::WINDOWSKIN.empty?
- self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
- end
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = PLAN_Map_Window::OPACITY
- self.contents_opacity = PLAN_Map_Window::C_OPACITY
- @map_data = $game_map.data
- @tileset = RPG::Cache.tileset($game_map.tileset_name)
- @autotiles = []
- for i in 0..6
- autotile_name = $game_map.autotile_names[i]
- @autotiles[i] = RPG::Cache.autotile(autotile_name)
- end
- @old_real_x = $game_player.real_x
- @old_real_y = $game_player.real_y
- @all_map = make_all_map
- self.visible = PLAN_Map_Window::VISIBLE
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 缩小图做成
- #--------------------------------------------------------------------------
- def make_all_map
- all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
- for y in 0...$game_map.height
- for x in 0...$game_map.width
- for z in 0...3
- tile_num = @map_data[x, y, z]
- next if tile_num == nil
- if tile_num < 384
- if tile_num >= 48
- tile_num -= 48
- src_rect = Rect.new(32, 2 * 32, 32, 32)
- all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
- end
- else
- tile_num -= 384
- src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
- all_map.blt(x * 32, y * 32, @tileset, src_rect)
- end
- end
- end
- end
- w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
- h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
- ret_bitmap = Bitmap.new(w, h)
- src_rect = Rect.new(0, 0, all_map.width, all_map.height)
- dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
- ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
- all_map.dispose
- return ret_bitmap
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- one_tile_size = 32 / PLAN_Map_Window::ZOOM
- x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
- y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
- x = x * one_tile_size / 128
- y = y * one_tile_size / 128
- half_width = self.contents.width * 128 / 2
- rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
- rev_x = 0
- if @all_map.width < self.contents.width
- rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
- rev_x -= (self.contents.width - @all_map.width) / 2
- x += rev_x
- elsif half_width > $game_player.real_x * one_tile_size
- rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
- x += rev_x
- elsif half_width > rest_width
- rev_x = -((half_width - rest_width) / 128)
- x += rev_x
- end
- half_height = self.contents.height * 128 / 2
- rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
- rev_y = 0
- if @all_map.height < self.contents.height
- rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
- rev_y -= (self.contents.height - @all_map.height) / 2
- y += rev_y
- elsif half_height > $game_player.real_y * one_tile_size
- rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
- y += rev_y
- elsif half_height > rest_height
- rev_y = -((half_height - rest_height) / 128)
- y += rev_y
- end
- src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
- self.contents.blt(0, 0, @all_map, src_rect)
- if PLAN_Map_Window::WINDOW_MOVE == true
- w = self.x..self.x + self.width
- h = self.y..self.y + self.height
- if w === $game_player.screen_x and h === $game_player.screen_y
- if self.x == PLAN_Map_Window::WIN_X and self.y == PLAN_Map_Window::WIN_Y
- self.x = PLAN_Map_Window::OVER_X
- self.y = PLAN_Map_Window::OVER_Y
- else
- self.x = PLAN_Map_Window::WIN_X
- self.y = PLAN_Map_Window::WIN_Y
- end
- end
- end
- if $game_party.actors.size > 0
- for i in [2, 1, 0]
- tile = @map_data[$game_player.x, $game_player.y, i]
- next if tile == 0
- return if $game_map.priorities[tile] > 0
- end
- actor = $game_party.actors[0]
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- width = bitmap.width / 4
- height = bitmap.height / 4
- src_rect = Rect.new(0, 0, width, height)
- w = width / PLAN_Map_Window::ZOOM
- h = height / PLAN_Map_Window::ZOOM
- x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
- y = self.contents.height / 2 - h / 2 - rev_y
- dest_rect = Rect.new(x, y, w, h)
- self.contents.stretch_blt(dest_rect, bitmap, src_rect)
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
- @old_real_x = $game_player.real_x
- @old_real_y = $game_player.real_y
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- def dispose
- super
- @all_map.dispose
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码
- #==========================================================================
- # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
- #==========================================================================
- XY_SWITCH = 25 # 当25号开关打开,本脚本才开始工作。
- #==============================================================================
- # ■ Window_XY
- #------------------------------------------------------------------------------
- # 显示坐标的窗口。
- #==============================================================================
- class Window_xy < Window_Base#注意前面那个window_xy是文件名
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 96)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
- self.contents = Bitmap.new(width - 32, height - 32)
- self.back_opacity = 255 # 这个是背景透明
- self.opacity = 255 # 这个是边框和背景都透明
- self.contents_opacity = 255 # 这个是内容透明
- self.visible = false
- refresh
- @x = $game_player.x
- @y = $game_player.y
- @id = $game_map.map_id
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if $game_switches=25[XY_SWITCH ] #确定开关是否打开,可以自己改变开关
- @x = $game_player.x #获取角色X坐标
- @y = $game_player.y #获取角色Y坐标
- @id = $game_map.map_id #获取地图编号
- self.contents.clear #清除以前的东西
- $mapnames = load_data("Data/MapInfos.rxdata") #读取地图名文件
- map_name = $mapnames[@id].name #获得地图名
- self.contents.font.color = normal_color#颜色,这里是白色~
- self.contents.draw_text(0, 0, 116, 32, map_name,2)
- self.contents.font.color = system_color#颜色,暗蓝色
- self.contents.draw_text(0, 32, 120, 32, "X:")#显示X这个字的位置,引号里面的内容随便改,比如"X坐标地址"
- self.contents.font.color = normal_color#颜色,这里是白色~
- self.contents.draw_text(0, 32, 52, 32, @x.to_s,2)
- self.contents.font.color = system_color#上面那个是X坐标的变量,可以自己更改变量名~
- self.contents.draw_text(64, 32, 128, 32, "Y:")#显示Y这个字~
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 32, 116, 32, @y.to_s,2)
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断文字刷新。节约内存用
- #--------------------------------------------------------------------------
- def judge
- return true if @x != $game_player.x
- return true if @y != $game_player.y
- return true if @id != $game_map.map_id
- return false
- end
- end
- ###########################################################################
- # 下面的东西不需要掌握~ #
- ###########################################################################
- class Scene_Map
- alias xy_66rpg_main main
- def main
- @xy_window = Window_xy.new
- @xy_window.x = 640 - 160
- @xy_window.y = 480 - 96
- @xy_window.opacity = 0
- xy_66rpg_main
- @xy_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- alias xy_66rpg_update update
- def update
- xy_66rpg_update
- if $game_switches[XY_SWITCH]
- @xy_window.visible = true
- @xy_window.refresh if @xy_window.judge
- else
- @xy_window.visible = false
- end
- end
- end
- #==========================================================================
- # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
- #==========================================================================
上面两个脚本第一个是 小地图的 第二个 是显坐标的, 两个脚本放在一起时,只能显示坐标,所以 想要一个即显地图又显坐标的脚本
以下引用塑望于2008-12-20 18:23:05的发言:
SWITCH = 100 # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
# 使用地图功能,关闭则可以使用地图功能
XY_SWITCH = 25 # 当25号开关打开,本脚本才开始工作。
我把两个脚本放在一起就能显示坐标啊,不显示小图?
我想说的是这两个脚本并不存在冲突...也不需要整合...
<柯南-头脑风暴>就有用到该2个脚本
以下引用西江月于2008-12-20 20:10:25的发言:
就是用4L的脚本啊
以下引用飛影于2008-12-21 2:35:12的发言:
放在一起。100的 開關是默認關閉才會顯示,所以你只要打開 25 號開關就可以
以下引用hgfor于2008-12-21 9:02:36的发言:
试试这个小地图
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
不是没有小地图,是两个脚本放在一起小地图就不显示了
#冬夜更新说明
#更改了小地图的位置,Q是开启小地图跟随开关
#S是固定小地图位置
#更新了场所移动时地图的不同步,更新了战斗后的地图不同步
#小地图默认成为FLASE,只在第一次登入时是,以后跟随开关的指示
#恩恩
#最后更新,测试过
#修正了由于小地图变化引起的不能转换问题,修休整了房间内的地图原先的那个羁押功能
#==============================================================================
# ■ 縮小地图的表示(ver 0.999)
# by ピニョン clum-sea
#==============================================================================
#==============================================================================
# □ 前期定义
#==============================================================================
module PLAN_Map_Window
WIN_X = 0 # 地图的 X 座標
WIN_Y = 0 # 地图的 Y 座標
WIN_WIDTH = 250 # 地图的宽度
WIN_HEIGHT = 200 # 地图的高度
ZOOM = 3.5 # 地图的放缩比例
WINDOWSKIN = "" # 自定义地图窗口素材,如果留空则是默认的
ON_OFF_KEY = Input::L # 打开地图的按钮,L就是键盘的Q键
SWITCH = 1 # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
# 使用地图功能,关闭则可以使用地图功能
WINDOW_MOVE = true # 窗口中的地图跟随移动,(true:跟随, false:固定)
OVER_X = 632 - WIN_WIDTH # 移動后的 X 座標(初期位置と往復します)
OVER_Y = 0 # 移動后的 Y 座標(初期位置と往復します)
OPACITY = 255 # 窗口的透明度
C_OPACITY = 255 # 地图的透明度
VISIBLE = false # 最初是否可见
SWITCH_KEY = Input::L # Q键锁定/解锁小地图
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :map_visible # 地图的表示状態
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias plan_map_window_main main
def main
$小地图 = false
@map_window = Window_Map.new
@map_window.visible = $game_switches[406]
plan_map_window_main
@map_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
alias plan_map_window_update update
def update
$game_temp.map_visible = @map_window.visible
plan_map_window_update
if $game_switches[PLAN_Map_Window::SWITCH]
if @map_window.visible
@map_window.visible = false
$game_switches[406] = false
$game_switches[405] = false
$game_variables[19] = $direction
$地图关闭 = true
end
else
if $地图关闭
@map_window.visible = true
$game_switches[406] = true
$地图关闭 = false
end
if !$game_temp.in_battle
if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
if @map_window.visible
$game_system.se_play($data_system.cancel_se)
@map_window.visible = false
$game_switches[406] = false
$game_switches[405] = false
$game_variables[19] = $direction
else
$game_system.se_play($data_system.decision_se)
@map_window.visible = true
$game_switches[406] = true
end
end
if Input.trigger?(PLAN_Map_Window::SWITCH_KEY)
if @map_window.visible
if $game_switches[405]
$game_system.se_play($data_system.cancel_se)
$game_switches[405] = false
$game_variables[19] = $direction
else
$game_system.se_play($data_system.decision_se)
$game_switches[405] = true
end
end
end
end
end
if @map_window.visible
@map_window.update
end
end
#--------------------------------------------------------------------------
# ● 场所移动的变化
#--------------------------------------------------------------------------
alias plan_map_window_transfer_player transfer_player
def transfer_player
# visible = @map_window.visible
@map_window.visible = false
plan_map_window_transfer_player
@map_window.dispose
@map_window = Window_Map.new
end
end
#==============================================================================
# ■ Window_Map
#==============================================================================
class Window_Map < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
$direction = $game_variables[19]
if $win_x != nil
x = $win_x
y = $win_y
else
case $direction
when 0
x = 0
y = 0
$win_x = x
$win_y = y
when 1
x = 382
y = 8
$win_x = x
$win_y = y
when 2
x = 8
y = 280 - 8
$win_x = x
$win_y = y
when 3
x = 382
y = 280 - 8
$win_x = x
$win_y = y
end
end
w = PLAN_Map_Window::WIN_WIDTH
h = PLAN_Map_Window::WIN_HEIGHT
$小地图 = true
super(x, y, w, h)
$小地图 = false
# @windowskin_name = $game_system.windowskin_name
# self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = PLAN_Map_Window::OPACITY
self.contents_opacity = PLAN_Map_Window::C_OPACITY
@map_data = $game_map.data
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@autotiles = []
for i in 0..6
autotile_name = $game_map.autotile_names
@autotiles = RPG::Cache.autotile(autotile_name)
end
@old_real_x = $game_player.real_x
@old_real_y = $game_player.real_y
if $game_map.width > 70 or $game_map.height > 70
$ZOOM = 2 * PLAN_Map_Window::ZOOM
else
if $game_map.width < 40 or $game_map.height < 40
$ZOOM = PLAN_Map_Window::ZOOM / 2
else
$ZOOM = PLAN_Map_Window::ZOOM
end
end
@all_map = make_all_map
self.visible = $game_switches[406]
unless PLAN_Map_Window::WINDOWSKIN.empty?
self.windowskin = RPG::Cache.windowskin("")
end
# PLAN_Map_Window::WINDOWSKIN
# self.visible = PLAN_Map_Window::VISIBLE
refresh
end
#--------------------------------------------------------------------------
# ● 缩小图做成
#--------------------------------------------------------------------------
def make_all_map
all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
for y in 0...$game_map.height
for x in 0...$game_map.width
for z in 0...3
tile_num = @map_data[x, y, z]
next if tile_num == nil
if tile_num < 384
if tile_num >= 48
tile_num -= 48
src_rect = Rect.new(32, 2 * 32, 32, 32)
all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
end
else
tile_num -= 384
src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
all_map.blt(x * 32, y * 32, @tileset, src_rect)
end
end
end
end
w = ($game_map.width / $ZOOM) * 32
h = ($game_map.height / $ZOOM) * 32
ret_bitmap = Bitmap.new(w, h)
src_rect = Rect.new(0, 0, all_map.width, all_map.height)
dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
all_map.dispose
return ret_bitmap
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.x = $win_x
self.y = $win_y
self.z = 9999 # 让窗口在最上层
@small_map = false
if $game_map.width < 80 or $game_map.height < 80
#这个是当地图大小宽和高小于指定大小时才改变大小,限制小地图窗口大小
if $game_map.width < 40 or $game_map.height < 40
#这同时限制了变换小地图的大小,防止关卡和队长办公室因为地图宽长无法切换
self.width = [@all_map.width,200].min
self.height = [@all_map.height,200].min
self.contents = Bitmap.new(width-32, height-32)
#让改变的小地图X坐标紧贴边缘
if self.x + self.width > 250
self.x = 625 - self.width
end
#让改变的小地图Y左边紧贴边缘
if self.y + self.height > 380
self.y = 470 - self.height
end
@small_map = true
end
end
if self.windowskin == nil
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
one_tile_size = 32 / $ZOOM
x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
x = x * one_tile_size / 128
y = y * one_tile_size / 128
half_width = self.contents.width * 128 / 2
rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
rev_x = 0
if @all_map.width < self.contents.width
rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
rev_x -= (self.contents.width - @all_map.width) / 2
x += rev_x
elsif half_width > $game_player.real_x * one_tile_size
rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
x += rev_x
elsif half_width > rest_width
rev_x = -((half_width - rest_width) / 128)
x += rev_x
end
half_height = self.contents.height * 128 / 2
rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
rev_y = 0
if @all_map.height < self.contents.height
rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
rev_y -= (self.contents.height - @all_map.height) / 2
y += rev_y
elsif half_height > $game_player.real_y * one_tile_size
rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
y += rev_y
elsif half_height > rest_height
rev_y = -((half_height - rest_height) / 128)
y += rev_y
end
src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
self.contents.blt(0, 0, @all_map, src_rect)
if PLAN_Map_Window::WINDOW_MOVE == true
w = self.x - 32 .. self.x + self.width + 32
h = self.y - 64 .. self.y + self.height + 64
if w === $game_player.screen_x and h === $game_player.screen_y
if !@small_map
case self.x
when 8
self.x = 382
when 382
self.x = 8
end
case self.y
when 272
self.y = 8
when 8
self.y = 272
end
else
case self.x
when 625 - self.width
self.x = 8
when 8
self.x = 625 - self.width
end
case self.y
when 470 - self.height
self.y = 8
when 8
self.y = 470 - self.height
end
end
end
end
#主角位置
if $game_party.actors.size > 0
# for i in [2, 1, 0]
# tile = @map_data[$game_player.x, $game_player.y, i]
# next if tile == 0
# return if $game_map.priorities[tile] > 0
# end
actor = $game_party.actors[0]
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
width = bitmap.width/ 4
height = bitmap.height / 4
sy = ($game_player.direction - 2) / 2 * height
#原始行走图大小矩形
src_rect = Rect.new(0, sy, width, height)
if $ZOOM > 7
w = width / 5
h = height / 5
else
w = width / $ZOOM
h = height / $ZOOM
end
x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
y = self.contents.height / 2 - h / 2 - rev_y
#小地图上的行走图大小
dest_rect = Rect.new(x, y, w, h)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
@old_real_x = $game_player.real_x
@old_real_y = $game_player.real_y
refresh
end
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
super
@all_map.dispose
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
以下引用hgfor于2008-12-21 9:02:36的发言:
试试这个小地图
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#冬夜更新说明
#更改了小地图的位置,Q是开启小地图跟随开关
#S是固定小地图位置
#更新了场所移动时地图的不同步,更新了战斗后的地图不同步
#小地图默认成为FLASE,只在第一次登入时是,以后跟随开关的指示
#恩恩
#最后更新,测试过
#修正了由于小地图变化引起的不能转换问题,修休整了房间内的地图原先的那个羁押功能
#==============================================================================
# ■ 縮小地图的表示(ver 0.999)
# by ピニョン clum-sea
#==============================================================================
#==============================================================================
# □ 前期定义
#==============================================================================
module PLAN_Map_Window
WIN_X = 0 # 地图的 X 座標
WIN_Y = 0 # 地图的 Y 座標
WIN_WIDTH = 250 # 地图的宽度
WIN_HEIGHT = 200 # 地图的高度
ZOOM = 3.5 # 地图的放缩比例
WINDOWSKIN = "" # 自定义地图窗口素材,如果留空则是默认的
ON_OFF_KEY = Input::L # 打开地图的按钮,L就是键盘的Q键
SWITCH = 1 # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
# 使用地图功能,关闭则可以使用地图功能
WINDOW_MOVE = true # 窗口中的地图跟随移动,(true:跟随, false:固定)
OVER_X = 632 - WIN_WIDTH # 移動后的 X 座標(初期位置と往復します)
OVER_Y = 0 # 移動后的 Y 座標(初期位置と往復します)
OPACITY = 255 # 窗口的透明度
C_OPACITY = 255 # 地图的透明度
VISIBLE = false # 最初是否可见
SWITCH_KEY = Input::L # Q键锁定/解锁小地图
end
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
attr_accessor :map_visible # 地图的表示状態
end
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
alias plan_map_window_main main
def main
$小地图 = false
@map_window = Window_Map.new
@map_window.visible = $game_switches[406]
plan_map_window_main
@map_window.dispose
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
alias plan_map_window_update update
def update
$game_temp.map_visible = @map_window.visible
plan_map_window_update
if $game_switches[PLAN_Map_Window::SWITCH]
if @map_window.visible
@map_window.visible = false
$game_switches[406] = false
$game_switches[405] = false
$game_variables[19] = $direction
$地图关闭 = true
end
else
if $地图关闭
@map_window.visible = true
$game_switches[406] = true
$地图关闭 = false
end
if !$game_temp.in_battle
if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
if @map_window.visible
$game_system.se_play($data_system.cancel_se)
@map_window.visible = false
$game_switches[406] = false
$game_switches[405] = false
$game_variables[19] = $direction
else
$game_system.se_play($data_system.decision_se)
@map_window.visible = true
$game_switches[406] = true
end
end
if Input.trigger?(PLAN_Map_Window::SWITCH_KEY)
if @map_window.visible
if $game_switches[405]
$game_system.se_play($data_system.cancel_se)
$game_switches[405] = false
$game_variables[19] = $direction
else
$game_system.se_play($data_system.decision_se)
$game_switches[405] = true
end
end
end
end
end
if @map_window.visible
@map_window.update
end
end
#--------------------------------------------------------------------------
# ● 场所移动的变化
#--------------------------------------------------------------------------
alias plan_map_window_transfer_player transfer_player
def transfer_player
# visible = @map_window.visible
@map_window.visible = false
plan_map_window_transfer_player
@map_window.dispose
@map_window = Window_Map.new
end
end
#==============================================================================
# ■ Window_Map
#==============================================================================
class Window_Map < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
$direction = $game_variables[19]
if $win_x != nil
x = $win_x
y = $win_y
else
case $direction
when 0
x = 0
y = 0
$win_x = x
$win_y = y
when 1
x = 382
y = 8
$win_x = x
$win_y = y
when 2
x = 8
y = 280 - 8
$win_x = x
$win_y = y
when 3
x = 382
y = 280 - 8
$win_x = x
$win_y = y
end
end
w = PLAN_Map_Window::WIN_WIDTH
h = PLAN_Map_Window::WIN_HEIGHT
$小地图 = true
super(x, y, w, h)
$小地图 = false
# @windowskin_name = $game_system.windowskin_name
# self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = PLAN_Map_Window::OPACITY
self.contents_opacity = PLAN_Map_Window::C_OPACITY
@map_data = $game_map.data
@tileset = RPG::Cache.tileset($game_map.tileset_name)
@autotiles = []
for i in 0..6
autotile_name = $game_map.autotile_names
@autotiles = RPG::Cache.autotile(autotile_name)
end
@old_real_x = $game_player.real_x
@old_real_y = $game_player.real_y
if $game_map.width > 70 or $game_map.height > 70
$ZOOM = 2 * PLAN_Map_Window::ZOOM
else
if $game_map.width < 40 or $game_map.height < 40
$ZOOM = PLAN_Map_Window::ZOOM / 2
else
$ZOOM = PLAN_Map_Window::ZOOM
end
end
@all_map = make_all_map
self.visible = $game_switches[406]
unless PLAN_Map_Window::WINDOWSKIN.empty?
self.windowskin = RPG::Cache.windowskin("")
end
# PLAN_Map_Window::WINDOWSKIN
# self.visible = PLAN_Map_Window::VISIBLE
refresh
end
#--------------------------------------------------------------------------
# ● 缩小图做成
#--------------------------------------------------------------------------
def make_all_map
all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
for y in 0...$game_map.height
for x in 0...$game_map.width
for z in 0...3
tile_num = @map_data[x, y, z]
next if tile_num == nil
if tile_num < 384
if tile_num >= 48
tile_num -= 48
src_rect = Rect.new(32, 2 * 32, 32, 32)
all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
end
else
tile_num -= 384
src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
all_map.blt(x * 32, y * 32, @tileset, src_rect)
end
end
end
end
w = ($game_map.width / $ZOOM) * 32
h = ($game_map.height / $ZOOM) * 32
ret_bitmap = Bitmap.new(w, h)
src_rect = Rect.new(0, 0, all_map.width, all_map.height)
dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
all_map.dispose
return ret_bitmap
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.x = $win_x
self.y = $win_y
self.z = 9999 # 让窗口在最上层
@small_map = false
if $game_map.width < 80 or $game_map.height < 80
#这个是当地图大小宽和高小于指定大小时才改变大小,限制小地图窗口大小
if $game_map.width < 40 or $game_map.height < 40
#这同时限制了变换小地图的大小,防止关卡和队长办公室因为地图宽长无法切换
self.width = [@all_map.width,200].min
self.height = [@all_map.height,200].min
self.contents = Bitmap.new(width-32, height-32)
#让改变的小地图X坐标紧贴边缘
if self.x + self.width > 250
self.x = 625 - self.width
end
#让改变的小地图Y左边紧贴边缘
if self.y + self.height > 380
self.y = 470 - self.height
end
@small_map = true
end
end
if self.windowskin == nil
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
one_tile_size = 32 / $ZOOM
x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
x = x * one_tile_size / 128
y = y * one_tile_size / 128
half_width = self.contents.width * 128 / 2
rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
rev_x = 0
if @all_map.width < self.contents.width
rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
rev_x -= (self.contents.width - @all_map.width) / 2
x += rev_x
elsif half_width > $game_player.real_x * one_tile_size
rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
x += rev_x
elsif half_width > rest_width
rev_x = -((half_width - rest_width) / 128)
x += rev_x
end
half_height = self.contents.height * 128 / 2
rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
rev_y = 0
if @all_map.height < self.contents.height
rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
rev_y -= (self.contents.height - @all_map.height) / 2
y += rev_y
elsif half_height > $game_player.real_y * one_tile_size
rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
y += rev_y
elsif half_height > rest_height
rev_y = -((half_height - rest_height) / 128)
y += rev_y
end
src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
self.contents.blt(0, 0, @all_map, src_rect)
if PLAN_Map_Window::WINDOW_MOVE == true
w = self.x - 32 .. self.x + self.width + 32
h = self.y - 64 .. self.y + self.height + 64
if w === $game_player.screen_x and h === $game_player.screen_y
if !@small_map
case self.x
when 8
self.x = 382
when 382
self.x = 8
end
case self.y
when 272
self.y = 8
when 8
self.y = 272
end
else
case self.x
when 625 - self.width
self.x = 8
when 8
self.x = 625 - self.width
end
case self.y
when 470 - self.height
self.y = 8
when 8
self.y = 470 - self.height
end
end
end
end
#主角位置
if $game_party.actors.size > 0
# for i in [2, 1, 0]
# tile = @map_data[$game_player.x, $game_player.y, i]
# next if tile == 0
# return if $game_map.priorities[tile] > 0
# end
actor = $game_party.actors[0]
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
width = bitmap.width/ 4
height = bitmap.height / 4
sy = ($game_player.direction - 2) / 2 * height
#原始行走图大小矩形
src_rect = Rect.new(0, sy, width, height)
if $ZOOM > 7
w = width / 5
h = height / 5
else
w = width / $ZOOM
h = height / $ZOOM
end
x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
y = self.contents.height / 2 - h / 2 - rev_y
#小地图上的行走图大小
dest_rect = Rect.new(x, y, w, h)
self.contents.stretch_blt(dest_rect, bitmap, src_rect)
end
end
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def update
super
if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
@old_real_x = $game_player.real_x
@old_real_y = $game_player.real_y
refresh
end
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
super
@all_map.dispose
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
以下引用西江月于2008-12-21 10:18:21的发言:
那就请你打开第25号开关……
[本贴由作者于 2008-12-21 10:37:04 最后编辑]
以下引用西江月于2008-12-21 14:21:21的发言:
我用的就是4L的脚本啊
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |