#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
SPECIAL_ITEM_ID = 12
SPECIAL_OPTION = 'Monster Book'
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Define the array that will hold the possible choices in the command
# window.
menu_options =
[
$data_system.words.item,
$data_system.words.skill,
$data_system.words.equip
]
# If the special item is currently in the party's inventory.
if $game_party.item_number(SPECIAL_ITEM_ID) > 0
menu_options << SPECIAL_OPTION
end
menu_options += ['Status', 'Save', 'End Game']
@command_window = Window_Command.new(160, menu_options)
@command_window.index = @menu_index
# Cap the height of the command window so it doesn't draw on top of
# Play time or gold.
@command_window.height = 224
# 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(3)
if $game_party.item_number(SPECIAL_ITEM_ID) > 0
@command_window.disable_item(menu_options.index[SPECIAL_OPTION])
end
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(menu_options.index['Save'])
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# 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
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
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
end
if $game_party.item_number(SPECIAL_ITEM_ID) > 0
case @command_window.index
when 4 # SPECIAL_OPTION
# Play decision SE
$game_system.se_play($data_system.decision_se)
# SPECIAL_OPTION stuff.
command_special_option
when 5 # end game
# 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 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
else
case @command_window.index
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
end
return
end
end
#--------------------------------------------------------------------------
# * Command: Special Option Stuff
#--------------------------------------------------------------------------
def command_special_option
# Do whatever work you want done for this.
end
end