질문과 답변

Extra Form

 

 미니맵 스크립트입니다.

 

#===============================================================
# ● [VX] ◦ MiniMap ◦ □
# * Plug N Play Minimap (Don't need image~) *
#--------------------------------------------------------------
# ◦ by Woratana [woratana@hotmail.com]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 09/06/2008
# ◦ Version: 1.0
#--------------------------------------------------------------
# ◦ Credit: KGC for XP MiniMap Script,
# this script can't be done without his MiniMap.
#--------------------------------------------------------------

module MiniMap
  #===========================================================================
  # [START] MINIMAP SCRIPT SETUP PART
  #---------------------------------------------------------------------------
  SWITCH_NO_MINIMAP = 14 # Turn ON this switch to NOT SHOW minimap
   
  MAP_RECT = [410, 20, 100, 100] # Minimap size and position
  # [X, Y, Width, Height]
  # You can change it in game, by call script:
  # $game_system.minimap = [X, Y, Width, Height]

  MAP_Z = 0 # Minimap's Z-coordinate
  # Increase this number if there is problem that minimap show below some objects.

  GRID_SIZE = 5 # Minimap's grid size. Recommend to use more than 3.
 
  MINIMAP_BORDER_COLOR = Color.new(0, 0, 255, 160) # Minimap's border color
  # Color.new(Red, Green, Blue, Opacity)
  MINIMAP_BORDER_SIZE = 2 # Minimap's border size
 
  FOREGROUND_COLOR = Color.new(224, 224, 255, 160) # Passable tile color
  BACKGROUND_COLOR = Color.new(0, 0, 0, 160) # Unpassable tile color

  USE_OUTLINE_PLAYER = true # Draw outline around player in minimap?
  PLAYER_OUTLINE_COLOR = Color.new(0, 0, 0, 192) # Player Outline color
  USE_OUTLINE_EVENT = true # Draw outline around events in minimap?
  EVENT_OUTLINE_COLOR = Color.new(255, 255, 255, 192) # Player Outline color
 
  PLAYER_COLOR = Color.new(255, 0, 0, 192) # Player color
  #---------------------------------------------------------------------------

  OBJECT_COLOR = {} # Don't change or delete this line!
  #===============================================================
  # * SETUP EVENT KEYWORD & COLOR
  #---------------------------------------------------------------
  # ** Template:
  # OBJECT_COLOR['keyword'] = Color.new(Red, Green, Blue, Opacity)
  #-------------------------------------------------------------
  # * 'keyword': Word you want to put in event's comment to show this color
  # ** Note: 'keyword' is CASE SENSITIVE!
  # * Color.new(...): Color you want
  # You can put between 0 - 255 in each argument (Red, Green, Blue, Opacity)
  #-------------------------------------------------------------
  OBJECT_COLOR['npc'] = Color.new(30,144,255,160)
  OBJECT_COLOR['treasure'] = Color.new(0,255,255,160)
  OBJECT_COLOR['enemy'] = Color.new(139,35,35,160)
  OBJECT_COLOR['merchant'] = Color.new(255,255,0,160)
 
  #===========================================================================
  # * [OPTIONAL] TAGS:
  #---------------------------------------------------------------------------
  # Change keyword for disable minimap & keyword for show event on minimap~
  #-----------------------------------------------------------------------
  TAG_NO_MINIMAP = '[NOMAP]' # Tag for disable minimap
  TAG_EVENT = 'MMEV' # Tag for show event on minimap
  #---------------------------------------------------------------------------

  #---------------------------------------------------------------------------
  # [END] MINIMAP SCRIPT SETUP PART
  #===========================================================================
 
  def self.refresh
    if $scene.is_a?(Scene_Map)
      $scene.spriteset.minimap.refresh
    end
  end
 
  def self.update_object
    if $scene.is_a?(Scene_Map)
      $scene.spriteset.minimap.update_object_list
    end
  end
end

