查看: 1499|回复: 7

[已经解决] 为什么我用那个小地图的脚本时,存档再读档就会错误啊?

  [复制链接]
梦石
0
星屑
50
在线时间
178 小时
注册时间
2011-2-6
回帖
41
发表于 2011-8-29 07:36:43 | 显示全部楼层 |阅读模式

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

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

×
就是从脚本库里找来的小地图脚本,要替换一堆自带脚本的那个……


888000于2011-8-29 09:37补充以下内容:
[url]http://rpg.blue/thread-72764-1-1.html[/url]
好像是从这里下的……
存档,再读档……错误退出……


888000于2011-8-29 09:39补充以下内容:
http://bbs。66rpg。com/thread-72764-1-1.html(请把。改成.)
从这里下的……

存档再读档就错误


888000于2011-8-29 09:43补充以下内容:
就是从这个论坛上找的……
发生错误的是这个脚本的第97行[code]#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
#  处理地图的类。包含卷动以及可以通行的判断功能。
# 本类的实例请参考 $game_map 。
#==============================================================================

class Game_Map
  MAZE_SWITCH = 1
  MAZE_SPRITE_OPACITY = 180
  #--------------------------------------------------------------------------
  # ● 定义实例变量
  #--------------------------------------------------------------------------
  attr_reader   :screen                   # 地图画面状态
  attr_reader   :interpreter              # 地图事件用解释器
  attr_reader   :display_x                # 显示 X 坐标 * 256
  attr_reader   :display_y                # 显示 Y 坐标 * 256
  attr_reader   :parallax_name            # 远景 文件名
  attr_reader   :passages                 # 通行表
  attr_reader   :events                   # 事件
  attr_reader   :vehicles                 # 交通工具
  attr_accessor :need_refresh             # 刷新要求标志
  attr_accessor :map                      # 刷新要求标志
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    @screen = Game_Screen.new
    @interpreter = Game_Interpreter.new(0, true)
    @map_id = 0
    @display_x = 0
    @display_y = 0
    create_vehicles
  end
  #--------------------------------------------------------------------------
  # ● 设置
  #     map_id : 地图 ID
  #--------------------------------------------------------------------------
  def setup(map_id)
    @map_id = map_id
    @map = load_data(sprintf("Data/Map%03d.rvdata", @map_id))
    setup_maze
    # 临时写在这里
    @display_x = 0
    @display_y = 0
    @passages = $data_system.passages
    referesh_vehicles
    setup_events
    setup_scroll
    setup_parallax   
    @need_refresh = false
  end
  
  def setup_maze
    $game_maze6R_search[@map_id] = Table.new(width, height) if $game_maze6R_search[@map_id] == nil
    $maze_sprite = nil if $map_sprite != nil
    $maze_sprite = Sprite.new
    $maze_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    $maze_sprite.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0))
    $maze_sprite.z = 2000
    $maze_sprite.zoom_x = 0.4
    $maze_sprite.zoom_y = 0.4
    $maze_sprite.opacity = MAZE_SPRITE_OPACITY
    $maze_sprite.visible = $game_switches[MAZE_SWITCH]
    $maze_sprite.update
    @maze_rect_width = Graphics.width / width
    @maze_rect_height = Graphics.height / height
    $maze_player_sprite = nil if $maze_player_sprite != nil
    $maze_player_sprite = Sprite.new
    $maze_player_sprite.bitmap = Cache.system("Maze_Char_main")
    $maze_player_sprite.z = 2002
    $maze_player_sprite.ox = $maze_player_sprite.bitmap.width / 2
    $maze_player_sprite.oy = $maze_player_sprite.bitmap.height
    $maze_player_sprite.visible = $maze_sprite.visible
    @refresh_maze_count == 0
  end
  #-----------------------------------------------------
  # ☆ 刷新迷宫game数据,主要用于添加当前一屏幕内容
  #-----------------------------------------------------
  def refresh_maze_game
    for x in 0..$game_map.width
      for y in 0..$game_map.height
        next if not in_range?(x, y)
        $game_maze6R_search[@map_id][x, y] = 1 #unless $game_maze6R_search[@map_id][x, y]
      end
    end   
  end
  
  #-----------------------------------------------------
  # ☆ 刷新迷宫图片
  #-----------------------------------------------------
  def refresh_maze_sprite
    for x in 0..$game_map.width
      for y in 0..$game_map.height
        if $game_maze6R_search[@map_id][x, y] == 1
          bmpt = get_xy_bitmap(x, y)
          $maze_sprite.bitmap.stretch_blt(Rect.new(@maze_rect_width * x, @maze_rect_height * y, @maze_rect_width, @maze_rect_height), bmpt, bmpt.rect)
        end
      end
    end   
    $maze_sprite.visible = $game_switches[MAZE_SWITCH]
    $maze_player_sprite.x = ($game_player.x * @maze_rect_width) * $maze_sprite.zoom_x + $maze_sprite.x
    $maze_player_sprite.y = ($game_player.y * @maze_rect_height) * $maze_sprite.zoom_y + $maze_sprite.y
    $maze_player_sprite.zoom_x = $maze_sprite.zoom_x
    $maze_player_sprite.zoom_y = $maze_sprite.zoom_y
    $maze_player_sprite.visible = $maze_sprite.visible
    $maze_sprite.update
    $maze_player_sprite.update
  end
  
  #-----------------------------------------------------
  # ☆ 刷新迷宫地图的可视情况
  #-----------------------------------------------------
  def change_maze_visible(maze_visible = nil)
    maze_visible = $game_switches[MAZE_SWITCH] if maze_visible == nil
    $maze_sprite.visible = maze_visible
    $maze_player_sprite.visible = maze_visible
  end
  
  #-----------------------------------------------------
  # ☆ 刷新迷宫game数据和图片,小幅度刷新
  #-----------------------------------------------------
  def refresh_maze_small   
    screne_x = $game_map.display_x
    screne_x -= 256
    screne_y = $game_map.display_y
    screne_y -= 256
    screne_width = $game_map.display_x
    screne_width += 8 * Graphics.width + 256
    screne_height = $game_map.display_y
    screne_height += 8 * Graphics.height + 256
    xb = screne_x / 256
    yb = screne_y / 256
    xe = screne_width / 256
    ye = screne_height / 256
    if $maze_sprite == nil or $maze_sprite.disposed?
      refresh_maze_sprite
    end
    for x in xb..xe # 0..$game_map.width
      for y in yb..ye # 0..$game_map.height
        next if not in_range?(x, y)
        next if $game_maze6R_search[@map_id][x, y] == 1
        $game_maze6R_search[@map_id][x, y] = 1
        bmpt = get_xy_bitmap(x, y)
        $maze_sprite.bitmap.stretch_blt(Rect.new(@maze_rect_width * x, @maze_rect_height * y, @maze_rect_width, @maze_rect_height), bmpt, bmpt.rect)
      end
    end
    $maze_sprite.visible = $game_switches[MAZE_SWITCH]
    $maze_player_sprite.x = ($game_player.x * @maze_rect_width) * $maze_sprite.zoom_x + $maze_sprite.x
    $maze_player_sprite.y = ($game_player.y * @maze_rect_height) * $maze_sprite.zoom_y + $maze_sprite.y
    $maze_player_sprite.visible = $maze_sprite.visible
    $maze_sprite.update
    $maze_player_sprite.update
  end
  
  #-----------------------------------------------------
  # ☆ 看某XY是否在屏幕显示范围内
  #-----------------------------------------------------
  def in_range?(inx, iny)
    screne_x = $game_map.display_x
    screne_x -= 256
    screne_y = $game_map.display_y
    screne_y -= 256
    screne_width = $game_map.display_x
    screne_width += 4608 # 8 * Graphics.width + 256
    screne_height = $game_map.display_y
    screne_height += 3584 # 8 * Graphics.height + 256
    return false if inx * 256 <= screne_x
    return false if inx * 256 >= screne_width
    return false if iny * 256 <= screne_y
    return false if iny * 256 >= screne_height
    return true
  end
  
  #-----------------------------------------------------
  # ☆ 获得X,Y理论点的图像
  #-----------------------------------------------------
  def get_xy_bitmap(x, y)
    bitmap = Bitmap.new(32, 32)
    for i in [0] #, 1, 2]
      id = @map.data[x, y, i]
      tb = bmprect_id(id)
      bitmap.blt(0, 0, tb[0], Rect.new(tb[1] * 32, tb[2] * 32, 32, 32)) if tb[0] != nil
    end
    return bitmap
  end  
  
  #-----------------------------------------------------
  # ☆ 根据ID获得Bitmap的rect
  #-----------------------------------------------------
  def bmprect_id(id)   
    case id
    when 0..255      
      bitmap_rectxyb = get_where(id)
      return [$map6r_bitmaps[5], bitmap_rectxyb[0], bitmap_rectxyb[1]]
    when 256..511
      bitmap_rectxyb = get_where(id - 256)
      return [$map6r_bitmaps[6], bitmap_rectxyb[0], bitmap_rectxyb[1]]
    when 512..767
      bitmap_rectxyb = get_where(id - 512)
      return [$map6r_bitmaps[7], bitmap_rectxyb[0], bitmap_rectxyb[1]]
    when 768..1023
      bitmap_rectxyb = get_where(id - 768)
      return [$map6r_bitmaps[8], bitmap_rectxyb[0], bitmap_rectxyb[1]]
    when 1536..1791
      bitmap_rectxyb = get_where(id - 1536)
      return [$map6r_bitmaps[4], bitmap_rectxyb[0], bitmap_rectxyb[1]]   
    when 2048..8191 # 2048..2048 + 48 * 128 - 1   
      bitmap_rectxyb = get_where(id)
      return [bitmap_rectxyb[0], bitmap_rectxyb[1], bitmap_rectxyb[2]]  
    end
    return [nil, 0, 0]
  end
  
  #-----------------------------------------------------
  # ☆ 根据ID返回Bitmap的rect
  #-----------------------------------------------------
  def get_where(id)
    case id
    when 0..255
      x = id % 8
      y = id / 8
      return [x, y]
    when 2048..2767 # 2048..2048 + 48 * 15 - 1
      tempid = (id - 2048) % 48 # 这个表示是48系列图中的第几个系列种
      series_id = (id - 2048) / 48   # 这个表示是在图上素材分类的第几个
      case series_id
      when 0
        return get_ofxoftdiyilei(tempid, 0, 0)
      when 1
        return get_ofxoftdiyilei(tempid, 0, 3)
      when 2
        return get_ofxoftdiyilei(tempid, 6, 0)
      when 3
        return get_ofxoftdiyilei(tempid, 6, 3)
      when 4
        return get_ofxoftdiyilei(tempid, 8, 0)
      when 5
        return get_ofxoftdiyilei(tempid, 8, 3)
      when 6
        return get_ofxoftdiyilei(tempid, 14, 0)
      when 7
        return get_ofxoftdiyilei(tempid, 14, 3)
      when 8
        return get_ofxoftdiyilei(tempid, 0, 6)
      when 9
        return get_ofxoftdiyilei(tempid, 0, 9)
      when 10
        return get_ofxoftdiyilei(tempid, 6, 6)
      when 11
        return get_ofxoftdiyilei(tempid, 6, 9)
      when 12
        return get_ofxoftdiyilei(tempid, 8, 6)
      when 13
        return get_ofxoftdiyilei(tempid, 8, 9)
      when 14
        return get_ofxoftdiyilei(tempid, 14, 6)
      when 15
        return get_ofxoftdiyilei(tempid, 14, 9)
      end
      
    #-----------------------------------------------------------------
    # 这个是A2素材的定义方式
    #-----------------------------------------------------------------
    when 2768..4351 #2048 + 48 * 15..2048 + 48 * 48 - 1
      tempid = (id - 2048 - 48 * 16) % 48      # 这个表示是48系列图中的第几个系列种
      series_id = (id - 2048 - 48 * 16) / 48   # 这个表示是在图上素材分类的第几个
      ofx = (series_id % 8) * 2
      ofy = (series_id / 8) * 3
      return get_ofxoftdiyilei(tempid, ofx, ofy, 1)
      
    #-----------------------------------------------------------------
    # 这个是A3素材的房顶方式,前半部分
    #-----------------------------------------------------------------
    when 4352..4735 #2048 + 48 * 48..2048 + 48 * 56 - 1
      tempid = (id - 2048 - 48 * 48) % 48      # 这个表示是48系列图中的第几个系列种
      series_id = (id - 2048 - 48 * 48) / 48   # 这个表示是在图上素材分类的第几个
      ofx = (series_id % 8) * 2
      ofy = 0
      return get_ofxoftdierlei(tempid, ofx, ofy, 2)     
    #-----------------------------------------------------------------
    # 这个是A3素材的房顶方式,后半部分
    #-----------------------------------------------------------------
    when 5120..5503 #2048 + 48 * 64..2048 + 48 * 72 - 1
      tempid = (id - 2048 - 48 * 64) % 48      # 这个表示是48系列图中的第几个系列种
      series_id = (id - 2048 - 48 * 64) / 48   # 这个表示是在图上素材分类的第几个
      ofx = (series_id % 8) * 2
      ofy = 4
      return get_ofxoftdierlei(tempid, ofx, ofy, 2)  
    #-----------------------------------------------------------------
    # 这个是A3素材的房屋体方式,前半部分
    #-----------------------------------------------------------------
    when 4736..5119 #2048 + 48 * 56..2048 + 48 * 64 - 1
      tempid = (id - 2048 - 48 * 48) % 48      # 这个表示是48系列图中的第几个系列种
      series_id = (id - 2048 - 48 * 48) / 48   # 这个表示是在图上素材分类的第几个
      ofx = (series_id % 8) * 2
      ofy = 0
      return get_ofxoftdierlei(tempid, ofx, ofy, 2, 1)     
    #-----------------------------------------------------------------
    # 这个是A3素材的房屋体方式,后半部分
    #-----------------------------------------------------------------
    when 5504..5887#2048 + 48 * 72..2048 + 48 * 80 - 1
      tempid = (id - 2048 - 48 * 64) % 48      # 这个表示是48系列图中的第几个系列种
      series_id = (id - 2048 - 48 * 64) / 48   # 这个表示是在图上素材分类的第几个
      ofx = (series_id % 8) * 2
      ofy = 4
      return get_ofxoftdierlei(tempid, ofx, ofy, 2, 1)   
      
      
      
      
    #-----------------------------------------------------------------
    # 这个是A4素材的房顶方式 1
    #-----------------------------------------------------------------
    when 5888..6271 #2048 + 48 * 80..2048 + 48 * 88 - 1
      tempid = (id - 2048 - 48 * 80) % 48      
      series_id = (id - 2048 - 48 * 80) / 48   
      ofx = (series_id % 8) * 2
      ofy = 0
      return get_ofxoftdiyilei(tempid, ofx, ofy, 3)   
    #-----------------------------------------------------------------
    # 这个是A4素材的房顶方式 2
    #-----------------------------------------------------------------
    when 6656..7039 #2048 + 48 * 96..2048 + 48 * 104 - 1
      tempid = (id - 2048 - 48 * 80) % 48      
      series_id = (id - 2048 - 48 * 80) / 48   
      ofx = (series_id % 8) * 2
      ofy = 5
      return get_ofxoftdiyilei(tempid, ofx, ofy, 3)   
    #-----------------------------------------------------------------
    # 这个是A4素材的房顶方式 3
    #-----------------------------------------------------------------
    when 7424..7807 #2048 + 48 * 112..2048 + 48 * 120 - 1
      tempid = (id - 2048 - 48 * 80) % 48      
      series_id = (id - 2048 - 48 * 80) / 48   
      ofx = (series_id % 8) * 2
      ofy = 10
      return get_ofxoftdiyilei(tempid, ofx, ofy, 3)   
      
      
      
    #-----------------------------------------------------------------
    # 这个是A4素材的墙壁方式 1
    #-----------------------------------------------------------------
    when 6272..6655 #2048 + 48 * 88..2048 + 48 * 96 - 1
      tempid = (id - 2048 - 48 * 80) % 48      
      series_id = (id - 2048 - 48 * 80) / 48   
      ofx = (series_id % 8) * 2
      ofy = 0
      return get_ofxoftdierlei(tempid, ofx, ofy, 3, 2)   
    #-----------------------------------------------------------------
    # 这个是A4素材的墙壁方式 2
    #-----------------------------------------------------------------
    when 7040..7423 #2048 + 48 * 104..2048 + 48 * 112 - 1
      tempid = (id - 2048 - 48 * 80) % 48      
      series_id = (id - 2048 - 48 * 80) / 48   
      ofx = (series_id % 8) * 2
      ofy = 5
      return get_ofxoftdierlei(tempid, ofx, ofy, 3, 2)  
    #-----------------------------------------------------------------
    # 这个是A4素材的墙壁方式 3
    #-----------------------------------------------------------------
    when 7808..8191 #2048 + 48 * 120..2048 + 48 * 128 - 1
      tempid = (id - 2048 - 48 * 80) % 48      
      series_id = (id - 2048 - 48 * 80) / 48   
      ofx = (series_id % 8) * 2
      ofy = 10
      return get_ofxoftdierlei(tempid, ofx, ofy, 3, 2)  
    end   
  end
  
  #--------------------------------------------------------------------------
  # ☆ 中间函数,用来返回某张图上的一个rect,特别针对A1
  #--------------------------------------------------------------------------
  def get_ofxoftdiyilei(tempid = 0, ofx = 0, ofy = 0, bmps = 0)
    bmp = Bitmap.new(32, 32)
    ta = diyitao(tempid)
    ofx *= 32
    ofy *= 32
    bmp.blt(0,0,$map6r_bitmaps[bmps], Rect.new(ta[0][1]*16 + ofx, ta[0][0]*16 + ofy, 16, 16))
    bmp.blt(16,0,$map6r_bitmaps[bmps], Rect.new(ta[1][1]*16 + ofx, ta[1][0]*16 + ofy, 16, 16))
    bmp.blt(0,16,$map6r_bitmaps[bmps], Rect.new(ta[2][1]*16 + ofx, ta[2][0]*16 + ofy, 16, 16))
    bmp.blt(16,16,$map6r_bitmaps[bmps], Rect.new(ta[3][1]*16 + ofx, ta[3][0]*16 + ofy, 16, 16))
    return [bmp, 0, 0]
  end
  
  #--------------------------------------------------------------------------
  # ☆ 中间函数,用来返回某张图上的一个rect,针对A3
  #--------------------------------------------------------------------------
  def get_ofxoftdierlei(tempid = 0, ofx = 0, ofy = 0, bmps = 0, hx = 0)
    bmp = Bitmap.new(32, 32)
    ta = diertao(tempid) if hx == 0
    ta = disantao(tempid) if hx == 1
    ta = disitao(tempid) if hx == 2
    ofx *= 32
    ofy *= 32
    bmp.blt(0,0,$map6r_bitmaps[bmps], Rect.new(ta[0][1]*16 + ofx, ta[0][0]*16 + ofy, 16, 16))
    bmp.blt(16,0,$map6r_bitmaps[bmps], Rect.new(ta[1][1]*16 + ofx, ta[1][0]*16 + ofy, 16, 16))
    bmp.blt(0,16,$map6r_bitmaps[bmps], Rect.new(ta[2][1]*16 + ofx, ta[2][0]*16 + ofy, 16, 16))
    bmp.blt(16,16,$map6r_bitmaps[bmps], Rect.new(ta[3][1]*16 + ofx, ta[3][0]*16 + ofy, 16, 16))
    return [bmp, 0, 0]
  end
  
  #--------------------------------------------------------------------------
  # ☆ 第二套结构代码,定义了素材A3的房顶部分
  #--------------------------------------------------------------------------
  def diertao(whattype = 0)
    array = [
    [[2,2],[2,1],[1,2],[1,1]],
    [[2,0],[2,1],[1,0],[1,1]],
    [[0,2],[0,1],[1,2],[1,1]],
    [[0,0],[0,1],[1,0],[1,1]],
    [[2,2],[2,3],[1,2],[1,3]],
    [[2,0],[2,3],[1,0],[1,3]],
    [[0,2],[0,3],[1,2],[1,3]],
    [[0,0],[0,3],[1,0],[1,3]],
    [[2,2],[2,1],[3,2],[3,1]],
    [[2,0],[2,1],[3,0],[3,1]],
    [[0,2],[0,1],[3,2],[3,1]],   
    [[0,0],[0,1],[3,0],[3,1]],
    [[2,2],[2,3],[3,2],[3,3]],
    [[2,0],[2,3],[3,0],[3,3]],
    [[0,2],[0,3],[3,2],[3,3]],
    [[0,0],[0,3],[3,0],[3,3]],
    [[0,0],[0,0],[0,0],[0,0]],
    ]
    return array[whattype] if array[whattype] != nil
    return [[0,0],[0,0],[0,0],[0,0]]
  end
  
  #--------------------------------------------------------------------------
  # ☆ 第二套结构代码,定义了素材A4的墙壁部分
  #--------------------------------------------------------------------------
  def disitao(whattype = 0)
    array = [
    [[8,2],[8,1],[7,2],[7,1]],
    [[8,0],[8,1],[7,0],[7,1]],
    [[6,2],[6,1],[7,2],[7,1]],
    [[6,0],[6,1],[7,2],[7,1]],
    [[8,2],[8,3],[7,2],[7,3]],
    [[8,0],[8,3],[7,0],[7,3]],
    [[6,2],[6,3],[7,2],[7,3]],
    [[6,2],[6,3],[7,0],[7,3]],
    [[8,2],[8,1],[9,2],[9,1]],
    [[8,0],[8,1],[9,0],[9,1]],
    [[6,2],[6,1],[9,2],[9,1]],   
    [[6,0],[6,1],[9,0],[9,1]],
    [[8,2],[8,3],[9,2],[9,3]],
    [[8,0],[8,3],[9,0],[9,3]],
    [[6,2],[6,3],[9,2],[9,3]],
    [[6,0],[6,3],[9,0],[9,3]],
    [[6,0],[6,0],[6,0],[6,0]], # 填满48个
    ]
    return array[whattype] if array[whattype] != nil
    return [[6,0],[6,0],[6,0],[6,0]]
  end
  
  #--------------------------------------------------------------------------
  # ☆ 第三套结构代码,定义了素材A3的房屋部分
  #--------------------------------------------------------------------------
  def disantao(whattype = 0)
    array = [
    [[6,2],[6,1],[5,2],[5,1]],
    [[6,0],[6,1],[5,0],[5,1]],
    [[4,2],[4,1],[5,2],[5,1]],
    [[4,0],[4,1],[5,2],[5,1]],
    [[6,2],[6,3],[5,2],[5,3]],
    [[6,0],[6,3],[5,0],[5,3]],
    [[4,2],[4,3],[5,2],[5,3]],
    [[4,2],[4,3],[5,0],[5,3]],
    [[6,2],[6,1],[7,2],[7,1]],
    [[6,0],[6,1],[7,0],[7,1]],
    [[4,2],[4,1],[7,2],[7,1]],   
    [[4,0],[4,1],[7,0],[7,1]],
    [[6,2],[6,3],[7,2],[7,3]],
    [[6,0],[6,3],[7,0],[7,3]],
    [[4,2],[4,3],[7,2],[7,3]],
    [[4,0],[4,3],[7,0],[7,3]],
    [[4,0],[4,0],[4,0],[4,0]], # 填满48个
    ]
    return array[whattype] if array[whattype] != nil
    return [[4,0],[4,0],[4,0],[4,0]]
  end# 房屋部分
   
  
  #--------------------------------------------------------------------
  # ★ 第一套结构数组,这个用于定义A1里面的自动元件构成。写得晕死了
  #--------------------------------------------------------------------
  def diyitao(whattype = 0)
    array = [
    [[4,2],[4,1],[3,2],[3,1]],
    [[0,2],[4,1],[3,2],[3,1]],
    [[4,2],[0,3],[3,2],[3,1]],
    [[0,2],[0,3],[3,2],[3,1]],
    [[4,2],[4,1],[3,2],[1,3]],
    [[0,2],[4,1],[3,2],[1,3]],
    [[4,2],[0,3],[3,2],[1,3]],
    [[0,2],[0,3],[3,2],[1,3]],
    [[4,2],[4,1],[1,2],[3,1]],
    [[0,2],[4,1],[1,2],[3,1]],   
    [[4,2],[0,3],[1,2],[3,1]],
    [[0,2],[0,3],[1,2],[3,1]],
    [[4,2],[4,1],[1,2],[1,3]],
    [[0,2],[4,1],[1,2],[1,3]],
    [[4,2],[0,3],[1,2],[1,3]],
    [[0,2],[0,3],[1,2],[1,3]],   
    [[4,0],[4,1],[3,0],[3,1]],
    [[4,0],[0,3],[3,0],[3,1]],
    [[4,0],[4,1],[3,0],[1,3]],
    [[4,0],[0,3],[3,0],[1,3]],   
    [[2,2],[2,1],[3,2],[3,1]],
    [[2,2],[2,1],[3,2],[1,3]],
    [[2,2],[2,1],[1,2],[3,1]],
    [[2,2],[2,1],[1,2],[1,3]],
    [[4,2],[4,3],[3,2],[3,3]],
    [[4,2],[4,3],[1,2],[3,3]],
    [[0,2],[4,3],[3,2],[3,3]],
    [[0,2],[4,3],[1,2],[3,3]],
    [[4,2],[4,1],[5,2],[5,1]],
    [[0,2],[4,1],[5,2],[5,1]],
    [[4,2],[0,3],[5,2],[5,1]],
    [[0,2],[0,3],[5,2],[5,1]],
    [[4,0],[4,3],[3,0],[3,3]],
    [[2,2],[2,1],[5,2],[5,1]],
    [[2,0],[2,1],[3,0],[3,1]], #34
    [[2,0],[2,1],[3,0],[1,3]],  
    [[2,2],[2,3],[3,2],[3,3]],
    [[2,2],[2,3],[1,2],[3,3]],
    [[4,2],[4,3],[5,2],[5,3]],
    [[0,2],[4,3],[5,2],[5,3]],
    [[4,0],[4,1],[5,0],[5,1]],
    [[4,0],[0,3],[5,0],[5,1]],
    [[2,0],[2,3],[3,0],[3,3]],
    [[2,0],[2,1],[5,0],[5,1]],
    [[4,0],[4,3],[5,0],[5,3]],
    [[2,2],[2,3],[5,2],[5,3]],
    [[2,0],[2,3],[5,0],[5,3]],
    [[0,0],[0,1],[1,0],[1,1]]
    ]
    return array[whattype]
  end
  
  
  
  
  #--------------------------------------------------------------------------
  # ● 生成交通工具
  #--------------------------------------------------------------------------
  def create_vehicles
    @vehicles = []
    @vehicles[0] = Game_Vehicle.new(0)    # 小型船
    @vehicles[1] = Game_Vehicle.new(1)    # 大型船
    @vehicles[2] = Game_Vehicle.new(2)    # 飛行船
  end
  #--------------------------------------------------------------------------
  # ● 刷新交通工具
  #--------------------------------------------------------------------------
  def referesh_vehicles
    for vehicle in @vehicles
      vehicle.refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取小型船
  #--------------------------------------------------------------------------
  def boat
    return @vehicles[0]
  end
  #--------------------------------------------------------------------------
  # ● 获取大型船
  #--------------------------------------------------------------------------
  def ship
    return @vehicles[1]
  end
  #--------------------------------------------------------------------------
  # ● 获取飞行船
  #--------------------------------------------------------------------------
  def airship
    return @vehicles[2]
  end
  #--------------------------------------------------------------------------
  # ● 设置事件
  #--------------------------------------------------------------------------
  def setup_events
    @events = {}          # 地图事件
    for i in @map.events.keys
      @events[i] = Game_Event.new(@map_id, @map.events[i])
    end
    @common_events = {}   # 公共事件
    for i in 1...$data_common_events.size
      @common_events[i] = Game_CommonEvent.new(i)
    end
  end
  #--------------------------------------------------------------------------
  # ● 设置滚动
  #--------------------------------------------------------------------------
  def setup_scroll
    @scroll_direction = 2
    @scroll_rest = 0
    @scroll_speed = 4
    @margin_x = (width - 17) * 256 / 2      # 画面不显示的地方宽 / 2
    @margin_y = (height - 13) * 256 / 2     # 画面不显示的地方高 / 2
  end
  #--------------------------------------------------------------------------
  # ● 设置远景
  #--------------------------------------------------------------------------
  def setup_parallax
    @parallax_name = @map.parallax_name
    @parallax_loop_x = @map.parallax_loop_x
    @parallax_loop_y = @map.parallax_loop_y
    @parallax_sx = @map.parallax_sx
    @parallax_sy = @map.parallax_sy
    @parallax_x = 0
    @parallax_y = 0
  end
  #--------------------------------------------------------------------------
  # ● 设置显示位置
  #     x : 新显示 X 坐标 (*256)
  #     y : 新显示 Y 坐标 (*256)
  #--------------------------------------------------------------------------
  def set_display_pos(x, y)
    @display_x = (x + @map.width * 256) % (@map.width * 256)
    @display_y = (y + @map.height * 256) % (@map.height * 256)
    @parallax_x = x
    @parallax_y = y
    refresh_maze_game
    refresh_maze_sprite
  end
  #--------------------------------------------------------------------------
  # ● 计算远景显示 X 坐标
  #     bitmap : 远景位图
  #--------------------------------------------------------------------------
  def calc_parallax_x(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_x
      return @parallax_x / 16
    elsif loop_horizontal?
      return 0
    else
      w1 = bitmap.width - 544
      w2 = @map.width * 32 - 544
      if w1 <= 0 or w2 <= 0
        return 0
      else
        return @parallax_x * w1 / w2 / 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 计算远景显示 Y 坐标
  #     bitmap : 远景位图
  #--------------------------------------------------------------------------
  def calc_parallax_y(bitmap)
    if bitmap == nil
      return 0
    elsif @parallax_loop_y
      return @parallax_y / 16
    elsif loop_vertical?
      return 0
    else
      h1 = bitmap.height - 416
      h2 = @map.height * 32 - 416
      if h1 <= 0 or h2 <= 0
        return 0
      else
        return @parallax_y * h1 / h2 / 8
      end
    end
  end
  #--------------------------------------------------------------------------
  # ● 获取地图 ID
  #--------------------------------------------------------------------------
  def map_id
    return @map_id
  end
  #--------------------------------------------------------------------------
  # ● 获取宽度
  #--------------------------------------------------------------------------
  def width
    return @map.width
  end
  #--------------------------------------------------------------------------
  # ● 获取高度
  #--------------------------------------------------------------------------
  def height
    return @map.height
  end
  #--------------------------------------------------------------------------
  # ● 横方向循环吗?
  #--------------------------------------------------------------------------
  def loop_horizontal?
    return (@map.scroll_type == 2 or @map.scroll_type == 3)
  end
  #--------------------------------------------------------------------------
  # ● 纵方向循环吗?
  #--------------------------------------------------------------------------
  def loop_vertical?
    return (@map.scroll_type == 1 or @map.scroll_type == 3)
  end
  #--------------------------------------------------------------------------
  # ● 获取跑动与否?
  #--------------------------------------------------------------------------
  def disable_dash?
    return @map.disable_dashing
  end
  #--------------------------------------------------------------------------
  # ● 获取遇敌列表
  #--------------------------------------------------------------------------
  def encounter_list
    return @map.encounter_list
  end
  #--------------------------------------------------------------------------
  # ● 获取遇敌步数
  #--------------------------------------------------------------------------
  def encounter_step
    return @map.encounter_step
  end
  #--------------------------------------------------------------------------
  # ● 获取地图数据
  #--------------------------------------------------------------------------
  def data
    return @map.data
  end
  #--------------------------------------------------------------------------
  # ● 计算扣除显示坐标的 X 坐标
  #     x : X 坐标
  #--------------------------------------------------------------------------
  def adjust_x(x)
    if loop_horizontal? and x < @display_x - @margin_x
      return x - @display_x + @map.width * 256
    else
      return x - @display_x
    end
  end
  #--------------------------------------------------------------------------
  # ● 计算扣除显示坐标的 Y 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def adjust_y(y)
    if loop_vertical? and y < @display_y - @margin_y
      return y - @display_y + @map.height * 256
    else
      return y - @display_y
    end
  end
  #--------------------------------------------------------------------------
  # ● 计算循环修正后的 X 坐标
  #     x : X 坐标
  #--------------------------------------------------------------------------
  def round_x(x)
    if loop_horizontal?
      return (x + width) % width
    else
      return x
    end
  end
  #--------------------------------------------------------------------------
  # ● 计算循环修正后的 Y坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def round_y(y)
    if loop_vertical?
      return (y + height) % height
    else
      return y
    end
  end
  #--------------------------------------------------------------------------
  # ● 计算特定方向移动 1 マス X 坐标
  #     x         : X 坐标
  #     direction : 方向 (2,4,6,8)
  #--------------------------------------------------------------------------
  def x_with_direction(x, direction)
    return round_x(x + (direction == 6 ? 1 : direction == 4 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # ● 计算特定方向移动 1 マス Y 坐标
  #     y         : Y 坐标
  #     direction : 方向 (2,4,6,8)
  #--------------------------------------------------------------------------
  def y_with_direction(y, direction)
    return round_y(y + (direction == 2 ? 1 : direction == 8 ? -1 : 0))
  end
  #--------------------------------------------------------------------------
  # ● 获取指定坐标存在的事件排列
  #     x : X 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def events_xy(x, y)
    result = []
    for event in $game_map.events.values
      result.push(event) if event.pos?(x, y)
    end
    return result
  end
  #--------------------------------------------------------------------------
  # ● BGM / BGS 自动切换
  #--------------------------------------------------------------------------
  def autoplay
    @map.bgm.play if @map.autoplay_bgm
    @map.bgs.play if @map.autoplay_bgs
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    if @map_id > 0
      for event in @events.values
        event.refresh
      end
      for common_event in @common_events.values
        common_event.refresh
      end
    end
    refresh_mg_tansuo
    @need_refresh = false
  end
  #--------------------------------------------------------------------------
  # ● 迷宫探索系统
  #--------------------------------------------------------------------------
  def refresh_mg_tansuo
   
  end  
  #--------------------------------------------------------------------------
  # ● 向下滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
    else
      last_y = @display_y
      @display_y = [@display_y + distance, (height - 13) * 256].min
      @parallax_y += @display_y - last_y
    end
  end
  #--------------------------------------------------------------------------
  # ● 向左滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_left(distance)
    if loop_horizontal?
      @display_x += @map.width * 256 - distance
      @display_x %= @map.width * 256
      @parallax_x -= distance
    else
      last_x = @display_x
      @display_x = [@display_x - distance, 0].max
      @parallax_x += @display_x - last_x
    end
  end
  #--------------------------------------------------------------------------
  # ● 向右滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_right(distance)
    if loop_horizontal?
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
    else
      last_x = @display_x
      @display_x = [@display_x + distance, (width - 17) * 256].min
      @parallax_x += @display_x - last_x
    end
  end
  #--------------------------------------------------------------------------
  # ● 向上滚动
  #     distance : 滚动距离
  #--------------------------------------------------------------------------
  def scroll_up(distance)
    if loop_vertical?
      @display_y += @map.height * 256 - distance
      @display_y %= @map.height * 256
      @parallax_y -= distance
    else
      last_y = @display_y
      @display_y = [@display_y - distance, 0].max
      @parallax_y += @display_y - last_y
    end
  end
  #--------------------------------------------------------------------------
  # ● 有效坐标判定
  #     x          : X 坐标
  #     y          : Y 坐标
  #--------------------------------------------------------------------------
  def valid?(x, y)
    return (x >= 0 and x < width and y >= 0 and y < height)
  end
  #--------------------------------------------------------------------------
  # ● 可以通行判定
  #     x    : X 坐标
  #     y    : Y 坐标  
  #     flag : 检查通行禁止数据 (通常 0x01、交通工具的情况下变更)
  #--------------------------------------------------------------------------
  def passable?(x, y, flag = 0x01)
    for event in events_xy(x, y)            # 检查坐标相同的事件
      next if event.tile_id == 0            # 地图没有图块的情况下
      next if event.priority_type > 0       # 不是[通常形式下]
      next if event.through                 # 穿透状态
      pass = @passages[event.tile_id]       # 获取通行属性
      next if pass & 0x10 == 0x10           # [☆] : 不影响通行
      return true if pass & flag == 0x00    # [○] : 可通行
      return false if pass & flag == flag   # [×] : 不可通行
    end
    for i in [2, 1, 0]                      # 从层按从上到下的顺序调查循环
      tile_id = @map.data[x, y, i]          # 获取元件 ID
      return false if tile_id == nil        # 取得元件 ID 失败 : 不能通行
      pass = @passages[tile_id]             # 获取通行属性
      next if pass & 0x10 == 0x10           # [☆] : 不影响通行
      return true if pass & flag == 0x00    # [○] : 可通行
      return false if pass & flag == flag   # [×] : 不可通行
    end
    return false                            # 通行不可
  end
  #--------------------------------------------------------------------------
  # ● 小型船通行判定
  #     x : X 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def boat_passable?(x, y)
    return passable?(x, y, 0x02)
  end
  #--------------------------------------------------------------------------
  # ● 大型船通行判定
  #     x : X 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def ship_passable?(x, y)
    return passable?(x, y, 0x04)
  end
  #--------------------------------------------------------------------------
  # ● 飞行船着陆可能判定
  #     x : X 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def airship_land_ok?(x, y)
    return passable?(x, y, 0x08)
  end
  #--------------------------------------------------------------------------
  # ● 茂密判定
  #     x : X 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def bush?(x, y)
    return false unless valid?(x, y)
    return @passages[@map.data[x, y, 1]] & 0x40 == 0x40
  end
  #--------------------------------------------------------------------------
  # ● 反击判定
  #     x : X 坐标
  #     y : Y 坐标
  #--------------------------------------------------------------------------
  def counter?(x, y)
    return false unless valid?(x, y)
    return @passages[@map.data[x, y, 0]] & 0x80 == 0x80
  end
  #--------------------------------------------------------------------------
  # ● 滚动开始
  #     direction : 滚动方向
  #     distance  : 滚动距离
  #     speed     : 滚动速度
  #--------------------------------------------------------------------------
  def start_scroll(direction, distance, speed)
    @scroll_direction = direction
    @scroll_rest = distance * 256
    @scroll_speed = speed
  end
  #--------------------------------------------------------------------------
  # ● 滚动中中判定
  #--------------------------------------------------------------------------
  def scrolling?
    return @scroll_rest > 0
  end
  #--------------------------------------------------------------------------
  # ● 画面刷新
  #--------------------------------------------------------------------------
  def update
    refresh if $game_map.need_refresh
    update_scroll
    update_events
    update_vehicles
    update_parallax
    update_maze
    @screen.update
  end
  #--------------------------------------------------------------------------
  # ● 刷新迷宫,每20帧刷一次
  #--------------------------------------------------------------------------
  def update_maze   
    @refresh_maze_count = 0 if @refresh_maze_count == nil
    if @refresh_maze_count == 0
      refresh_maze_small
      @refresh_maze_count = 20
    else
      @refresh_maze_count -= 1
    end
  end
  #--------------------------------------------------------------------------
  # ● 滚动刷新
  #--------------------------------------------------------------------------
  def update_scroll
    if @scroll_rest > 0                 # 滚动中的情况下
      distance = 2 ** @scroll_speed     # 滚动速度变化为地图坐标系的距离
      case @scroll_direction
      when 2  # 下
        scroll_down(distance)
      when 4  # 左
        scroll_left(distance)
      when 6  # 右
        scroll_right(distance)
      when 8  # 上
        scroll_up(distance)
      end
      @scroll_rest -= distance          # 滚动距离的减法运算
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新事件
  #--------------------------------------------------------------------------
  def update_events
    for event in @events.values
      event.update
    end
    for common_event in @common_events.values
      common_event.update
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新交通工具
  #--------------------------------------------------------------------------
  def update_vehicles
    for vehicle in @vehicles
      vehicle.update
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新远景
  #--------------------------------------------------------------------------
  def update_parallax
    @parallax_x += @parallax_sx * 4 if @parallax_loop_x
    @parallax_y += @parallax_sy * 4 if @parallax_loop_y
  end
end
[/code]

点评

能不能把脚本贴出来  发表于 2011-8-29 08:50

音速君

梦石
0
星屑
161
在线时间
1623 小时
注册时间
2011-6-9
回帖
3342

开拓者贵宾

发表于 2011-8-29 10:33:53 | 显示全部楼层
是这个吗?
  1. #===============================================================
  2. # ● [VX] ?迷你地图 ? □
  3. # * 无须图片的迷你地图脚本,浪使者倾情汉化 *
  4. #--------------------------------------------------------------
  5. # ? by Woratana [原作者]
  6. # ? 用于 RPG Maker VX  
  7. # ? 最近更新: 09/09/2008
  8. # ? 版本: 1.1 Beta
  9. #--------------------------------------------------------------
  10. # ? 特别感谢: KGC 的 XP 迷你地图脚本,
  11. # 没有他的迷你地图脚本,这个就不会被做出来.
  12. # 精灵使者更新:请在注释的第一行写入关键字,关键字可以在下面添加。
  13. #--------------------------------------------------------------

  14. module MiniMap
  15.   #===========================================================================
  16.   # [START]迷你地图脚本设置部分 地图名前+[NOMAP] 不显示
  17.   #---------------------------------------------------------------------------
  18.   SWITCH_NO_MINIMAP = 120 #  打开这个开关的话就不显示迷你地图
  19.    
  20.   MAP_RECT = [400, 20, 96, 96] # 迷你地图的大小和位置
  21.   # [X, Y, Width, Height]
  22.   # 你可以用调用脚本的方法任意改变他:
  23.   # $game_system.minimap = [X, Y, Width, Height]

  24.   MAP_Z = 0 # 迷你地图的Z轴
  25.   # 增加这个数值,如果迷你地图显示在某些物体下面的话(被覆盖)。

  26.   GRID_SIZE = 8 # 引导大小,建议数值大于3.
  27.   
  28.   MINIMAP_BORDER_COLOR = Color.new(0, 0, 0, 255) # 色彩设定
  29.   # Color.new(Red, Green, Blue, Opacity)
  30.   MINIMAP_BORDER_SIZE = 3
  31.   
  32.   FOREGROUND_COLOR = Color.new(255, 255, 255, 255) # 可通过物颜色
  33.   BACKGROUND_COLOR = Color.new(0, 0, 0, 100) # 不可通过物颜色

  34.   USE_OUTLINE_PLAYER = true # 是否描绘的角色?
  35.   PLAYER_OUTLINE_COLOR = Color.new(0, 0, 0, 255) # 角色颜色
  36.   USE_OUTLINE_EVENT = true # 是否描绘特殊事件?(如商人、敌人NPC等)
  37.   EVENT_OUTLINE_COLOR = Color.new(0, 0, 0, 255) # 特殊事件颜色
  38.   
  39.   PLAYER_COLOR = Color.new(0, 0, 255, 255) # 角色颜色设定
  40.   #---------------------------------------------------------------------------

  41.   OBJECT_COLOR = {} # 不要改变或删除这一行!
  42.   #===============================================================
  43.   # * 设置关键字和颜色
  44.   #---------------------------------------------------------------
  45.   # ** 例如:
  46.   # OBJECT_COLOR['keyword'] = Color.new(Red, Green, Blue, Opacity)
  47.   #-------------------------------------------------------------
  48.   # * 'keyword': 你想放到公共事件里来显示的颜色
  49.   # ** 标记: 'keyword' 是很关键的!
  50.   # * Color.new(...): 你需要的颜色
  51.   # 你可输入 0 - 255 的可选色彩范围 (Red, Green, Blue, Opacity)
  52.   #-------------------------------------------------------------
  53.   OBJECT_COLOR['npc'] = Color.new(0,255,255,255)
  54.   OBJECT_COLOR['treasure'] = Color.new(255,255,0,255)
  55.   OBJECT_COLOR['enemy'] = Color.new(255,0,0,255)
  56.   OBJECT_COLOR['merchant'] = Color.new(255,150,0,255)
  57.   OBJECT_COLOR['teleport'] = Color.new(255,0,255,255)
  58.   OBJECT_COLOR['rest'] = Color.new(0,255,0,255)
  59.   OBJECT_COLOR['door'] = Color.new(128,128,128,255)
  60.   #===========================================================================
  61.   # * [说明] 标签:
  62.   #---------------------------------------------------------------------------
  63.   # 改变这些关闭迷你地图 & 或设置显示迷你地图~
  64.   # TAG_EVENT的关键字和OBJECT_COLOR关键字要对应。
  65.   #-----------------------------------------------------------------------
  66.   TAG_NO_MINIMAP = '[NOMAP]'
  67.   TAG_EVENT = ["npc","enemy","treasure","merchant","teleport","rest"]
  68.   #---------------------------------------------------------------------------
  69.   # NPC 非主角控制人物 enemy敌人 treasure宝物 merchant商人 teleport传送 door门
  70.   # REST   休息
  71.   #---------------------------------------------------------------------------
  72.   # [END] 迷你地图脚本设置部分
  73.   #===========================================================================
  74.   
  75.   def self.refresh
  76.     if $scene.is_a?(Scene_Map)
  77.       $scene.spriteset.minimap.refresh
  78.     end
  79.   end
  80.   
  81.   def self.update_object
  82.     if $scene.is_a?(Scene_Map)
  83.       $scene.spriteset.minimap.update_object_list
  84.     end
  85.   end
  86. end

  87. #==============================================================================
  88. # ■ RPG::MapInfo
  89. #==============================================================================
  90. class RPG::MapInfo
  91.   def name
  92.     return @name.gsub(/\[.*\]/) { }
  93.   end

  94.   def original_name
  95.     return @name
  96.   end

  97.   def show_minimap?
  98.     return !@name.include?(MiniMap::TAG_NO_MINIMAP)
  99.   end
  100. end
  101. #==============================================================================
  102. # ■ Game_System
  103. #==============================================================================
  104. class Game_System
  105.   attr_accessor :minimap
  106.   alias wora_minimap_gamsys_ini initialize
  107.   
  108.   def initialize
  109.     wora_minimap_gamsys_ini
  110.     @minimap = MiniMap::MAP_RECT
  111.   end
  112.   
  113.   def show_minimap
  114.     return !$game_switches[MiniMap::SWITCH_NO_MINIMAP]
  115.   end
  116. end
  117. #==============================================================================
  118. # ■ Game_Map
  119. #==============================================================================
  120. class Game_Map
  121.   alias wora_minimap_gammap_setup setup
  122.   def setup(map_id)
  123.     wora_minimap_gammap_setup(map_id)
  124.     @db_info = load_data('Data/MapInfos.rvdata') if @db_info.nil?
  125.     @map_info = @db_info[map_id]
  126.   end
  127.   
  128.   def show_minimap?
  129.     return @map_info.show_minimap?
  130.   end
  131. end
  132. #==============================================================================
  133. # ■ Game_Event
  134. #==============================================================================
  135. class Game_Event < Game_Character
  136.   def mm_comment?(comment, return_comment = false )
  137.     if !@list.nil?
  138.       for i in 0...@list.size - 1
  139.         next if @list[i].code != 108
  140.         if comment.include?(@list[i].parameters[0])
  141.           return @list[i].parameters[0] if return_comment
  142.           return true
  143.         end
  144.       end
  145.     end
  146.     return '' if return_comment
  147.     return false
  148.   end
  149. end

  150. #==============================================================================
  151. # ■ Game_MiniMap
  152. #------------------------------------------------------------------------------
  153. class Game_MiniMap
  154.   def initialize(tilemap)
  155.     @tilemap = tilemap
  156.     refresh
  157.   end

  158.   def dispose
  159.     @border.bitmap.dispose
  160.     @border.dispose
  161.     @map_sprite.bitmap.dispose
  162.     @map_sprite.dispose
  163.     @object_sprite.bitmap.dispose
  164.     @object_sprite.dispose
  165.     @position_sprite.bitmap.dispose
  166.     @position_sprite.dispose
  167.   end

  168.   def visible
  169.     return @map_sprite.visible
  170.   end

  171.   def visible=(value)
  172.     @map_sprite.visible = value
  173.     @object_sprite.visible = value
  174.     @position_sprite.visible = value
  175.     @border.visible = value
  176.   end

  177.   def refresh
  178.     @mmr = $game_system.minimap
  179.     map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
  180.     grid_size = [MiniMap::GRID_SIZE, 1].max

  181.     @x = 0
  182.     @y = 0
  183.     @size = [map_rect.width / grid_size, map_rect.height / grid_size]

  184.     @border = Sprite.new
  185.     @border.x = map_rect.x - MiniMap::MINIMAP_BORDER_SIZE
  186.     @border.y = map_rect.y - MiniMap::MINIMAP_BORDER_SIZE
  187.     b_width = map_rect.width + (MiniMap::MINIMAP_BORDER_SIZE * 2)
  188.     b_height = map_rect.height + (MiniMap::MINIMAP_BORDER_SIZE * 2)
  189.     @border.bitmap = Bitmap.new(b_width, b_height)
  190.     @border.bitmap.fill_rect(@border.bitmap.rect, MiniMap::MINIMAP_BORDER_COLOR)
  191.     @border.bitmap.clear_rect(MiniMap::MINIMAP_BORDER_SIZE, MiniMap::MINIMAP_BORDER_SIZE,
  192.     @border.bitmap.width - (MiniMap::MINIMAP_BORDER_SIZE * 2),
  193.     @border.bitmap.height - (MiniMap::MINIMAP_BORDER_SIZE * 2))
  194.    
  195.     @map_sprite = Sprite.new
  196.     @map_sprite.x = map_rect.x
  197.     @map_sprite.y = map_rect.y
  198.     @map_sprite.z = MiniMap::MAP_Z
  199.     bitmap_width = $game_map.width * grid_size + map_rect.width
  200.     bitmap_height = $game_map.height * grid_size + map_rect.height
  201.     @map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
  202.     @map_sprite.src_rect = map_rect

  203.     @object_sprite = Sprite.new
  204.     @object_sprite.x = map_rect.x
  205.     @object_sprite.y = map_rect.y
  206.     @object_sprite.z = MiniMap::MAP_Z + 1
  207.     @object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
  208.     @object_sprite.src_rect = map_rect

  209.     @position_sprite = Sprite_Base.new
  210.     @position_sprite.x = map_rect.x + @size[0] / 2 * grid_size
  211.     @position_sprite.y = map_rect.y + @size[1] / 2 * grid_size
  212.     @position_sprite.z = MiniMap::MAP_Z + 2
  213.    
  214.     bitmap = Bitmap.new(grid_size, grid_size)
  215.     # Player's Outline
  216.     if MiniMap::USE_OUTLINE_PLAYER and MiniMap::GRID_SIZE >= 3
  217.       bitmap.fill_rect(bitmap.rect, MiniMap::PLAYER_OUTLINE_COLOR)
  218.       brect = Rect.new(bitmap.rect.x + 1, bitmap.rect.y + 1, bitmap.rect.width - 2,
  219.         bitmap.rect.height - 2)
  220.       bitmap.clear_rect(brect)
  221.     else
  222.       brect = bitmap.rect
  223.     end
  224.    
  225.     bitmap.fill_rect(brect, MiniMap::PLAYER_COLOR)
  226.     @position_sprite.bitmap = bitmap

  227.     draw_map
  228.     update_object_list
  229.     draw_object
  230.     update_position
  231.   end

  232.   def draw_map
  233.     bitmap = @map_sprite.bitmap
  234.     bitmap.fill_rect(bitmap.rect, MiniMap::BACKGROUND_COLOR)
  235.     map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
  236.     grid_size = [MiniMap::GRID_SIZE, 1].max
  237.    
  238.     $game_map.width.times do |i|
  239.       $game_map.height.times do |j|
  240.         if !$game_map.passable?(i, j)
  241.           next
  242.         end
  243.         rect = Rect.new(map_rect.width / 2 + grid_size * i,
  244.           map_rect.height / 2 + grid_size * j,
  245.           grid_size, grid_size)
  246.         if grid_size >= 3
  247.           if !$game_map.passable?(i, j)
  248.             rect.height -= 1
  249.             rect.x += 1
  250.             rect.width -= 1
  251.             rect.width -= 1
  252.             rect.y += 1
  253.             rect.height -= 1
  254.           end
  255.         end
  256.         bitmap.fill_rect(rect, MiniMap::FOREGROUND_COLOR)
  257.       end
  258.     end
  259.   end

  260.     def update_object_list
  261.     @object_list = {}
  262.     $game_map.events.values.each do |e|
  263.       comment = e.mm_comment?(MiniMap::TAG_EVENT, true)
  264.       if comment != ''
  265.         #type = comment.gsub(/#{MiniMap::TAG_EVENT}/){}.gsub(/\s+/){}
  266.         type = comment
  267.         @object_list[type] = [] if @object_list[type].nil?
  268.         @object_list[type] << e
  269.       end
  270.     end
  271.   end

  272.   def draw_object
  273.     bitmap = @object_sprite.bitmap
  274.     bitmap.clear
  275.     map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
  276.     grid_size = [MiniMap::GRID_SIZE, 1].max
  277.     rect = Rect.new(0, 0, grid_size, grid_size)
  278.     mw = map_rect.width / 2
  279.     mh = map_rect.height / 2

  280.     @object_list.each do |key, events|
  281.       color = MiniMap::OBJECT_COLOR[key]
  282.       next if events.nil? or color.nil?
  283.       events.each do |obj|
  284.         #if !obj.character_name.empty?
  285.           rect.x = mw + obj.real_x * grid_size / 256
  286.           rect.y = mh + obj.real_y * grid_size / 256
  287.           # Event's Outline
  288.           if MiniMap::USE_OUTLINE_EVENT and MiniMap::GRID_SIZE >= 3
  289.             bitmap.fill_rect(rect, MiniMap::EVENT_OUTLINE_COLOR)
  290.             brect = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2,
  291.             rect.height - 2)
  292.             bitmap.clear_rect(brect)
  293.           else
  294.             brect = bitmap.rect
  295.           end
  296.           bitmap.fill_rect(brect, color)
  297.         #end
  298.       end
  299.     end
  300.   end

  301.   def update
  302.     if @mmr != $game_system.minimap
  303.       dispose
  304.       refresh
  305.     end
  306.     update_object_list
  307.     draw_object
  308.     update_position
  309.     if @map_sprite.visible
  310.       @map_sprite.update
  311.       @object_sprite.update
  312.       @position_sprite.update
  313.     end
  314.   end

  315.   def update_position
  316.     map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
  317.     grid_size = [MiniMap::GRID_SIZE, 1].max
  318.     sx = $game_player.real_x * grid_size / 256
  319.     sy = $game_player.real_y * grid_size / 256
  320.     @map_sprite.src_rect.x = sx
  321.     @map_sprite.src_rect.y = sy
  322.     @object_sprite.src_rect.x = sx
  323.     @object_sprite.src_rect.y = sy
  324.   end
  325. end
  326. #==============================================================================
  327. # ■ Spriteset_Map
  328. #------------------------------------------------------------------------------
  329. class Spriteset_Map
  330.   attr_reader :minimap
  331.   alias wora_minimap_sprsetmap_ini initialize
  332.   alias wora_minimap_sprsetmap_dis dispose
  333.   alias wora_minimap_sprsetmap_upd update
  334.   
  335.   def initialize
  336.     wora_minimap_sprsetmap_ini
  337.     if $game_map.show_minimap?
  338.       @minimap = Game_MiniMap.new(@tilemap)
  339.       $game_system.show_minimap = true if $game_system.show_minimap.nil?
  340.       @minimap.visible = $game_system.show_minimap
  341.     end
  342.   end
  343.   
  344.   def dispose
  345.     @minimap.dispose if !@minimap.nil?
  346.     wora_minimap_sprsetmap_dis
  347.   end

  348.   def update
  349.     if !@minimap.nil?
  350.       if $game_system.show_minimap
  351.         @minimap.visible = true
  352.         @minimap.update_object_list
  353.         @minimap.update
  354.       else
  355.         @minimap.visible = false
  356.       end
  357.     end
  358.     wora_minimap_sprsetmap_upd
  359.   end
  360. end
  361. #==============================================================================
  362. # ■ Scene_Map
  363. #------------------------------------------------------------------------------
  364. class Scene_Map < Scene_Base
  365.   attr_reader :spriteset
  366. end
复制代码
不知道什么原因,反正新开一个就没事了。
Deartime
RMVA从零学起
【RMVA从零学起】【基础27课】数据库-系统
#2013年11月24日更新
偷懒了好久呢. .
于是最终还是决定暂时不写进阶教程了
先把这些基础的东西仔细说一下.w.
回复

使用道具 举报

梦石
0
星屑
50
在线时间
178 小时
注册时间
2011-2-6
回帖
41
 楼主| 发表于 2011-8-29 11:15:38 | 显示全部楼层
Sonic1997 发表于 2011-8-29 10:33
是这个吗?不知道什么原因,反正新开一个就没事了。

不是……
是http://rpg.blue/thread-72764-1-1.html的……迷宫探索系统
回复

使用道具 举报

音速君

梦石
0
星屑
161
在线时间
1623 小时
注册时间
2011-6-9
回帖
3342

开拓者贵宾

发表于 2011-8-29 11:25:53 | 显示全部楼层
888000 发表于 2011-8-29 11:15
不是……
是http://rpg.blue/thread-72764-1-1.html的……迷宫探索系统

你已经把所有★的脚本放入游戏了吗?
Deartime
RMVA从零学起
【RMVA从零学起】【基础27课】数据库-系统
#2013年11月24日更新
偷懒了好久呢. .
于是最终还是决定暂时不写进阶教程了
先把这些基础的东西仔细说一下.w.
回复

使用道具 举报

梦石
0
星屑
50
在线时间
178 小时
注册时间
2011-2-6
回帖
41
 楼主| 发表于 2011-8-29 12:05:51 | 显示全部楼层
Sonic1997 发表于 2011-8-29 11:25
你已经把所有★的脚本放入游戏了吗?

是的,而且就算是范例,也是读档再存档就错误


888000于2011-8-29 12:06补充以下内容:
然道是我rmvx版本太老?1.01的。
你们有没有问题啊?
回复

使用道具 举报

音速君

梦石
0
星屑
161
在线时间
1623 小时
注册时间
2011-6-9
回帖
3342

开拓者贵宾

发表于 2011-8-29 14:45:07 | 显示全部楼层
我用的是1.00没问题,再说,范例里是可以读档的啊,我试过!
Deartime
RMVA从零学起
【RMVA从零学起】【基础27课】数据库-系统
#2013年11月24日更新
偷懒了好久呢. .
于是最终还是决定暂时不写进阶教程了
先把这些基础的东西仔细说一下.w.
回复

使用道具 举报

梦石
0
星屑
50
在线时间
178 小时
注册时间
2011-2-6
回帖
41
 楼主| 发表于 2011-8-29 16:26:10 | 显示全部楼层
Sonic1997 发表于 2011-8-29 14:45
我用的是1.00没问题,再说,范例里是可以读档的啊,我试过!

是我rm有问题?
回复

使用道具 举报

梦石
0
星屑
1440
在线时间
274 小时
注册时间
2011-7-24
回帖
253
发表于 2011-8-29 16:43:31 | 显示全部楼层
6大的哪个有许多默认的脚本被改了还是有SF的吧6大的太麻烦
不过在传统RPG里有个小地图  不好╮(╯▽╰)╭
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部