질문과 답변

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 Beta
#--------------------------------------------------------------
# ◦ 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 = 10 # 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(0, 255, 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['상점'] = Color.new(0,255,255,160)
  OBJECT_COLOR['몬스터'] = Color.new(139,35,35,160)
  OBJECT_COLOR['이동'] = Color.new(255,255,0,160)
  OBJECT_COLOR['몬스터-보스급'] = Color.new(255,0,0,192)
 
  #===========================================================================
  # * [OPTIONAL] TAGS:
  #---------------------------------------------------------------------------
  # Change keyword for disable minimap & keyword for show event on minimap~
  #-----------------------------------------------------------------------
  TAG_NO_MINIMAP = '[NOMAP]'
  TAG_EVENT = 'MMEV'
  #---------------------------------------------------------------------------

  #---------------------------------------------------------------------------
  # [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

 

 

스크립트 자료실에 있는 미니맵인데요

 

미니맵 표시에 장소이동을 표시하려고 하는데요

 

그래픽이 있어야만 표시가 되네요

 

그래픽이 있으면 장소이동이 몬가 부자연스럽게 되서요

 

그래픽 없이도 표시되는 방법이 있을까요

Comment '2'
  • ?
    아옹쿸 2011.07.01 12:52

    스크립트 초보라 실질적인 도움은 드릴수없지만,  아마도 미니맵을 읽을때 이동가와 불가로 읽는거 같은데,

    만약 스크립트쪽을 잘 건드릴 자신이 있으시면 이런 방법이 괜찮을까해서요

     

    1. 만약에 맵상에 이벤트가 있는 곳을 읽을수 있는 변수가 있다면, 그변수를 읽되,

    2. 보통 이벤트가 장소이동말고 다른 이벤트도 많으니 (대화이벤트나 뭐 잡다한 다른 이벤트요)

    3. 장소이동 이벤트를 만들어 두신데다가 스크립트를 직접 입력을 추가합니다 (예를들면 미니맵 스크립트에 어떤 변수를 선언해서

    ex) Turn_Minimap_Event=true

    4. 그리고 미니맵 스크립트상에 위의 변수가 true가 되어있을시 이벤트가 있는 곳에 무슨 표시를 넣으면 될거 같네요 ''

     

    방법론적인건 이렇게하면되는데, 위에말씀드렸듯이 스크립트는 초짜라;; 다른 고수분들이 해결방안을 만들어주실듯해요 !!

  • ?
    아옹쿸 2011.07.01 12:55

    그리고 또한 미니맵 자체도 맵상에 하나의 그림을 읽어오는거라, 새로운 그림을 추가해서 위치상에 대입시키는것도 될거같아요

    아마 명령어가 Rect.new였나 ㅠㅠ 가물가물하네요


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12392
한글 패치 RMXP rpg xp 한글패치 후 글자가 나오질 않습니다 1 file 핫핑세일 2019.12.04 279
한글 패치 RMVXA RPG VX ACE 한글 패치 3 채토 2019.02.12 798
한글 패치 RM2k 스팀 알만툴 2k는 한글패치가 없나여? 2 태연천사 2019.04.01 317
한글 패치 RMVXA Translator++ invalid multibyte char (utf-8) 오류 (영어겜임) file 진영삼 2019.05.02 428
한글 패치 RMVXA VX Ace툴 스팀 버전 한글패치는 없는 건가요? 자유와바람 2019.11.07 316
한글 패치 RMVXA 지원하지 않는 조작 1 청빛날개 2020.02.04 94
한글 패치 RMXP 스팀 알만툴XP 한글패치 관련 질문입니다 으으으으으으 2020.02.25 339
한글 패치 기타 SRC나 DNML 유저팬픽시나리오MOD제작툴 한글화 하시는분은 없나요? 1 모드좋아 2020.02.27 212
한글 패치 RMVXA RPG MAKER VX ACE 한글패치 관련 문의드립니다ㅠ 2 쇠창살 2020.03.02 456
한글 패치 RMVX vx 한글패치 어떻게 해야 하나요 ㅠㅠㅠ 2 얄라셩 2020.06.05 279
한글 패치 RMXP RPG XP 스팀 한글패치 최신 버전은 없나요? 1 일리브 2020.11.14 658
한글 패치 RM2k3 2003 게임의 글자가 특수문자로 출력됩니다. 1 file 우주신유니콘 2021.03.20 296
한글 패치 RMVXA RPG Maker VX Ace 한글 출력? 1 ikmyung 2021.05.17 302
한글 패치 기타 알만툴 2k 스팀판은 한글패치가 없나요? 김기차 2023.08.28 48
한글 패치 RM2k RM2k의 스팀 한글패치 다크크리에이터 2024.01.27 22
플러그인 추천 RMMV MV 인벤토리 변경하는 플러그인이 있을까요? 2 머리큰두두 2023.09.19 57
플러그인 추천 RMMV 지도의 특정 좌표를 한번에 찾아가는 플러그인은 없을까요? 7 겐마 2020.08.22 123
플러그인 추천 RMMV npc 이동 1 코기 2020.02.09 89
플러그인 추천 RMMV MV에서 대각선이동이 가능한가요? (8방향이동) 6 믕믱이 2020.03.12 770
플러그인 추천 RMMV 이런 플러그인인데 혹시 알고있는 사람 있습니까??? 2 file 호구랑 2019.03.02 240
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 82 Next
/ 82