#==============================================================================
# ■ RPG::MapInfo
#==============================================================================
class RPG::MapInfo
  def name
    return @name.gsub(/[.*]/) { }
  end

  def original_name
    return @name
  end

  def show_minimap?
    return !@name.include?(MiniMap::TAG_NO_MINIMAP)
  end
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
  attr_accessor :minimap
  alias wora_minimap_gamsys_ini initialize
 
  def initialize
    wora_minimap_gamsys_ini
    @minimap = MiniMap::MAP_RECT
  end
 
  def show_minimap
    return !$game_switches[MiniMap::SWITCH_NO_MINIMAP]
  end
end
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
  alias wora_minimap_gammap_setup setup
  def setup(map_id)
    wora_minimap_gammap_setup(map_id)
    @db_info = load_data('Data/MapInfos.rvdata') if @db_info.nil?
    @map_info = @db_info[map_id]
  end
 
  def show_minimap?
    return @map_info.show_minimap?
  end
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
  def mm_comment?(comment, return_comment = false )
    if !@list.nil?
      for i in 0...@list.size - 1
        next if @list[i].code != 108
        if @list[i].parameters[0].include?(comment)
          return @list[i].parameters[0] if return_comment
          return true
        end
      end
    end
    return '' if return_comment
    return false
  end
