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 전투 Verus Tempus Proelium by Vlad 습작 2013.05.13 1243
416 전투 VLAD ABS [액알 시스템] 65 아방스 2009.01.07 12564
415 맵/타일 VX Mode 7 스크립트!!!! 42 file Tofuman 2009.01.07 4306
414 온라인 VX Pheonix 2.0 한글 번역 버전 16 미니 2010.04.18 4002
413 온라인 VX Phoenix 온라인 스크립트 1.3버전 12 아방스 2009.06.18 3486
412 온라인 VX Phoenix 온라인 스크립트 Ver 1.5 36 아방스 2009.07.02 5510
411 변수/스위치 VX Script Fix - Variable Operation (by Yeyinde) 8 WMN 2008.04.06 2267
410 전투 VX SRPG 스크립트를 살짝 손대봤습니다. 13 아이미르 2011.03.31 3428
409 전투 VX SRPG 스크립트를 수정해봤습니다(8) - 누적수정 30 아이미르 2011.09.09 3911
408 전투 VX SRPG 한글번역 (최종수정) 26 file 에틴 2010.08.25 7418
407 전투 VX SRPG3d 수정본(1) 12 아이미르 2011.10.19 4617
406 전투 VX SRPG3d(한글번역) 8 file 아이미르 2011.10.15 5033
405 기타 VX Weather Script by ccoa 1 Alkaid 2010.09.08 1318
404 이동 및 탈것 vx 걸을때 소리가 나도도록 하는 스크립트 33 아방스 2008.01.31 3947
403 이동 및 탈것 VX 기차 스크립트 28 아방스 2009.01.13 4467
402 기타 vx 보안 시스템 19 file 허걱 2009.07.29 3966
401 전투 VX 사이드 뷰 전투 (2003 방식) 16 드로드맨 2008.02.24 4996
400 VX 주석액알 PR코더즈의ABS보다 않좋다고생각할수있지만 더좋음 34 배군 2008.08.17 5145
399 전투 VX]Mog Battleback XP 1.0 11 file WMN 2008.04.06 3869
398 전투 VX_SRPG2 by tomoaky 1 습작 2013.05.13 2050
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