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
641 메뉴 메뉴화면 변경 스크립트 1 file 백호 2009.02.21 2770
640 파티 메뉴커맨드로 파티 멤버들 순서 바꾸기 by Yargovish 1 백호 2009.02.22 1620
» 메뉴 메뉴에서 커맨더실행하기 5 WMN 2008.04.06 1682
638 메뉴 메뉴에서 실제시간 보기 2 백호 2009.02.21 1124
637 메뉴 메뉴에 얼굴 그래픽 표시 4 file 백호 2009.02.21 3112
636 메뉴 메뉴에 그림넣기 4 file 백호 2009.02.22 4412
635 변수/스위치 메뉴변수표시 스크립트 1 file 백호 2009.02.22 1644
634 메뉴 메뉴바꾸기 4 file ureazy 2012.07.23 2845
633 메뉴 메뉴를 바꾸는 스크립트 14 №1 2012.08.04 4208
632 메뉴 메뉴등에서 움직이는 엑터 9 file 백호 2009.02.22 3162
631 메뉴 메뉴....있길래올립니다. 9 벨☆ 2010.01.23 2001
630 메뉴 메뉴 화면 변경 스크립트 file 백호 2009.02.21 2236
629 메뉴 메뉴 화면 개조 스크립트 1 백호 2009.02.21 1668
628 메뉴 메뉴 변경 스크립트 2 file 백호 2009.02.21 2359
627 메뉴 메뉴 단축키 스크립트 14 백호 2009.02.22 2958
626 기타 멋진...제작자 정보를 그림으로 1 백호 2009.02.22 1233
625 이동 및 탈것 멈췄을때 행동. 17 file Bera 2010.10.17 3408
624 온라인 멀티넷플레이 99Q Beta 3 27 백호 2009.02.22 3107
623 온라인 멀티넷스크립트 => 채팅보완 스크립트 8 file 백호 2009.02.22 2931
622 저장 멀티넷스크립트 -> 아이피 세이브,로드 스크립트 9 file 백호 2009.02.22 2204
Board Pagination Prev 1 ... 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 ... 52 Next
/ 52