end
#==============================================================================
# ■ Game_MiniMap
#------------------------------------------------------------------------------
class Game_MiniMap
  def initialize(tilemap)
    @tilemap = tilemap
    refresh
  end

  def dispose
    @border.bitmap.dispose
    @border.dispose
    @map_sprite.bitmap.dispose
    @map_sprite.dispose
    @object_sprite.bitmap.dispose
    @object_sprite.dispose
    @position_sprite.bitmap.dispose
    @position_sprite.dispose
  end

  def visible
    return @map_sprite.visible
  end

  def visible=(value)
    @map_sprite.visible = value
    @object_sprite.visible = value
    @position_sprite.visible = value
    @border.visible = value
  end

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

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

    @border = Sprite.new
    @border.x = map_rect.x - MiniMap::MINIMAP_BORDER_SIZE
    @border.y = map_rect.y - MiniMap::MINIMAP_BORDER_SIZE
    b_width = map_rect.width + (MiniMap::MINIMAP_BORDER_SIZE * 2)
    b_height = map_rect.height + (MiniMap::MINIMAP_BORDER_SIZE * 2)
    @border.bitmap = Bitmap.new(b_width, b_height)
    @border.bitmap.fill_rect(@border.bitmap.rect, MiniMap::MINIMAP_BORDER_COLOR)
    @border.bitmap.clear_rect(MiniMap::MINIMAP_BORDER_SIZE, MiniMap::MINIMAP_BORDER_SIZE,
    @border.bitmap.width - (MiniMap::MINIMAP_BORDER_SIZE * 2),
    @border.bitmap.height - (MiniMap::MINIMAP_BORDER_SIZE * 2))
   
    @map_sprite = Sprite.new
    @map_sprite.x = map_rect.x
    @map_sprite.y = map_rect.y
    @map_sprite.z = MiniMap::MAP_Z
    bitmap_width = $game_map.width * grid_size + map_rect.width
    bitmap_height = $game_map.height * grid_size + map_rect.height
    @map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
    @map_sprite.src_rect = map_rect

    @object_sprite = Sprite.new
    @object_sprite.x = map_rect.x
    @object_sprite.y = map_rect.y
    @object_sprite.z = MiniMap::MAP_Z + 1
    @object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
    @object_sprite.src_rect = map_rect

    @position_sprite = Sprite_Base.new
    @position_sprite.x = map_rect.x + @size[0] / 2 * grid_size
    @position_sprite.y = map_rect.y + @size[1] / 2 * grid_size
    @position_sprite.z = MiniMap::MAP_Z + 2
   
    bitmap = Bitmap.new(grid_size, grid_size)
    # Player's Outline
    if MiniMap::USE_OUTLINE_PLAYER and MiniMap::GRID_SIZE >= 3
      bitmap.fill_rect(bitmap.rect, MiniMap::PLAYER_OUTLINE_COLOR)
      brect = Rect.new(bitmap.rect.x + 1, bitmap.rect.y + 1, bitmap.rect.width - 2,
        bitmap.rect.height - 2)
      bitmap.clear_rect(brect)
    else
      brect = bitmap.rect
    end
   
    bitmap.fill_rect(brect, MiniMap::PLAYER_COLOR)
    @position_sprite.bitmap = bitmap

    draw_map
    update_object_list
    draw_object
    update_position
  end

  def draw_map
    bitmap = @map_sprite.bitmap
    bitmap.fill_rect(bitmap.rect, MiniMap::BACKGROUND_COLOR)
    map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
    grid_size = [MiniMap::GRID_SIZE, 1].max
   
    $game_map.width.times do |i|
      $game_map.height.times do |j|
        if !$game_map.passable?(i, j)
          next
        end
        rect = Rect.new(map_rect.width / 2 + grid_size * i,
          map_rect.height / 2 + grid_size * j,
          grid_size, grid_size)
        if grid_size >= 3
          if !$game_map.passable?(i, j)
            rect.height -= 1
            rect.x += 1
            rect.width -= 1
            rect.width -= 1
            rect.y += 1
            rect.height -= 1
          end
        end
        bitmap.fill_rect(rect, MiniMap::FOREGROUND_COLOR)
      end
    end
  end

  def update_object_list
    @object_list = {}
    $game_map.events.values.each do |e|
      comment = e.mm_comment?(MiniMap::TAG_EVENT, true)
      if comment != ''
        type = comment.gsub(/#{MiniMap::TAG_EVENT}/){}.gsub(/s+/){}
        @object_list[type] = [] if @object_list[type].nil?
        @object_list[type] << e
      end
    end
  end

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

    @object_list.each do |key, events|
      color = MiniMap::OBJECT_COLOR[key]
      next if events.nil? or color.nil?
      events.each do |obj|
        if !obj.character_name.empty?
          rect.x = mw + obj.real_x * grid_size / 256
          rect.y = mh + obj.real_y * grid_size / 256
          # Event's Outline
          if MiniMap::USE_OUTLINE_EVENT and MiniMap::GRID_SIZE >= 3
            bitmap.fill_rect(rect, MiniMap::EVENT_OUTLINE_COLOR)
            brect = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2,
            rect.height - 2)
            bitmap.clear_rect(brect)
          else
            brect = bitmap.rect
          end
          bitmap.fill_rect(brect, color)
        end
      end
    end
  end

  def update
    if @mmr != $game_system.minimap
      dispose
      refresh
    end
    draw_object
    update_position
    if @map_sprite.visible
      @map_sprite.update
      @object_sprite.update
      @position_sprite.update
    end
  end

  def update_position
    map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
    grid_size = [MiniMap::GRID_SIZE, 1].max
    sx = $game_player.real_x * grid_size / 256
    sy = $game_player.real_y * grid_size / 256
    @map_sprite.src_rect.x = sx
    @map_sprite.src_rect.y = sy
    @object_sprite.src_rect.x = sx
    @object_sprite.src_rect.y = sy
  end
end
#==============================================================================
# ■ Spriteset_Map
#------------------------------------------------------------------------------
class Spriteset_Map
  attr_reader :minimap
  alias wora_minimap_sprsetmap_ini initialize
  alias wora_minimap_sprsetmap_dis dispose
  alias wora_minimap_sprsetmap_upd update
 
  def initialize
    wora_minimap_sprsetmap_ini
    if $game_map.show_minimap?
      @minimap = Game_MiniMap.new(@tilemap)
      $game_system.show_minimap = true if $game_system.show_minimap.nil?
      @minimap.visible = $game_system.show_minimap
    end
  end
 
  def dispose
    @minimap.dispose if !@minimap.nil?
    wora_minimap_sprsetmap_dis
  end

  def update
    if !@minimap.nil?
      if $game_system.show_minimap
        @minimap.visible = true
        @minimap.update
      else
        @minimap.visible = false
      end
    end
    wora_minimap_sprsetmap_upd
  end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
  attr_reader :spriteset
