VX 스크립트

일단 원문 링크 올리겠습니다.

http://ytomy.sakura.ne.jp/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/menu&tech=custom_menu_command

 

그리고 이것은, 주석부분을 제가 번역해서 올린겁니다.

 

구글 번역기로 한것이라 맞을지 않맞을지 확실하게는 몰라서, 문제가 생기면 원문링크로 가서 스크립트를 확인해봐주시길 바랍니다.

 

참고로 만약 중복이면 말씀해주세요.

자삭합니다.

 

#여기 밑부터 스크립트입니다. ↓

 

# _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ /
 # _ / ◆ 사용자 지정 메뉴 명령 - KGC_CustomMenuCommand ◆ VX ◆
 # _ / ◇ Last update : 2008/08/28 ◇
 # _ / ----------------------------------------------- -----------------------------
 # _ / 메뉴 명령을 자유롭게 정렬합니다.
 # _ / =============================================== =============================
 # _ / 재정이 많기 때문에 가능한 "소재"의 상단에 배치하십시오.
 # _ / "레쿠토루과 검은 사자 문장"덤 스크립트 아래에 소개합니다.
 # _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ / _ /

 # ================================================= =============================
 # ★ 사용자 정의 항목 - Customize ★
 # ================================================= =============================

module KGC
module CustomMenuCommand
# ◆ 메뉴 명령 목록
  # 메뉴 화면에 표시되는 명령을 "표시 할 순서"에 설명합니다.
  # 사용하지 않는 명령은 쓰지 않아도 상관 없습니다.
  # ** 대응표 **
  # 0 .. 아이템 1 .. 스킬 2 .. 장비 3 .. 상태 4 .. 세이브 5 .. 게임 종료
  #
  # ** 다음은 해당 기능을 도입하지 않으면 사용할 수 없습니다.
  # 10 .. 파티 편성 (멀티 파티)
  # 11..AP 뷰어 (스킬 습득 장비)
  # 12 .. 스킬 설정 (스킬 CP 제)
  # 13 .. 난이도 설정 (전투 난이도)
  # 14 .. 매개 변수 배분 (매개 변수 배분)
  # 15 .. 몬스터 도감 (몬스터 도감)
  #
  # ** 다음은 "레쿠토루과 검은 사자 문장"덤 스크립트
  # ** [ExMenu_CustomCommand] 용입니다.
  # ** '줄거리'등을 추가하는 경우에 사용하십시오.
  # 100 .. 명령 1 개째
  # 101 .. 명령 2 번째
  # 102 .. 명령 3 번째
  # (이후 199까지 사용 가능)
  MENU_COMMANDS = [0, 1, 2, 3, 12, 14, 11, 10, 13, 100, 15, 4, 5]

 # ◆ 메뉴 명령의 최대 행수
  ROW_MAX = 10
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["CustomMenuCommand"] = true

module KGC::CustomMenuCommand
  # [ExMenu_CustomCommand] 도입판정
  EXMNU_CTCMD_OK = defined?(EXMNU_CTCMD_COMMANDS)
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ KGC::Commands
#==============================================================================

