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-Scene CMS 1.03 by LegACy@rmxp.org (SDK호환) file 백호 2009.02.22 871
87 메뉴 Customizable Ring Menu by SephirothSpawn 백호 2009.02.22 884
86 메뉴 1-Scene CMS 1.1 by LegACy@rmxp.org (SDK호환) file 백호 2009.02.22 953
85 메뉴 Event Spawner 1 file 백호 2009.02.22 979
84 메뉴 SG_Artifact Colors by sandgolem (SDK 호환) 1 백호 2009.02.22 1003
83 메뉴 링메뉴+음악도입스크립트 백호 2009.02.21 1051
82 메뉴 SG_Hide zero SP cost by sandgolem (SDK호환) 백호 2009.02.22 1064
81 메뉴 FF7 Menu version 3 by AcedentProne (SDK 호환) file 백호 2009.02.22 1116
80 메뉴 메뉴에서 실제시간 보기 2 백호 2009.02.21 1124
79 메뉴 Materia System 2 file 백호 2009.02.22 1222
78 메뉴 CogWheel Plug'n'Play Menu Bar by DerVVulfman@rmxp.org 2 백호 2009.02.22 1222
77 메뉴 L's Simple Custom Menu #1 R2 (SDK 2.x 필요) Alkaid 2013.01.18 1227
76 메뉴 Advanced Command Windows by Tsunokiette file 백호 2009.02.22 1307
75 메뉴 플레이 시간 윈도우 개조 file 백호 2009.02.21 1328
74 메뉴 스테이터스 일람 스크립트 file 백호 2009.02.21 1328
73 메뉴 Ring menu edit for SDK2 (Original by Hypershadow180) file Alkaid 2010.09.08 1374
72 메뉴 링메뉴 스크립트 file 백호 2009.02.21 1391
71 메뉴 콤보 스크립트 백호 2009.02.22 1399
70 메뉴 링메뉴에 돈(G)표시하기 백호 2009.02.21 1414
69 메뉴 Leidy's Ring Command Window 1.2 by DerVVulfman Alkaid 2012.09.09 1430
Board Pagination Prev 1 2 3 4 5 Next
/ 5