查看: 2095|回复: 2

[已经过期] 加了小地图脚本报错的问题...望有大神给帮忙看看!

[复制链接]
梦石
0
星屑
50
在线时间
31 小时
注册时间
2013-10-19
回帖
9
发表于 2014-4-17 22:27:13 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 ylfengyo 于 2014-4-17 22:35 编辑

原脚本代码如下:
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ 迷你地图显示 ◆ VX ◆
  3. #_/    ◇ Last update : 2009/09/13 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  新增的迷你地图显示功能。很好的地图通行度检查工具
  6. #
  7. #    设定开关使用迷你地图显示,默认1号开关
  8. #    事件名字+空格+[OBJ1],显示绿点,颜色45句更改
  9. #    事件名字+空格+[OBJ2],显示蓝点,颜色46句更改
  10. #    事件名字+空格+[OBJ3], 显示品红点,颜色47句更改
  11. #   
  12. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  13. #==============================================================================
  14. # ★ 自定义项 - Customize ★
  15. #==============================================================================

  16. module KGC
  17. module MiniMap
  18.   # ◆ 迷你地图显示ON / OFF开关来切换的ID
  19.   MINIMAP_SWITCH_ID = 1

  20.   # ◆ 大小的迷你地图显示位置(X,y,宽度,高度)
  21.   MAP_RECT = Rect.new(1024-160-10, 768-120-10, 160, 120)
  22.   # ◆ Z坐标的迷你地图
  23.   MAP_Z = 0
  24.   # ◆ 一平方米大小​​的
  25.   #  三个或更多的建议。
  26.   GRID_SIZE = 5

  27.   # ◆ 小地图前景色(通行可)
  28.   FOREGROUND_COLOR = Color.new(224, 224, 255, 40)
  29.   # ◆ 小地图背景色(通行不可)
  30.   BACKGROUND_COLOR = Color.new(0, 0, 0, 100)
  31.   #BACKGROUND_COLOR = Color.new(0, 0, 160, 160)

  32.   # ◆ 現在位置图标色
  33.   POSITION_COLOR   = Color.new(255, 0, 0, 192)
  34.   # ◆ 地图移动事件[移动]颜色
  35.   MOVE_EVENT_COLOR = Color.new(255, 160, 0, 192)

  36.   # ◆ 物体颜色
  37.   #  从元素的开始[OBJ1],[obj2的],...的支持。
  38.   OBJECT_COLOR = [
  39.     Color.new(  0, 160,   0, 192),  # [OBJ 1]
  40.     Color.new(  0, 160, 255, 192),  # [OBJ 2]
  41.     Color.new(160,   0, 160, 192),  # [OBJ 3]
  42.   ]  # ← 这]无法抹去!

  43.   # ◆ 图标的实力闪烁
  44.   #  约5至8建议。
  45.   BLINK_LEVEL = 0  # 0不闪烁 5-8闪烁

  46.   # ◆ 现金地图
  47.   #  超过这个数字并不指从很长一段时间删除这些。
  48.   CACHE_NUM = 10
  49. end
  50. end

  51. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  52. $imported = {} if $imported == nil
  53. $imported["MiniMap"] = true

  54. if $data_mapinfos == nil
  55.   $data_mapinfos = load_data("Data/MapInfos.rvdata")
  56. end

  57. module KGC::MiniMap
  58.   module Regexp
  59.     # ミニマップ非表示
  60.     NO_MINIMAP = /\[NOMAP\]/i
  61.     # 障害物
  62.     WALL_EVENT = /\[WALL\]/i
  63.     # 移動イベント
  64.     MOVE_EVENT = /\[MOVE\]/i
  65.     # オブジェクト
  66.     OBJECT = /\[OBJ(?:ECT)?\s*(\d)\]/i
  67.   end
  68. end

  69. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  70. #==============================================================================
  71. # □ KGC::Commands
  72. #==============================================================================

  73. module KGC
  74. module Commands
  75.   module_function
  76.   #--------------------------------------------------------------------------
  77.   # ○ ミニマップを表示
  78.   #--------------------------------------------------------------------------
  79.   def show_minimap
  80.     $game_system.minimap_show = true
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # ○ ミニマップを隠す
  84.   #--------------------------------------------------------------------------
  85.   def hide_minimap
  86.     $game_system.minimap_show = false
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ○ ミニマップをリフレッシュ
  90.   #--------------------------------------------------------------------------
  91.   def refresh_minimap
  92.     return unless $scene.is_a?(Scene_Map)

  93.     $game_map.refresh if $game_map.need_refresh
  94.     $scene.refresh_minimap
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ○ ミニマップのオブジェクトを更新
  98.   #--------------------------------------------------------------------------
  99.   def update_minimap_object
  100.     return unless $scene.is_a?(Scene_Map)

  101.     $game_map.refresh if $game_map.need_refresh
  102.     $scene.update_minimap_object
  103.   end
  104. end
  105. end

  106. class Game_Interpreter
  107.   include KGC::Commands
  108. end

  109. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  110. #==============================================================================
  111. # ■ RPG::MapInfo
  112. #==============================================================================

  113. class RPG::MapInfo
  114.   #--------------------------------------------------------------------------
  115.   # ● マップ名取得
  116.   #--------------------------------------------------------------------------
  117.   def name
  118.     return @name.gsub(/\[.*\]/) { "" }
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ○ オリジナルマップ名取得
  122.   #--------------------------------------------------------------------------
  123.   def original_name
  124.     return @name
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ○ ミニマップのキャッシュ生成
  128.   #--------------------------------------------------------------------------
  129.   def create_minimap_cache
  130.     @__minimap_show = !(@name =~ KGC::MiniMap::Regexp::NO_MINIMAP)
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ○ ミニマップ表示
  134.   #--------------------------------------------------------------------------
  135.   def minimap_show?
  136.     create_minimap_cache if @__minimap_show == nil
  137.     return @__minimap_show
  138.   end
  139. end

  140. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  141. #==============================================================================
  142. # ■ Game_System
  143. #==============================================================================

  144. class Game_System
  145.   #--------------------------------------------------------------------------
  146.   # ○ ミニマップ表示フラグ取得
  147.   #--------------------------------------------------------------------------
  148.   def minimap_show
  149.     return $game_switches[KGC::MiniMap::MINIMAP_SWITCH_ID]
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ○ ミニマップ表示フラグ変更
  153.   #--------------------------------------------------------------------------
  154.   def minimap_show=(value)
  155.     $game_switches[KGC::MiniMap::MINIMAP_SWITCH_ID] = value
  156.     $game_map.need_refresh = true
  157.   end
  158. end

  159. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  160. #==============================================================================
  161. # ■ Game_Map
  162. #==============================================================================

  163. class Game_Map
  164.   #--------------------------------------------------------------------------
  165.   # ○ ミニマップを表示するか
  166.   #--------------------------------------------------------------------------
  167.   def minimap_show?
  168.     return $data_mapinfos[map_id].minimap_show?
  169.   end
  170. end

  171. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  172. #==============================================================================
  173. # ■ Game_Event
  174. #==============================================================================

  175. class Game_Event < Game_Character
  176.   #--------------------------------------------------------------------------
  177.   # ○ グラフィックがあるか
  178.   #--------------------------------------------------------------------------
  179.   def graphic_exist?
  180.     return (character_name != "" || tile_id > 0)
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ○ 障害物か
  184.   #--------------------------------------------------------------------------
  185.   def is_minimap_wall_event?
  186.     return (@event.name =~ KGC::MiniMap::Regexp::WALL_EVENT)
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ○ 移動イベントか
  190.   #--------------------------------------------------------------------------
  191.   def is_minimap_move_event?
  192.     return (@event.name =~ KGC::MiniMap::Regexp::MOVE_EVENT)
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ○ ミニマップオブジェクトか
  196.   #--------------------------------------------------------------------------
  197.   def is_minimap_object?
  198.     return (@event.name =~ KGC::MiniMap::Regexp::OBJECT)
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ○ ミニマップオブジェクトタイプ
  202.   #--------------------------------------------------------------------------
  203.   def minimap_object_type
  204.     if @event.name =~ KGC::MiniMap::Regexp::OBJECT
  205.       return $1.to_i
  206.     else
  207.       return 0
  208.     end
  209.   end
  210. end

  211. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  212. #==============================================================================
  213. # □ Game_MiniMap
  214. #------------------------------------------------------------------------------
  215. #   ミニマップを扱うクラスです。
  216. #==============================================================================

  217. class Game_MiniMap
  218.   #--------------------------------------------------------------------------
  219.   # ○ 構造体
  220.   #--------------------------------------------------------------------------
  221.   Point = Struct.new(:x, :y)
  222.   Size  = Struct.new(:width, :height)
  223.   PassageCache = Struct.new(:map_id, :table, :scan_table)
  224.   #--------------------------------------------------------------------------
  225.   # ○ クラス変数
  226.   #--------------------------------------------------------------------------
  227.   @@passage_cache = []  # 通行フラグテーブルキャッシュ
  228.   #--------------------------------------------------------------------------
  229.   # ● オブジェクト初期化
  230.   #--------------------------------------------------------------------------
  231.   def initialize(tilemap)
  232.     @map_rect  = KGC::MiniMap::MAP_RECT
  233.     @grid_size = [KGC::MiniMap::GRID_SIZE, 1].max

  234.     @x = 0
  235.     @y = 0
  236.     @grid_num = Point.new(
  237.       (@map_rect.width  + @grid_size - 1) / @grid_size,
  238.       (@map_rect.height + @grid_size - 1) / @grid_size
  239.     )
  240.     @draw_grid_num    = Point.new(@grid_num.x + 2, @grid_num.y + 2)
  241.     @draw_range_begin = Point.new(0, 0)
  242.     @draw_range_end   = Point.new(0, 0)
  243.     @tilemap = tilemap

  244.     @last_x = $game_player.x
  245.     @last_y = $game_player.y

  246.     create_sprites
  247.     refresh
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ○ スプライト作成
  251.   #--------------------------------------------------------------------------
  252.   def create_sprites
  253.     @viewport   = Viewport.new(@map_rect)
  254.     @viewport.z = KGC::MiniMap::MAP_Z

  255.     # ビットマップサイズ計算
  256.     @bmp_size = Size.new(
  257.       (@grid_num.x + 2) * @grid_size,
  258.       (@grid_num.y + 2) * @grid_size
  259.     )
  260.     @buf_bitmap = Bitmap.new(@bmp_size.width, @bmp_size.height)

  261.     # マップ用スプライト作成
  262.     @map_sprite   = Sprite.new(@viewport)
  263.     @map_sprite.x = -@grid_size
  264.     @map_sprite.y = -@grid_size
  265.     @map_sprite.z = 0
  266.     @map_sprite.bitmap = Bitmap.new(@bmp_size.width, @bmp_size.height)

  267.     # オブジェクト用スプライト作成
  268.     @object_sprite   = Sprite_MiniMapIcon.new(@viewport)
  269.     @object_sprite.x = -@grid_size
  270.     @object_sprite.y = -@grid_size
  271.     @object_sprite.z = 1
  272.     @object_sprite.bitmap = Bitmap.new(@bmp_size.width, @bmp_size.height)

  273.     # 現在位置スプライト作成
  274.     @position_sprite   = Sprite_MiniMapIcon.new
  275.     @position_sprite.x = @map_rect.x + @grid_num.x / 2 * @grid_size
  276.     @position_sprite.y = @map_rect.y + @grid_num.y / 2 * @grid_size
  277.     @position_sprite.z = @viewport.z + 2
  278.     bitmap = Bitmap.new(@grid_size, @grid_size)
  279.     bitmap.fill_rect(bitmap.rect, KGC::MiniMap::POSITION_COLOR)
  280.     @position_sprite.bitmap = bitmap
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 解放
  284.   #--------------------------------------------------------------------------
  285.   def dispose
  286.     @buf_bitmap.dispose
  287.     @map_sprite.bitmap.dispose
  288.     @map_sprite.dispose
  289.     @object_sprite.bitmap.dispose
  290.     @object_sprite.dispose
  291.     @position_sprite.bitmap.dispose
  292.     @position_sprite.dispose
  293.     @viewport.dispose
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ○ 可視状態取得
  297.   #--------------------------------------------------------------------------
  298.   def visible
  299.     return @map_sprite.visible
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ○ 可視状態設定
  303.   #--------------------------------------------------------------------------
  304.   def visible=(value)
  305.     @viewport.visible        = value
  306.     @map_sprite.visible      = value
  307.     @object_sprite.visible   = value
  308.     @position_sprite.visible = value
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ○ リフレッシュ
  312.   #--------------------------------------------------------------------------
  313.   def refresh
  314.     update_draw_range
  315.     update_passage_table
  316.     update_object_list
  317.     update_position
  318.     draw_map
  319.     draw_object
  320.     Graphics.frame_reset
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ○ 描画範囲更新
  324.   #--------------------------------------------------------------------------
  325.   def update_draw_range
  326.     range = []
  327.     (2).times { |i| range[i] = @draw_grid_num[i] / 2 }

  328.     @draw_range_begin.x = $game_player.x - range[0]
  329.     @draw_range_begin.y = $game_player.y - range[1]
  330.     @draw_range_end.x   = $game_player.x + range[0]
  331.     @draw_range_end.y   = $game_player.y + range[1]
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ 通行可否テーブル更新
  335.   #--------------------------------------------------------------------------
  336.   def update_passage_table
  337.     cache = get_passage_table_cache
  338.     @passage_table      = cache.table
  339.     @passage_scan_table = cache.scan_table

  340.     update_around_passage
  341.   end
  342.   #--------------------------------------------------------------------------
  343.   # ○ 通行可否テーブルのキャッシュを取得
  344.   #--------------------------------------------------------------------------
  345.   def get_passage_table_cache
  346.     map_id = $game_map.map_id
  347.     cache  = @@passage_cache.find { |c| c.map_id == map_id }
  348.     if cache == nil
  349.       # キャッシュミス
  350.       cache = PassageCache.new(map_id)
  351.       cache.table      = Table.new($game_map.width, $game_map.height)
  352.       cache.scan_table = Table.new(
  353.         ($game_map.width  + @draw_grid_num.x - 1) / @draw_grid_num.x,
  354.         ($game_map.height + @draw_grid_num.y - 1) / @draw_grid_num.y
  355.       )
  356.     end

  357.     # 直近のキャッシュは先頭、古いキャッシュは削除
  358.     @@passage_cache.unshift(cache)
  359.     @@passage_cache.delete_at(KGC::MiniMap::CACHE_NUM)

  360.     return cache
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ○ 通行可否テーブルのキャッシュをクリア
  364.   #--------------------------------------------------------------------------
  365.   def clear_passage_table_cache
  366.     return if @passage_scan_table == nil

  367.     table = @passage_scan_table
  368.     @passage_scan_table = Table.new(table.xsize, table.ysize)
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ○ 通行可否テーブルの探索
  372.   #     x, y : 探索位置
  373.   #--------------------------------------------------------------------------
  374.   def scan_passage(x, y)
  375.     dx = x / @draw_grid_num.x
  376.     dy = y / @draw_grid_num.y

  377.     return if @passage_scan_table[dx, dy] == 1
  378.     return unless dx.between?(0, @passage_scan_table.xsize - 1)
  379.     return unless dy.between?(0, @passage_scan_table.ysize - 1)

  380.     rx = (dx * @draw_grid_num.x)...((dx + 1) * @draw_grid_num.x)
  381.     ry = (dy * @draw_grid_num.y)...((dy + 1) * @draw_grid_num.y)
  382.     mw = $game_map.width  - 1
  383.     mh = $game_map.height - 1
  384.     rx.each { |x|
  385.       next unless x.between?(0, mw)
  386.       ry.each { |y|
  387.         next unless y.between?(0, mh)
  388.         @passage_table[x, y] = ($game_map.passable?(x, y) ? 1 : 0)
  389.       }
  390.     }
  391.     @passage_scan_table[dx, dy] = 1
  392.   end
  393.   #--------------------------------------------------------------------------
  394.   # ○ 周辺の通行可否テーブル更新
  395.   #--------------------------------------------------------------------------
  396.   def update_around_passage
  397.     gx = @draw_grid_num.x
  398.     gy = @draw_grid_num.y
  399.     dx = $game_player.x - gx / 2
  400.     dy = $game_player.y - gy / 2
  401.     scan_passage(dx,      dy)
  402.     scan_passage(dx + gx, dy)
  403.     scan_passage(dx,      dy + gy)
  404.     scan_passage(dx + gx, dy + gy)
  405.   end
  406.   #--------------------------------------------------------------------------
  407.   # ○ オブジェクト一覧更新
  408.   #--------------------------------------------------------------------------
  409.   def update_object_list
  410.     events = $game_map.events.values

  411.     # WALL
  412.     @wall_events = events.find_all { |e|
  413.       e.graphic_exist? && e.is_minimap_wall_event?
  414.     }

  415.     # MOVE
  416.     @move_events = events.find_all { |e|
  417.       e.graphic_exist? && e.is_minimap_move_event?
  418.     }

  419.     # OBJ
  420.     @object_list = []
  421.     events.each { |e|
  422.       next unless e.graphic_exist?
  423.       next unless e.is_minimap_object?

  424.       type = e.minimap_object_type
  425.       if @object_list[type] == nil
  426.         @object_list[type] = []
  427.       end
  428.       @object_list[type] << e
  429.     }
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ○ 位置更新
  433.   #--------------------------------------------------------------------------
  434.   def update_position
  435.     pt = Point.new($game_player.x, $game_player.y)
  436.     dx = ($game_player.real_x - pt.x * 256) * @grid_size / 256
  437.     dy = ($game_player.real_y - pt.y * 256) * @grid_size / 256
  438.     ox = dx % @grid_size
  439.     oy = dy % @grid_size
  440.     ox = -(@grid_size - ox) if dx < 0
  441.     oy = -(@grid_size - oy) if dy < 0
  442.     @viewport.ox = ox
  443.     @viewport.oy = oy
  444.     if pt.x != @last_x || pt.y != @last_y
  445.       draw_map
  446.       @last_x = pt.x
  447.       @last_y = pt.y
  448.     end
  449.   end
  450.   #--------------------------------------------------------------------------
  451.   # ○ 描画範囲内判定
  452.   #--------------------------------------------------------------------------
  453.   def in_draw_range?(x, y)
  454.     rb = @draw_range_begin
  455.     re = @draw_range_end
  456.     return (x.between?(rb.x, re.x) && y.between?(rb.y, re.y))
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ○ マップ範囲内判定
  460.   #--------------------------------------------------------------------------
  461.   def in_map_range?(x, y)
  462.     mw = $game_map.width
  463.     mh = $game_map.height
  464.     return (x.between?(0, mw - 1) && y.between?(0, mh - 1))
  465.   end
  466.   #--------------------------------------------------------------------------
  467.   # ○ マップ描画
  468.   #     dir : 追加位置 (0 で全体)
  469.   #--------------------------------------------------------------------------
  470.   def draw_map(dir = 0)
  471.     bitmap  = @map_sprite.bitmap
  472.     bitmap.fill_rect(bitmap.rect, KGC::MiniMap::BACKGROUND_COLOR)

  473.     rect = Rect.new(0, 0, @grid_size, @grid_size)

  474.     range_x = (@draw_range_begin.x)..(@draw_range_end.x)
  475.     range_y = (@draw_range_begin.y)..(@draw_range_end.y)
  476.     mw = $game_map.width  - 1
  477.     mh = $game_map.height - 1
  478.     update_around_passage

  479.     # 通行可能領域描画
  480.     range_x.each { |x|
  481.       next unless x.between?(0, mw)
  482.       range_y.each { |y|
  483.         next unless y.between?(0, mh)
  484.         next if @passage_table[x, y] == 0
  485.         next if @wall_events.find { |e| e.x == x && e.y == y }  # 壁

  486.         rect.x = (x - @draw_range_begin.x) * @grid_size
  487.         rect.y = (y - @draw_range_begin.y) * @grid_size
  488.         bitmap.fill_rect(rect, KGC::MiniMap::FOREGROUND_COLOR)
  489.       }
  490.     }

  491.     # MOVE
  492.     @move_events.each { |e|
  493.       rect.x = (e.x - @draw_range_begin.x) * @grid_size
  494.       rect.y = (e.y - @draw_range_begin.y) * @grid_size
  495.       bitmap.fill_rect(rect, KGC::MiniMap::MOVE_EVENT_COLOR)
  496.     }
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ○ オブジェクト描画
  500.   #--------------------------------------------------------------------------
  501.   def draw_object
  502.     # 下準備
  503.     bitmap = @object_sprite.bitmap
  504.     bitmap.clear
  505.     rect = Rect.new(0, 0, @grid_size, @grid_size)

  506.     # オブジェクト描画
  507.     @object_list.each_with_index { |list, i|
  508.       color = KGC::MiniMap::OBJECT_COLOR[i - 1]
  509.       next if list.nil? || color.nil?

  510.       list.each { |obj|
  511.         next unless in_draw_range?(obj.x, obj.y)

  512.         rect.x = (obj.real_x - @draw_range_begin.x * 256) * @grid_size / 256
  513.         rect.y = (obj.real_y - @draw_range_begin.y * 256) * @grid_size / 256
  514.         bitmap.fill_rect(rect, color)
  515.       }
  516.     }
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # ○ 更新
  520.   #--------------------------------------------------------------------------
  521.   def update
  522.     return unless @map_sprite.visible

  523.     update_draw_range
  524.     update_position
  525.     draw_object
  526.     @map_sprite.update
  527.     @object_sprite.update
  528.     @position_sprite.update
  529.   end
  530. end

  531. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  532. #==============================================================================
  533. # □ Sprite_MiniMapIcon
  534. #------------------------------------------------------------------------------
  535. #   ミニマップ用アイコンのクラスです。
  536. #==============================================================================

  537. class Sprite_MiniMapIcon < Sprite
  538.   DURATION_MAX = 60
  539.   #--------------------------------------------------------------------------
  540.   # ● オブジェクト初期化
  541.   #     viewport : ビューポート
  542.   #--------------------------------------------------------------------------
  543.   def initialize(viewport = nil)
  544.     super(viewport)
  545.     @duration = DURATION_MAX / 2
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● フレーム更新
  549.   #--------------------------------------------------------------------------
  550.   def update
  551.     super
  552.     @duration += 1
  553.     if @duration == DURATION_MAX
  554.       @duration = 0
  555.     end
  556.     update_effect
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # ○ エフェクトの更新
  560.   #--------------------------------------------------------------------------
  561.   def update_effect
  562.     self.color.set(255, 255, 255,
  563.       (@duration - DURATION_MAX / 2).abs * KGC::MiniMap::BLINK_LEVEL
  564.     )
  565.   end
  566. end

  567. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  568. #==============================================================================
  569. # ■ Spriteset_Map
  570. #==============================================================================

  571. class Spriteset_Map
  572.   attr_reader :minimap
  573.   #--------------------------------------------------------------------------
  574.   # ● オブジェクト初期化
  575.   #--------------------------------------------------------------------------
  576.   alias initialize_KGC_MiniMap initialize
  577.   def initialize
  578.     initialize_KGC_MiniMap

  579.     create_minimap
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ○ ミニマップ作成
  583.   #--------------------------------------------------------------------------
  584.   def create_minimap
  585.     return unless $game_map.minimap_show?

  586.     @minimap = Game_MiniMap.new(@tilemap)
  587.     @minimap.visible = $game_system.minimap_show
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● 解放
  591.   #--------------------------------------------------------------------------
  592.   alias dispose_KGC_MiniMap dispose
  593.   def dispose
  594.     dispose_KGC_MiniMap

  595.     dispose_minimap
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ○ ミニマップ解放
  599.   #--------------------------------------------------------------------------
  600.   def dispose_minimap
  601.     @minimap.dispose unless @minimap.nil?
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● フレーム更新
  605.   #--------------------------------------------------------------------------
  606.   alias update_KGC_MiniMap update
  607.   def update
  608.     update_KGC_MiniMap

  609.     update_minimap
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ○ ミニマップ更新
  613.   #--------------------------------------------------------------------------
  614.   def update_minimap
  615.     return if @minimap.nil?

  616.     if $game_system.minimap_show
  617.       @minimap.visible = true
  618.       @minimap.update
  619.     else
  620.       @minimap.visible = false
  621.     end
  622.   end
  623.   #--------------------------------------------------------------------------
  624.   # ○ ミニマップ全体をリフレッシュ
  625.   #--------------------------------------------------------------------------
  626.   def refresh_minimap
  627.     return if @minimap.nil?

  628.     @minimap.clear_passage_table_cache
  629.     @minimap.refresh
  630.   end
  631.   #--------------------------------------------------------------------------
  632.   # ○ ミニマップのオブジェクトを更新
  633.   #--------------------------------------------------------------------------
  634.   def update_minimap_object
  635.     @minimap.update_object_list unless @minimap.nil?
  636.   end
  637. end

  638. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  639. #==============================================================================
  640. # ■ Scene_Map
  641. #==============================================================================

  642. class Scene_Map
  643.   #--------------------------------------------------------------------------
  644.   # ○ ミニマップ全体をリフレッシュ
  645.   #--------------------------------------------------------------------------
  646.   def refresh_minimap
  647.     @spriteset.refresh_minimap
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ○ ミニマップのオブジェクトを更新
  651.   #--------------------------------------------------------------------------
  652.   def update_minimap_object
  653.     @spriteset.update_minimap_object
  654.   end
  655. end
复制代码


这问题有点不明不白... 新手,求大神能指出QAQ

是不是跟哪个类重定义冲突?
QQ截图20140417221258.jpg
梦石
0
星屑
50
在线时间
31 小时
注册时间
2013-10-19
回帖
9
 楼主| 发表于 2014-4-17 22:28:50 | 显示全部楼层
本身脚本没问题,加入了XAS系统之后就报错了....
回复

使用道具 举报

梦石
0
星屑
50
在线时间
31 小时
注册时间
2013-10-19
回帖
9
 楼主| 发表于 2014-4-20 11:15:19 | 显示全部楼层
没人 知道吗。。。。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部