module KGC
module Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ 상태 화면 호출
  # actor_index : 배우 인덱스
  #--------------------------------------------------------------------------
  def call_status(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :menu_status
    $game_temp.next_scene_actor_index = actor_index
    $game_temp.menu_command_index = {}
  #--------------------------------------------------------------------------
  # ○ 아이템 화면의 호출
  #--------------------------------------------------------------------------
  def call_item
    return if $game_temp.in_battle
    $game_temp.next_scene = :menu_item
    $game_temp.next_scene_actor_index = 0
    $game_temp.menu_command_index = {}
  end
  #--------------------------------------------------------------------------
  # ○ 스킬 화면의 호출
  # actor_index : 배우 인덱스
  #--------------------------------------------------------------------------
  def call_skill(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :menu_skill
    $game_temp.next_scene_actor_index = actor_index
    $game_temp.menu_command_index = {}
  end
  #--------------------------------------------------------------------------
  # ○ 장비 화면의 호출
  # actor_index : 배우 인덱스
  #--------------------------------------------------------------------------
  def call_equip(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :menu_equip
    $game_temp.next_scene_actor_index = actor_index
    $game_temp.menu_command_index = {}
  end
  end
end
end

class Game_Interpreter
  include KGC::Commands
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_accessor :menu_command_index          #메뉴 명령의 인덱스
  attr_accessor :next_scene_actor_index   # 다음 장면의 배우 인덱스
  #--------------------------------------------------------------------------
  # ● 객체 초기화
  #--------------------------------------------------------------------------
  alias initialize_KGC_CustomMenuCommand initialize
  def initialize
    initialize_KGC_CustomMenuCommand

    @menu_command_index = {}
    @next_scene_actor_index = 0
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 화면 전환 실행
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_CustomMenuCommand update_scene_change
  def update_scene_change
    return if $game_player.moving?    # 플레이어의 이동 중?

    case $game_temp.next_scene
    when :menu_item
      call_menu_item
    when :menu_skill
      call_menu_skill
    when :menu_equip
      call_menu_equip
    when :menu_status
      call_menu_status
    else
      update_scene_change_KGC_CustomMenuCommand
    end
  end
  #--------------------------------------------------------------------------
  # ○ 아이템 화면으로 전환
  #--------------------------------------------------------------------------
  def call_menu_item
    $game_temp.next_scene = nil
    $scene = Scene_Item.new
  end
  #--------------------------------------------------------------------------
  # ○ 스킬 화면으로 전환
  #--------------------------------------------------------------------------
  def call_menu_skill
    $game_temp.next_scene = nil
    $scene = Scene_Skill.new($game_temp.next_scene_actor_index)
    $game_temp.next_scene_actor_index = 0
  end
  #--------------------------------------------------------------------------
  # ○ 장비 화면으로 전환
  #--------------------------------------------------------------------------
  def call_menu_equip
    $game_temp.next_scene = nil
    $scene = Scene_Equip.new($game_temp.next_scene_actor_index)
    $game_temp.next_scene_actor_index = 0
  end
  #--------------------------------------------------------------------------
  # ○ 상태 화면으로 전환
  #--------------------------------------------------------------------------
  def call_menu_status
    $game_temp.next_scene = nil
    $scene = Scene_Status.new($game_temp.next_scene_actor_index)
    $game_temp.next_scene_actor_index = 0
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # ● 명령 창 만들기
  #--------------------------------------------------------------------------
  def create_command_window
    commands = create_command_list
    @command_window = Window_Command.new(160, commands)
    @command_window.height = [@command_window.height,
      KGC::CustomMenuCommand::ROW_MAX * Window_Base::WLH + 32].min
    @command_window.index = [@menu_index, commands.size - 1].min
    set_command_enabled
  end
  #--------------------------------------------------------------------------
  # ○ 명령 목록 작성
  # 명령 이름의 목록을 반환한다.
  #--------------------------------------------------------------------------
  def create_command_list
    commands = []
    index_list = {}
    @exmenu_command_scene = {}
    @disabled_command_index = []

    KGC::CustomMenuCommand::MENU_COMMANDS.each_with_index { |c, i|
      case c
      when 0         # 아이템
        index_list[:item] = commands.size
        commands << Vocab.item
      when 1         # 스킬
        index_list[:skill] = commands.size
        commands << Vocab.skill
      when 2         # 장비
        index_list[:equip] = commands.size
        commands << Vocab.equip
      when 3         # 상태
        index_list[:status] = commands.size
        commands << Vocab.status
      when 4         # 저장
        index_list[:save] = commands.size
        commands << Vocab.save
      when 5         # 게임 종료
        index_list[:game_end] = commands.size
        commands << Vocab.game_end
      when 10        # 파티 편성
        next unless $imported["LargeParty"]
        index_list[:partyform] = commands.size
        @__command_partyform_index = commands.size
        commands << Vocab.partyform
      when 11        # AP 뷰어
        next unless $imported["EquipLearnSkill"]
        index_list[:ap_viewer] = commands.size
        @__command_ap_viewer_index = commands.size
        commands << Vocab.ap_viewer
      when 12        # 스킬 설정
        next unless $imported["SkillCPSystem"]
        index_list[:set_battle_skill] = commands.size
        @__command_set_battle_skill_index = commands.size
        commands << Vocab.set_battle_skill
      when 13        # 전투 난이도
        next unless $imported["BattleDifficulty"]
        index_list[:set_difficulty] = commands.size
        @__command_set_difficulty_index = commands.size
        commands << KGC::BattleDifficulty.get[:name]
      when 14        # 매개 변수 배분
        next unless $imported["DistributeParameter"]
        index_list[:distribute_parameter] = commands.size
        @__command_distribute_parameter_index = commands.size
        commands << Vocab.distribute_parameter
      when 15        # 몬스터 도감
        next unless $imported["EnemyGuide"]
        index_list[:enemy_guide] = commands.size
        @__command_enemy_guide_index = commands.size
        commands << Vocab.enemy_guide
      when 100..199  # ExMenu_CustomCommand
        next unless KGC::CustomMenuCommand::EXMNU_CTCMD_OK  # 사용 불가라면 다음
        excommand = EXMNU_CTCMD_COMMANDS[c - 100]           # 명령 index 취득
        unless command_visible?(excommand) || command_inputable?(excommand)
          next                                              # 보이지 않는이면 다음
        end
        index_list[excommand[2]] = commands.size
        commands << excommand[2]
        @exmenu_command_scene[excommand[2]] = excommand[3]
      end
    }
    $game_temp.menu_command_index = index_list
    return commands
  end
  #--------------------------------------------------------------------------
  # ○ 명령의 유효 상태 설정
  #--------------------------------------------------------------------------
  def set_command_enabled
    disable_items = []
    # 파티 인원이 0 명인 경우
    if $game_party.members.size == 0
      disable_items.push(:item, :skill, :equip, :status, :partyform,
        :ap_viewer, :set_battle_skill, :distribute_parameter)
    end
    # 저장 금지의 경우
    if $game_system.save_disabled
      disable_items.push(:save)
    end

    # 파티 편성 금지의 경우
    if $imported["LargeParty"] && !$game_party.partyform_enable?
      disable_items.push(:partyform)
    end

    # [ExMenu_CustomCommand] 판정
    if KGC::CustomMenuCommand::EXMNU_CTCMD_OK
      disable_items += get_exmenu_disable_commands
    end

    # 지정 항목을 비활성화
    disable_items.each { |i|
      if $game_temp.menu_command_index.has_key?(i)
        index = $game_temp.menu_command_index[i]
        @command_window.draw_item(index, false)
        @disabled_command_index << index
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ [ExMenu_CustomCommand] 잘못된 명령 취득
  #--------------------------------------------------------------------------
  def get_exmenu_disable_commands
    disable_items = []
    $game_temp.menu_command_index.each { |k, v|
      next unless k.is_a?(String)
      # 해당 명령 찾기
      command = EXMNU_CTCMD_COMMANDS.find { |c| c[2] == k }
      next if command == nil
      # 유효 상태를 판정
      unless command_inputable?(command)
        disable_items.push(k)
      end
    }
    return disable_items
  end
  #--------------------------------------------------------------------------
  # ● 명령 선택의 업데이트
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      index = @command_window.index
      unless command_enabled?(index)  # 잘못된 명령
        Sound.play_buzzer
        return
      end
      Sound.play_decision

      # [ExMenu_CustomCommand]
      excommand = nil
      if KGC::CustomMenuCommand::EXMNU_CTCMD_OK
        excommand = @command_window.commands[index]
      end

      # 전환 장면 판정
      case index
      when $game_temp.menu_command_index[:item]      # 아이템
        $scene = Scene_Item.new
      when $game_temp.menu_command_index[:skill],    # 기술, 장비, 상태
          $game_temp.menu_command_index[:equip],
          $game_temp.menu_command_index[:status]
        start_actor_selection
      when $game_temp.menu_command_index[:save]      # 저장
        $scene = Scene_File.new(true, false, false)
      when $game_temp.menu_command_index[:game_end]  # 게임 종료
        $scene = Scene_End.new
      when $game_temp.menu_command_index[excommand]  # [ExMenu_CustomCommand]
        $game_party.last_menu_index = index
        $scene = eval("#{@exmenu_command_scene[excommand]}.new")
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 명령 유효 판정
  # index : 명령 index
  #--------------------------------------------------------------------------
  def command_enabled?(index)
    # メニュー
    if $game_system.save_disabled &&
        index == $game_temp.menu_command_index[:save]
      return false
    end

    # [ExMenu_CustomCommand]
    if KGC::CustomMenuCommand::EXMNU_CTCMD_OK
      command = @command_window.commands[index]
      if @disabled_command_index.include?($game_temp.menu_command_index[command])
        return false
      end
    end

    # メンバー 0 人
    if $game_party.members.size == 0 &&
        @disabled_command_index.include?(index)
      return false
    end

    return true
  end
  #--------------------------------------------------------------------------
  # ● 액터 선택의 업데이트
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision

      case @command_window.index
      when $game_temp.menu_command_index[:skill]   # 스킬
        $scene = Scene_Skill.new(@status_window.index)
      when $game_temp.menu_command_index[:equip]   # 장비
        $scene = Scene_Equip.new(@status_window.index)
      when $game_temp.menu_command_index[:status]  # 상태
        $scene = Scene_Status.new(@status_window.index)
      end
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Item
#==============================================================================

class Scene_Item < Scene_Base
  #--------------------------------------------------------------------------
  # ● 원래 화면으로 돌아 가기
  #--------------------------------------------------------------------------
  def return_scene
    if $game_temp.menu_command_index.has_key?(:item)
      $scene = Scene_Menu.new($game_temp.menu_command_index[:item])
    else
      $scene = Scene_Map.new
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Skill
#==============================================================================

class Scene_Skill < Scene_Base
  #--------------------------------------------------------------------------
  # ● 원래 화면으로 돌아 가기
  #--------------------------------------------------------------------------
  def return_scene
    if $game_temp.menu_command_index.has_key?(:skill)
      $scene = Scene_Menu.new($game_temp.menu_command_index[:skill])
    else
      $scene = Scene_Map.new
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Equip
#==============================================================================

class Scene_Equip < Scene_Base
  #--------------------------------------------------------------------------
  # ● 원래 화면으로 돌아 가기
  #--------------------------------------------------------------------------
  def return_scene
    if $game_temp.menu_command_index.has_key?(:equip)
      $scene = Scene_Menu.new($game_temp.menu_command_index[:equip])
    else
      $scene = Scene_Map.new
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Status
#==============================================================================

class Scene_Status < Scene_Base
  #--------------------------------------------------------------------------
  # ● 원래 화면으로 돌아 가기
  #--------------------------------------------------------------------------
  def return_scene
    if $game_temp.menu_command_index.has_key?(:status)
      $scene = Scene_Menu.new($game_temp.menu_command_index[:status])
    else
      $scene = Scene_Map.new
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_File
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # ● 원래 화면으로 돌아 가기
  #--------------------------------------------------------------------------
  alias return_scene_KGC_CustomMenuCommand return_scene
  def return_scene
    if @from_title || @from_event
      return_scene_KGC_CustomMenuCommand
    elsif $game_temp.menu_command_index.has_key?(:save)
      $scene = Scene_Menu.new($game_temp.menu_command_index[:save])
    else
      $scene = Scene_Map.new
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_End
#==============================================================================

class Scene_End < Scene_Base
  #--------------------------------------------------------------------------
  # ● 원래 화면으로 돌아 가기
  #--------------------------------------------------------------------------
  def return_scene
    if $game_temp.menu_command_index.has_key?(:game_end)
      $scene = Scene_Menu.new($game_temp.menu_command_index[:game_end])
    else
      $scene = Scene_Map.new
    end
  end
end

 

#여기까지가 스크립트 ↑

일단 제가 아는부분에서 간단하게 사용방법을 가르쳐 드리자면

      when 0         # 아이템
        index_list[:item] = commands.size
        commands << Vocab.item
      when 1         # 스킬
        index_list[:skill] = commands.size
        commands << Vocab.skill
      when 2         # 장비
        index_list[:equip] = commands.size
        commands << Vocab.equip
      when 3         # 상태
        index_list[:status] = commands.size
        commands << Vocab.status
      when 4         # 저장
        index_list[:save] = commands.size
        commands << Vocab.save
      when 5         # 게임 종료
        index_list[:game_end] = commands.size
        commands << Vocab.game_end

 

스크립트의 요부분에서 when 0,1,2,3,4,5 이부분에 숫자를 바꾸시면 메뉴창의 순서도 바뀝니다.(굳이 위치를 옮길 필요는 없음)

예시로, When 0인 아이템을 When 3으로 바꾸고 When 3인 상태를 When 0으로 바꿔주시면

메뉴창을 킬경우

 상태, 스킬, 장비, 아이템, 저장, 게임 종료

이순으로 설정됩니다.

 

그럼 이만 스피드웨건은 쿨하게 물러나지.

Comment '1'
  • ?
    듀란테 2015.07.27 16:27
    아... 지금보니 사용법 더 편한게 있내요.
    MENU_COMMANDS = [0, 1, 2, 3, 12, 14, 11, 10, 13, 100, 15, 4, 5]
    상단부분에 여기부분이 위치설정이내요 ㅡ..

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 3 습작 2012.12.24 5398
17 버그픽스 애니메이션 표시 위치 수정 (Fix Animation Position) 2 file AltusZeon 2014.02.12 1288
16 기타 장애물을 피하고 다가오게 하는 스크립트 5 file 박력남 2014.02.25 1877
15 버그픽스 Graphical Object Global Reference VX by Mithran Alkaid 2014.03.03 1026
14 타이틀/게임오버 Title Skip System : 타이틀 스킵 file 허걱 2014.03.19 1510
13 이동 및 탈것 이동 기능 파워업 (장애물 등을 피하는 이동방식) 8 file 파노 2014.04.27 1716
12 메뉴 MOG - Scroll Bar for VX file 습작 2014.07.06 1114
11 메시지 Etude87 Dialogue History Scene file 습작 2014.07.07 1069
10 키입력 해외 제작자 He Who Jets님의 마우스 스크립트(mouse system) 1 file 보자기군 2014.09.30 1260
9 메뉴 Etude87_Ace_Style_Formation_Change ver.1.01 습작 2014.10.05 757
8 장비 방어구 착용시 최대HP, MP증가 스크립트(턴알) 3 file 기관차 2014.11.06 1222
7 버그픽스 DerVVulfman's Tileset Reader VX Bug Fix 습작 2014.11.16 699
6 기타 Gamepad Extender VX 습작 2015.01.02 672
5 메뉴 Etude87's Menu Editor for VX 25 습작 2015.01.14 1461
» 메뉴 KGC - 커스텀 메뉴 커멘드 (번역) 1 듀란테 2015.07.27 1077
3 스킬 [RPG VX] 턴알 스킬 쿨타임 스크립트! (잘돌아감) 5 듀란테 2015.08.18 1671
2 저장 세이브 파일 개수 16개로 늘리기 (기본 세이브 엔진용) 1 file Bunny_Boy 2015.09.07 815
1 아이템 현재있는 파티원 선택 레벨업 아이템 만들기 1 file 싸패 2016.06.06 712
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