设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3070|回复: 3
打印 上一主题 下一主题

[已经解决] 高手们求帮忙~.....小地图问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
105 小时
注册时间
2013-1-24
帖子
115
跳转到指定楼层
 楼主| 发表于 2013-2-1 20:52:08 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
在论坛找了个小地图脚本。
在场所移动的时候就出现问题了- -
如图

请问是怎么回事??
脚本在下面
RUBY 代码复制
  1. #==============================================================================
  2.  
  3. # ■ 縮小地图的表示
  4.  
  5. #==============================================================================
  6.  
  7. #==============================================================================
  8.  
  9. # □ 前期定义
  10.  
  11. #==============================================================================
  12.  
  13. module PLAN_Map_Window
  14.  
  15.   WIN_X       = 8         # 窗口的初始 X 座標
  16.  
  17.   WIN_Y       = 8         # 窗口的初始 Y 座標
  18.  
  19.   WIN_WIDTH   = 6*32      # 地图的宽度
  20.  
  21.   WIN_HEIGHT  = 4*32      # 地图的高度
  22.  
  23.   ZOOM        = 4.0       # 地图的放缩比例
  24.  
  25.   WINDOWSKIN  = ""        # 自定义地图窗口素材,如果留空则是默认的
  26.  
  27.   ON_OFF_KEY  = Input::X  # 打开地图的按钮,X就是键盘的A键
  28.  
  29.   SWITCH      = 49      # 打开此号开关才可以使用小地图
  30.  
  31.                           # 使用地图功能,关闭则可以使用地图功能
  32.  
  33.   WINDOW_MOVE = true      # 是否可以自动改变窗口位置(true:可改变, false:固定)
  34.  
  35.   OVER_X      = 632 - WIN_WIDTH   # 自动改变后窗口的位置x
  36.  
  37.   OVER_Y      = 8       #自动改变后窗口的位置y
  38.  
  39.  
  40.  
  41.   OPACITY     = 180       # 窗口的透明度
  42.  
  43.   C_OPACITY   = 180       # 地图的透明度
  44.  
  45.   VISIBLE     = false     # 最初是否可见
  46.  
  47. end
  48.  
  49. #==============================================================================
  50.  
  51. # ■ Game_Temp
  52.  
  53. #==============================================================================
  54.  
  55. class Game_Temp
  56.  
  57. attr_accessor :map_visible
  58.  
  59. alias plan_map_window_initialize initialize
  60.  
  61. def initialize
  62.  
  63. plan_map_window_initialize
  64.  
  65. @map_visible = false
  66.  
  67. end
  68.  
  69. end
  70.  
  71. #==============================================================================
  72.  
  73. # ■ Scene_Map
  74.  
  75. #==============================================================================
  76.  
  77. class Scene_Map
  78.  
  79. #--------------------------------------------------------------------------
  80.  
  81. # ● 主处理
  82.  
  83. #--------------------------------------------------------------------------
  84.  
  85. alias plan_map_window_main main
  86.  
  87. def main
  88.  
  89. @map_window = Window_Map.new
  90.  
  91. @map_window.visible = $game_temp.map_visible
  92.  
  93. plan_map_window_main
  94.  
  95. @map_window.dispose
  96.  
  97. end
  98.  
  99. #--------------------------------------------------------------------------
  100.  
  101. # ● 更新
  102.  
  103. #--------------------------------------------------------------------------
  104.  
  105. alias plan_map_window_update update
  106.  
  107. def update
  108.  
  109. $game_temp.map_visible = @map_window.visible
  110.  
  111. plan_map_window_update
  112.  
  113. unless $game_switches[PLAN_Map_Window::SWITCH]==false
  114.  
  115. if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
  116.  
  117. if @map_window.visible
  118.  
  119. @map_window.visible = false
  120.  
  121. else
  122.  
  123. @map_window.visible = true
  124.  
  125. end
  126.  
  127. end
  128.  
  129. else
  130.  
  131. if @map_window.visible
  132.  
  133. @map_window.visible = false
  134.  
  135. end
  136.  
  137. end
  138.  
  139. if @map_window.visible
  140.  
  141. @map_window.update
  142.  
  143. end
  144.  
  145. end
  146.  
  147. #--------------------------------------------------------------------------
  148.  
  149. # ● 场所移动的变化
  150.  
  151. #--------------------------------------------------------------------------
  152.  
  153. alias plan_map_window_transfer_player transfer_player
  154.  
  155. def transfer_player
  156.  
  157. visible = @map_window.visible
  158.  
  159. @map_window.visible = false
  160.  
  161. plan_map_window_transfer_player
  162.  
  163. @map_window.dispose
  164.  
  165. @map_window = Window_Map.new
  166.  
  167. @map_window.visible = visible
  168.  
  169. end
  170.  
  171. end
  172.  
  173. #==============================================================================
  174.  
  175. # ■ Window_Map
  176.  
  177. #==============================================================================
  178.  
  179. class Window_Map < Window_Base
  180.  
  181. #--------------------------------------------------------------------------
  182.  
  183. # ● 初始化
  184.  
  185. #--------------------------------------------------------------------------
  186.  
  187. def initialize
  188.  
  189. x = PLAN_Map_Window::WIN_X
  190.  
  191. y = PLAN_Map_Window::WIN_Y
  192.  
  193. w = PLAN_Map_Window::WIN_WIDTH
  194.  
  195. h = PLAN_Map_Window::WIN_HEIGHT
  196.  
  197. super(x, y, w, h)
  198.  
  199. unless PLAN_Map_Window::WINDOWSKIN.empty?
  200.  
  201. self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
  202.  
  203. end
  204.  
  205. self.contents = Bitmap.new(width - 32, height - 32)
  206.  
  207. self.opacity = PLAN_Map_Window::OPACITY
  208.  
  209. self.contents_opacity = PLAN_Map_Window::C_OPACITY
  210.  
  211. @map_data = $game_map.data
  212.  
  213. @tileset = RPG::Cache.tileset($game_map.tileset_name)
  214.  
  215. @autotiles = []
  216.  
  217. for i in 0..6
  218.  
  219. autotile_name = $game_map.autotile_names[i]
  220.  
  221. @autotiles[i] = RPG::Cache.autotile(autotile_name)
  222.  
  223. end
  224.  
  225. @old_real_x = $game_player.real_x
  226.  
  227. @old_real_y = $game_player.real_y
  228.  
  229. @all_map = make_all_map
  230.  
  231. self.visible = PLAN_Map_Window::VISIBLE
  232.  
  233. refresh
  234.  
  235. end
  236.  
  237. #--------------------------------------------------------------------------
  238.  
  239. # ● 缩小图做成
  240.  
  241. #--------------------------------------------------------------------------
  242.  
  243. def make_all_map
  244.  
  245. all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
  246.  
  247. for y in 0...$game_map.height
  248.  
  249. for x in 0...$game_map.width
  250.  
  251. for z in 0...3
  252.  
  253. tile_num = @map_data[x, y, z]
  254.  
  255. next if tile_num == nil
  256.  
  257. if tile_num < 384
  258.  
  259. if tile_num >= 48
  260.  
  261. tile_num -= 48
  262.  
  263. src_rect = Rect.new(32, 2 * 32, 32, 32)
  264.  
  265. all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
  266.  
  267. end
  268.  
  269. else
  270.  
  271. tile_num -= 384
  272.  
  273. src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
  274.  
  275. all_map.blt(x * 32, y * 32, @tileset, src_rect)
  276.  
  277. end
  278.  
  279. end
  280.  
  281. end
  282.  
  283. end
  284.  
  285. w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
  286.  
  287. h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
  288.  
  289. ret_bitmap = Bitmap.new(w, h)
  290.  
  291. src_rect = Rect.new(0, 0, all_map.width, all_map.height)
  292.  
  293. dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
  294.  
  295. ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
  296.  
  297. all_map.dispose
  298.  
  299. return ret_bitmap
  300.  
  301. end
  302.  
  303. #--------------------------------------------------------------------------
  304.  
  305. # ● 刷新
  306.  
  307. #--------------------------------------------------------------------------
  308.  
  309. def refresh
  310.  
  311. self.contents.clear
  312.  
  313. one_tile_size = 32 / PLAN_Map_Window::ZOOM
  314.  
  315. x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
  316.  
  317. y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
  318.  
  319. x = x * one_tile_size / 128
  320.  
  321. y = y * one_tile_size / 128
  322.  
  323. half_width = self.contents.width * 128 / 2
  324.  
  325. rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
  326.  
  327. rev_x = 0
  328.  
  329. if @all_map.width < self.contents.width
  330.  
  331. rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
  332.  
  333. rev_x -= (self.contents.width - @all_map.width) / 2
  334.  
  335. x += rev_x
  336.  
  337. elsif half_width > $game_player.real_x * one_tile_size
  338.  
  339. rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
  340.  
  341. x += rev_x
  342.  
  343. elsif half_width > rest_width
  344.  
  345. rev_x = -((half_width - rest_width) / 128)
  346.  
  347. x += rev_x
  348.  
  349. end
  350.  
  351. half_height = self.contents.height * 128 / 2
  352.  
  353. rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
  354.  
  355. rev_y = 0
  356.  
  357. if @all_map.height < self.contents.height
  358.  
  359. rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
  360.  
  361. rev_y -= (self.contents.height - @all_map.height) / 2
  362.  
  363. y += rev_y
  364.  
  365. elsif half_height > $game_player.real_y * one_tile_size
  366.  
  367. rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
  368.  
  369. y += rev_y
  370.  
  371. elsif half_height > rest_height
  372.  
  373. rev_y = -((half_height - rest_height) / 128)
  374.  
  375. y += rev_y
  376.  
  377. end
  378.  
  379. src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
  380.  
  381. self.contents.blt(0, 0, @all_map, src_rect)
  382.  
  383. if PLAN_Map_Window::WINDOW_MOVE == true
  384.  
  385. w = self.x..self.x + self.width
  386.  
  387. h = self.y..self.y + self.height
  388.  
  389. if w === $game_player.screen_x and h === $game_player.screen_y
  390.  
  391. if self.x == PLAN_Map_Window::WIN_X and self.y == PLAN_Map_Window::WIN_Y
  392.  
  393. self.x = PLAN_Map_Window::OVER_X
  394.  
  395. self.y = PLAN_Map_Window::OVER_Y
  396.  
  397. else
  398.  
  399. self.x = PLAN_Map_Window::WIN_X
  400.  
  401. self.y = PLAN_Map_Window::WIN_Y
  402.  
  403. end
  404.  
  405. end
  406.  
  407. end
  408.  
  409. if $game_party.actors.size > 0
  410.  
  411. for i in [2, 1, 0]
  412.  
  413. tile = @map_data[$game_player.x, $game_player.y, i]
  414.  
  415. next if tile == 0
  416.  
  417. return if $game_map.priorities[tile] > 0
  418.  
  419. end
  420.  
  421. actor = $game_party.actors[0]
  422.  
  423. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  424.  
  425. width = bitmap.width / 4
  426.  
  427. height = bitmap.height / 4
  428.  
  429. src_rect = Rect.new(0, 0, width, height)
  430.  
  431. w = width / PLAN_Map_Window::ZOOM
  432.  
  433. h = height / PLAN_Map_Window::ZOOM
  434.  
  435. x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
  436.  
  437. y = self.contents.height / 2 - h / 2 - rev_y
  438.  
  439. dest_rect = Rect.new(x, y, w, h)
  440.  
  441. self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  442.  
  443. end
  444.  
  445. end
  446.  
  447. #--------------------------------------------------------------------------
  448.  
  449. # ● 更新
  450.  
  451. #--------------------------------------------------------------------------
  452.  
  453. def update
  454.  
  455. super
  456.  
  457. if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
  458.  
  459. @old_real_x = $game_player.real_x
  460.  
  461. @old_real_y = $game_player.real_y
  462.  
  463. refresh
  464.  
  465. end
  466.  
  467. end
  468.  
  469. #--------------------------------------------------------------------------
  470.  
  471. # ● 解放
  472.  
  473. #--------------------------------------------------------------------------
  474.  
  475. def dispose
  476.  
  477. super
  478.  
  479. @all_map.dispose
  480.  
  481. end
  482.  
  483. end
  484.  
  485. #==============================================================================
  486.  
  487. # ■ Window_Menu_Command
  488.  
  489. #==============================================================================
  490.  
  491. class Window_Menu_Command < Window_Selectable
  492.  
  493. #--------------------------------------------------------------------------
  494.  
  495. # map_id : 地图 ID
  496.  
  497. #--------------------------------------------------------------------------
  498.  
  499. def get_map_name(map_id)
  500.  
  501. mapinfo = load_data("Data/MapInfos.rvdata")
  502.  
  503. result = mapinfo[map_id].name
  504.  
  505. return result.split(/,/)[0].split(/_/)[0]
  506.  
  507. end
  508.  
  509. #--------------------------------------------------------------------------
  510.  
  511. #--------------------------------------------------------------------------
  512.  
  513. def update_help
  514.  
  515. text = $data_system.game_title
  516.  
  517. if @commands[self.index] != nil
  518.  
  519. text += ": " + @commands[self.index]
  520.  
  521. end
  522.  
  523. map_name = get_map_name($game_map.map_id)
  524.  
  525. text += " "
  526.  
  527. if map_name.include?"@"
  528.  
  529. text += "未知地域"
  530.  
  531. else
  532.  
  533. text += map_name
  534.  
  535. end
  536.  
  537. #-----------------------------------------------------------------------
  538.  
  539. @x,@y = $game_player.x,$game_player.y
  540.  
  541. text += " <#{@x},#{@y}>"
  542.  
  543. #-----------------------------------------------------------------------
  544.  
  545. @help_window.set_text(text)
  546.  
  547. end
  548.  
  549. end
  550.  
  551. #==============================================================================