end

 

 

이런 스크립트를 사용하는데요. 

MMEV enemy     

위와같은 글을 주석으로 적으면 미니맵에 그 이벤트가 빨간색으로 표시가 됩니다.

하지만...이곳에..이벤트 그림을 맵 그림으로 하거나 스위치를 설정해주면 이벤트가 보이는데도 불구하고

미니맵에는 표시가 되지 않는군요.....해결해주세요~


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12390
기본툴 사용법 RMMV 텍스트 이벤트에 적의 이름을 띄우는 치환문자도 있나요? 5 PPPL 2020.04.13 83
기본툴 사용법 RMVXA 도망치기의 확률이 정확히 어떻게 되나요? 겜만들고싶다앙 2021.03.17 83
이벤트 작성 RMVX 이벤트작성-스크립트(or 조건분기-스크립트)로 현재 어느맵에있는지 체크하는방법 3 ji01345 2019.11.05 83
스크립트 사용 RMVXA RPG VX Ace 웹사이트 하이퍼링크 김치찌개두루치기 2020.08.05 83
이벤트 작성 RMMV 대화 도중 대화창을 숨기는 기능이 있을까요? 1 벨로님 2023.04.05 82
제작툴 구매 툴선택 안녕하십니까 스팀 할인 하길래 입문이 해보고 싶어서 툴질문 있습니다! 1 벨로님 2023.03.30 82
스크립트 작성 RMMV 아이템창 항목 제거 방법 요호 2023.01.08 82
스크립트 작성 RMMV confirm과 prompt의 ui? 디자인? 을 바꾸는 방법을 알고 싶어요 spsp 2021.12.20 82
맵배치 RMXP XP에서 맵을 만들고 그 맵을 이미지로 출력 저장하는 방법이 있을까요? 2 카르와푸딩의아틀리에 2021.03.26 82
기타 RMVXA 게임 시작 시 윈도우즈 사용자 이름 자동 인식 2 양푼비빔밥 2020.04.02 82
기타 RMVXA 쯔꾸르 게임 실행후 캐릭터가 자동으로 이동하고 컨트롤이 되지않습니다. 귀여미드사미 2019.09.23 82
이벤트 작성 RMMV 또..질문이여..ㅠㅠ 5개의 재료가 있어야 1개의 템이 만들어지게 하고싶습니다. 2 file 쿠우쿠우0 2019.07.23 82
이벤트 작성 RMMV 타이머 이벤트 시 키가 안먹힘 2 file 매지션k 2019.02.09 82
RMMV 1번 액터가 누구냐에 따라 이벤트 내용 다르게 하기 4 낙요 2018.12.21 82
RMVXA 게임내에서 SE 파일이 0.5초 정도 늦게 재생되네요 3 체다렐라모짜치즈 2018.08.06 82
이벤트 작성 RMMV 이미지 범위내 선택시 이벤트 발생 8 file 율무보리삼김 2021.09.05 82
RMXP 플레이어 초기위치설정에서 캐릭터 방향이 아래로 되어있는 설정은 변경이 불가능 한가요? 배움을원하는자 2018.08.16 82
플러그인 사용 RMMV MovieInScreen플러그인 사용하는데 스크린무비후 안움직여져요 file 메리양 2021.10.04 82
RMXP 게임 실행 자체가 안되는데.. 아스가방 2017.10.13 82
액션 전투 RMVX 액알 중 아이템 사용. 제리루비 2021.07.20 82
Board Pagination Prev 1 ... 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 ... 516 Next
/ 516