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'
  • ?
    츠키아 2008.08.08 10:07
    구버전일때는 VX 실행파일을 메모장으로 불러들여
    1.02라고 적혀있는것을 1.01로 바꾸면 되요
    아니면 1.00 이나.
  • ?
    enlwnrqkrwnr 2008.08.08 10:12
    그렇게 해도 안되던데
  • ?
    해적 2008.08.08 10:20

    주석으로 인식하는군요.. 단순하면서도 상당한 효율이네요.

    마을마다 지도만드는 노가다 싫으신분은 이꺼 쓰시면 될듯..

  • ?
    흑기사 2008.08.08 20:04
    주석으로 MMEV npc 는 무엇이고
    MMEV merchant 는 모고
    MMEV enemy 는 모죠?
  • ?
    배군 2008.08.09 16:39
    ㄴ첫번째는 npc표시일꺼같구요
    2번째는 모르겟고
    3번째는 적표시인것같네요.
  • ?
    끄응 2008.08.11 09:29
    오 된다 감사
  • ?
    만들어보자꾸나 2008.08.11 13:12
     이동불가/가능 타일의 구분으로 맵이 표시되는군요..
     괜찮네요..  잘쓰겟습니다^^
  • ?
    츠키아 2008.08.11 15:01
    흑기사- npc 는 npc 를 표시하는거고요
    enemy 는 적
    merchant 는 상인입니다.
  • ?
    시에란 2008.08.13 14:04

    멋진 스크립트예요 ㅠㅠㅠ

  • ?
    방황하는초보자 2008.08.20 16:32
    우와 최고에요 감사합니당
  • ?
    애늙은이 2008.08.22 15:25

    오!!! 정말 좋군요!! ㄳㄳㄳㄳㄳ

  • ?
    이렐 2008.08.23 12:59
    잘쓰겠습니다~
  • ?
    ㅇㅇㅇㅇ2 2008.08.27 15:03
    크기가크면 안됨
  • ?
    Crazy、몽키 2008.09.03 07:14

    뭐가먼지 모르겠어요... ㅜㅜ 어떻게 하죠.....

  • ?
    불로불사 2008.09.04 11:52

    잘 써요~

  • ?
    rlaalstn 2008.09.16 10:17

    학!`

  • ?
    DR.kim 2008.09.18 16:19
    정말 마음에 듭니다. ^^ 감사합니다.
  • ?
    21thcentuary 2008.09.23 18:31
    감사합니다.
  • ?
    시옷청룡 2008.10.01 17:11
    ㄳㄳ^^
  • ?
    소닉의RPG 2008.10.12 13:10
    감사합니다.
  • ?
    다크아머 2008.10.25 11:01
    좋은자료 감사하므니다.
  • ?
    KSG 2008.10.25 14:13
    잘 쓸게요
  • ?
    [풍백천풍] 2008.11.05 22:29
    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)

    이게 팁이 되는 군요..
    근데 4992번 변수를 조작하면 미니맵이 없어져요;;
  • ?
    Night Breath 2008.11.06 20:03
    대단하군요.
  • ?
    min~ 2008.11.11 18:39
    원하는 맵에만 미니맵 없앨 수 없나여
  • ?
    소울푸른★ 2009.02.26 16:33
    원하는맵으로이동할때스위치10번을키세요
  • ?
    Sawadakun 2008.11.23 23:38
    좋은 자료 감사합니다.
  • ?
    윌리스 2008.12.23 00:18
    잘쓰고 있는데여 npc랑 몬스터 표시를 어떻게 하는줄 잘 모르겠네요 ㅎㅎ;;
  • ?
    츠코미 2009.01.09 11:52
    잘 쓰겠습니다 ^^
  • ?
    미스터창 2009.01.16 01:50
    스위치10을 어케하면 안보이게할수있네요;;
  • ?
    쀍쒧뛟 2009.01.23 10:33
    테스트 플레이 시에
    Script' 'line 124: NameError occurred.
    undefined method 'setup' for class 'Game_Map'
    이렇게 떠요...ㅠㅠ
    어캐 해야 하죠?
  • ?
    루이14세 2009.01.29 16:32
    구버전이라고 트집잡는 거....
    워드패드로 연결해서
    1.02인걸 1.01로 바꾸면 됨
  • ?
    zx5024 2009.02.09 16:54
    XP처럼 색깔있는 그런건없나요? ㅇㅇ?
  • ?
    백년술사 2009.02.12 16:40
    한번 봐여~
  • ?
    쏘쥬맛갈비 2009.02.13 22:03
    감사합니다.
  • ?
    Nano:[듐군] 2009.02.21 23:34
    안되네요.. 무슨 186번째 줄에 오류가 있다면서.. 흑;
  • ?
    전설의 찌질이 2009.03.15 20:54
    ㄳㄳㄳㄳㄳㄳㄳㄱㄳㄳㄳ
  • ?
    백년술사 2009.05.03 12:34

    또 잘씁니다~

  • ?
    줄리안 2009.06.07 20:13
    사랑합니다
  • ?
    김카샤 2009.06.23 21:47

    잘쓸게요~~ 근데 xp에 있던 예쁜미니맵을 보다 이거보니까 좀 슬픔 ㅍㅍ

  • ?
    페트릭스타 2009.06.27 11:10
    완전감사합니다.
  • ?
    보라앙마 2009.06.27 20:28

    잘되네요 . ^^ 잘쓸게욥

  • ?
    로미오 2009.06.30 22:06
    ㅎㅎ잘씀
  • ?
    夜雨殘香。 2009.08.09 12:48
    감사합니다~
  • ?
    Rollellcoda 2009.08.14 13:44
    스크립트의 美라 함은 길고 아름다운 것이 美이니라....
  • ?
    뉴공 2009.08.14 19:39

    무슨 이유에서인지 스크립트를 적용하기 이전의 저장파일을 불러오면 186줄이 오류가 뜹니다.

    스크립트 적용후 세이브 파일 불러오기는 아무런 이상도 없습니다.

    참고하세요

  • ?
    큐브는내운명 2009.10.04 23:59
    나중에 좋은게임만들때 써야겠군..ㅋ
  • ?
    Berylll 2009.10.18 13:44
    잘쓰겟습니다.
  • ?
    1000℃ 복숭아 2009.10.19 15:58

    잘 쓸게요.

     

  • profile
    RPG중독인 2009.11.17 19:04

    thenk you!

    z


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
» 미니맵 미니맵 스크립트(아랫거랑 다른거) 75 file 츠키아 2008.08.08 6145
76 액터 스탯 시스탬 29 츠키아 2008.08.08 4214
75 다음 레벨까지의 경험치 강제조정 13 정의로운녀석 2008.07.24 3273
74 상점 상점 아이템 목록 정리 14 정의로운녀석 2008.07.22 3771
73 변수/스위치 맵에 변수와 스위치 설정하기.. 5 정의로운녀석 2008.07.22 1984
72 영상 RMVX에서 AVI 재생 스크립트 12 Nymph 2008.07.07 4108
71 전투 [vx] ATB 시스템. 10 만들어보자꾸나 2008.07.05 4925
70 메뉴 지난 메뉴 스크립트에 이은 스테이터스 스크립트! 5 file 독사 2008.06.29 3545
69 저장 [퍼옴] Neo_Save_System ver.1.0 10 레오 2008.06.14 4451
68 기타 [KGC]한계돌파 9 방콕족의생활 2008.06.13 3599
67 메뉴 헬프 윈도우 중앙표시 스크립트 11 file 양념통닼 2008.06.10 3348
66 장비 장비 확장 및 EP 기능 18 만들어보자꾸나 2008.06.10 3653
65 맵/타일 타일셋 변경 10 file 만들어보자꾸나 2008.06.08 4370
64 맵/타일 타일 태그 및 4방향 설정 7 file 만들어보자꾸나 2008.06.08 2667
63 기타 빛 이펙트 71 file DEVIL<Li Patanis Roni Kraudus> 2008.06.06 5861
62 미니맵 미니맵 띠우는 스크립트 ^^ 37 file 아방스 2008.06.02 7247
61 제작도구 게임제작에 필수인 테스트 플레이 고속화 스크립트! ! ! ! 25 양념통닼 2008.05.30 4445
60 키입력 커맨드 입력 스킬 시스템 17 file 양념통닼 2008.05.29 3345
59 메뉴 창 크기 변경 스크립트 6 file Incubus 2008.05.25 5945
58 키입력 마우스 시스템 Simple Mouse System (수정) 42 Incubus 2008.05.24 5693
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