VX 스크립트

예제가 있으니 한번 봐주시는게 좋을 듯 하네요.

#===============================================================
# ● [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 = 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(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
Comment '75'
  • ?
    볼매붕어 2009.11.30 21:27

    잘쓸게요 !

  • ?
    오리엔탈 2009.12.02 17:42

    감사합니다~

  • ?
    페르난 2009.12.08 19:31

    우왕 ㅋ굳 ㅋ

  • ?
    내로미 2009.12.13 03:30

     아~ 이거~

    저도 이거있어요.

    하지만 주석을 잘몰랐는데.

    내가 그때 잘살펴보지못해서그런가?

    어거덕분에 주석알아가네요ㅎㅎㅎ

  • ?
    sooyeong7 2010.01.03 11:12

    감사합니다. ㅎㅎ

  • ?
    언제나웃음 2010.01.03 12:00

    저 스크립트 붙여넣기만하면 알아서 되는건가요?

    해보니까 붙여넣기만해도 알아서 미니맵이 생산되내요 정말 좋은 프로그램이내요

    감사히 잘쓰겠습니다

  • profile
    star211 2010.01.26 11:37

    잘쓰겠습니다

    다른건 그림 띄우고 별짓을 다해야하는데 이건 붙여넣기만 해도 미니맵이 생성되네요

  • ?
    낙서 2010.01.30 17:53

  • ?
    누구 똥? 2010.02.05 20:51

    장소이동 할때 132번이 오류가 납니다..

        return @map_info.show_minimap?  이 부분에서요!

    어떻게 안되나요?

  • ?
    중딩 아방스 2010.02.10 11:56

    좋쿤요

  • ?
    성현 2010.02.21 18:35

    와우..

  • ?
    forest 2010.02.21 23:26

    감사.. 이 정보 찾아 삼만리 ㅎㅎ 감사합니다.

  • ?
    뉴아시엘 Siel 로랑 2010.02.22 11:28

    잘 쓸께요!!!

  • ?
    whalsrl2008 2010.02.27 11:56

    어디다가 붙이는 거죠?

  • ?
    서울냥이 2010.03.14 14:56

    감사합니다~

  • ?
    대빵이 2010.03.21 09:23

    감사합니다. 잘쓸게요^^

  • ?
    서울냥이 2010.05.09 14:50

    궁금한게잇는데.. 미니맵에 npc같은것 표시가가능하게 하는게 있던데 그건 어케하죠?? 스크립 잘 살펴보니 이것도 그런게 있는것 같아서요

  • ?
    서울냥이 2010.05.09 14:53

    #===============================================================
      # * 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)

     

    그러니깐.. 쉽게말해서 이부분??

  • ?
    뾰롱뾰롱 2011.02.24 18:08

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



    이부분에서 # Tag for show event on minimap

    이 부분을 지운후, 나타내고 싶은 npc들은 

    주석으로 mmev

    라고 적어줘야 됩니다. 예제 파일을 열어 보면 알수잇습니다.

  • ?
    혈풍혈우 2010.09.04 20:22

    감사히 잘 쓰겠습니다.

  • profile
    라구나 2010.11.20 16:03

    아 나와는 충돌되는군 여튼 감사합니다

  • ?
    뾰롱뾰롱 2011.02.24 18:00

    헐.. 굳굳굳

  • ?
    삼국지 2011.06.09 14:05

  • ?
    시옷청룡 2011.07.29 21:59

    충돌인가... 칩A는 인식이 안되는듯 하네요; 건물이 있으면 창문만 다닐수 없다고 나오니...

  • ?
    Krrrr7 2016.09.10 11:43
    오!!

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
77 액알 스크립트 33 츠키아 2008.08.11 5828
76 체력 게이지바 스크립트 30 아방스 2008.09.01 5829
75 전투 지형에 따른 전투배경화면 표시 스크립트!! 30 file 레오 2008.09.17 5855
74 기타 빛 이펙트 71 file DEVIL<Li Patanis Roni Kraudus> 2008.06.06 5861
73 메뉴 창 크기 변경 스크립트 6 file Incubus 2008.05.25 5945
72 전투 ActBattle 전투 스크립트 13 file 사람이라면? 2010.08.16 5962
71 메시지 대화창효과 8 078656577er 2009.10.20 5972
70 기타 작은 게이지바 표시 스크립트 44 file 허걱 2009.02.05 5979
69 파티 대규모파티 KGC스크립 50 file RPGbooster 2008.10.08 6012
68 전투 포켓몬 스크립트 한글화 완료 26 file 서울냥이 2010.10.11 6030
67 스킬 합성샾 스크립트 ^^ [동영상 포함] 6 file 아방스 2008.09.23 6038
66 기타 캐릭터 소개화면 16 file 좀비사냥꾼 2009.03.29 6044
65 퀘스트 디아블로 스타일 퀘스트 시스템(번역) 38 file 훈덕 2009.02.03 6049
64 몬스터 도감 [수정] 68 file RPGbooster 2008.10.08 6074
63 기타 게임시간&밤낮 54 file 허걱 2009.02.14 6111
62 맵/타일 월드맵 스크립트 49 아방스 2008.09.07 6123
61 풍선대화 메세지시스템 32 file RPGbooster 2008.10.11 6126
60 퀘스트 퀘스트 스크립트 39 file RPGbooster 2008.10.11 6139
59 전투 GTBS 1.0 [스크립트] 24 아방스 2009.02.05 6141
58 타이틀/게임오버 타이틀화면 커스터마이즈 29 file 可わいい 2009.03.16 6141
Board Pagination Prev 1 ... 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Next
/ 32