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
417 전투 불사신(무적) 스크립트 9 file 미얼 2009.10.29 3198
416 이동 및 탈것 부드럽게 이동, 8 방향이동 스크립트 25 file 사람이라면? 2010.08.16 3795
415 상점 보관함 스크립트 43 file 허걱 2009.02.02 5161
414 HUD 변수 표시 HUD 8 Tofuman 2009.02.15 2469
413 베틀 스크린 톤 체인지?? 무슨 말? 4 Man... 2008.10.28 1616
412 기타 범용 게이지 묘화 - KGC 14 file 카르와푸딩의아틀리에 2009.08.19 3476
411 배틀할때 몬스터의 HP표시 !! 5 file 미카엘 2008.08.17 7517
410 기타 배틀신에서 곡 넘기기 2 rukan 2009.07.02 1757
409 전투 방패가없어? 그럼 방어못하게하는 스크립트. 16 file 할렘 2009.02.07 3425
408 전투 방어를 했을경우 hp / mp 회복 되도록 하는 스크립트 15 아방스 2008.01.22 3746
407 장비 방어구 착용시 최대HP, MP증가 스크립트(턴알) 3 file 기관차 2014.11.06 1222
406 기타 밤낮의 변화에 따른 전투배경의 변화 스크립트 10 file 카르와푸딩의아틀리에 2009.07.01 2948
405 그래픽 밤낮 변환 스크립트 18 kram3 2008.01.31 3762
404 그래픽 밤낮 변환 VX용 26 독도2005 2008.03.23 4314
403 스킬 발상의전환 : 스킬과 아이템의 공격횟수를 동시에 증가시키기 14 star211 2010.02.16 3179
402 전투 반사 스테이트 -KGC 4 카르와푸딩의아틀리에 2009.09.12 2661
401 스킬 미완성 구버전. 2칸 위에 있는 글을 이용해주세요. 7 Last H 2009.02.23 1925
» 미니맵 미니맵 스크립트(아랫거랑 다른거) 75 file 츠키아 2008.08.08 6145
399 미니맵 미니맵 띠우는 스크립트 ^^ 37 file 아방스 2008.06.02 7247
398 기타 미니게임테트리스 스크립트 ㅋㅋㅋ 27 file 카르와푸딩의아틀리에 2009.06.30 3689
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... 32 Next
/ 32