XP 스크립트

아래 메뉴 스크립트는 커먼이벤트를 실행시킬 수 있도록 수정된 것입니다.  인덱스가 이상하다든가 하는 것은 알아서 수정하고, 커먼이벤트 실행부분에 주목하시길.(다른 스크립트에서 커먼 이벤트를 실행하도록 응용할 수도 있을 겁니다)
 
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================
class Scene_Menu
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    s1 = "Items"
    s2 = "Skills"
    s3 = "Equipment"
    s4 = "Status"
    s5 = "Common Event"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(4)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(5)
    end
    # Make gold window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = 416
    # Make status window
    @status_window = Window_MenuStatus.new
    @status_window.x = 160
    @status_window.y = 0
    # Execute transition
    Graphics.transition
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @gold_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @gold_window.update
    @status_window.update
    # If command window is active: call update_command
    if @command_window.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # Common Event
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        $game_temp.common_event_id = 1
        $scene = Scene_Map.new
      when 4  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        if $game_party.actors[@status_window.index].restriction >= 2
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to skill screen
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@status_window.index)
      end
      return
    end
  end
end

Who's WMN

?
 
 

  W M  N  
                  자료공유

Comment '5'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
88 메뉴 1인용 메뉴 스크립트 6 WMN 2008.03.17 2450
87 메뉴 온라인메뉴처럼!! 메이플 메뉴처럼!! 변신~스크립트 33 WMN 2008.03.17 6815
» 메뉴 메뉴에서 커맨더실행하기 5 WMN 2008.04.06 1682
85 메뉴 링 메뉴 16 Neowitch* 2008.04.18 3478
84 메뉴 링 메뉴 소지금,플레이시간 추가 버젼 17 Neowitch* 2008.04.20 3022
83 메뉴 링메뉴 New 9 sdjfl465 2008.09.27 2861
82 메뉴 자세항 개인 상태화면 8 아방스 2009.01.12 2361
81 메뉴 자세한 캐릭터 정보표시 스크립트 버전2 5 아방스 2009.01.12 2328
80 메뉴 파이널 판타지 7 스타일 메뉴 7 아방스 2009.01.12 3237
79 메뉴 KGC스크립트모음 12 file 키라링 2009.01.18 2687
78 메뉴 Mog-메뉴업그레이드? ps인간 2009.01.23 2948
77 메뉴 메뉴에 얼굴 그래픽 표시 4 file 백호 2009.02.21 3112
76 메뉴 플레이 시간 윈도우 개조 file 백호 2009.02.21 1328
75 메뉴 메뉴 화면 개조 스크립트 1 백호 2009.02.21 1668
74 메뉴 개별 메뉴 호출 단축키 스크립트 5 file 백호 2009.02.21 1965
73 메뉴 FF7형식의 메뉴로 변경하는 스크립트 1 file 백호 2009.02.21 1462
72 메뉴 링메뉴 스크립트 file 백호 2009.02.21 1391
71 메뉴 제가 쓰고있는 메뉴 13 file 백호 2009.02.21 3028
70 메뉴 스테이터스 일람 스크립트 file 백호 2009.02.21 1328
69 메뉴 메뉴 화면 변경 스크립트 file 백호 2009.02.21 2236
Board Pagination Prev 1 2 3 4 5 Next
/ 5