也不知道自己会花多长时间忘记你,只希望我做了对的选择,你也一样。

Lv1.梦旅人

梦石
0
星屑
50
在线时间
35 小时
注册时间
2013-2-7
帖子
60
3
发表于 2013-2-8 01:36:19 | 只看该作者
这个小地图是直接可以使用的么O O 还是需要自己画小地图的?求原帖!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
105 小时
注册时间
2013-1-24
帖子
115
2
 楼主| 发表于 2013-2-1 22:30:08 | 只看该作者
极地小鸥 发表于 2013-2-1 21:34
经测试原脚本没问题
157行的字母改了就会出现这问题
请检查脚本是否有奇怪的东西加了进去 ...

谢谢谢谢。经过我傻瓜式排查发现是跟呼出对话框V6 那个脚本不兼容。现在换掉了对话框脚本问题没有了。谢谢你的回答~

也不知道自己会花多长时间忘记你,只希望我做了对的选择,你也一样。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
114 小时
注册时间
2012-3-26
帖子
47
1
发表于 2013-2-1 21:34:13 | 只看该作者
经测试原脚本没问题
157行的字母改了就会出现这问题
请检查脚本是否有奇怪的东西加了进去

评分

参与人数 1星屑 +100 收起 理由
hcm + 100 认可答案

查看全部评分

再起不能
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-6-29 04:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表