เอาสคลิปท์นี้ไปแทนที่ Scene_Menu อันเดิม
Code:
#==============================================================================
# * Scene_Menu
#------------------------------------------------------------------------------
# It is the class which processes the menu screen.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# - Object initialization
# menu_index : Cursor initial position of command
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# - Main processing
#--------------------------------------------------------------------------
def main
# Drawing up the command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Load"
s6 = "End"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
# When party number of people 0 is
if $game_party.actors.size == 0
# Nullifying the item, skill, equipment and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# In case of saving prohibition
if $game_system.save_disabled
# Saving is made invalid
@command_window.disable_item(4)
end
# Drawing up the play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Drawing up step several windows
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Drawing up the Goldwyn dough
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Drawing up the status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Transition execution
Graphics.transition
# Main loop
loop do
# Renewing the game picture
Graphics.update
# Updating the information of input
Input.update
# フレーム更新
update
# When the picture changes, discontinuing the loop
if $scene != self
break
end
end
# Transition preparation
Graphics.freeze
# Releasing the window
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# - Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the window
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@status_window.update
# When the command window is active,: Update_command is called
if @command_window.active
update_command
return
end
# When the status window is active,: Update_status is called
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# - When frame renewal (the command window is active)
#--------------------------------------------------------------------------
def update_command
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to map picture
$scene = Scene_Map.new
return
end
# When C button is pushed
if Input.trigger?(Input::C)
# When party number of people with 0, it is command other than saving and game end
if $game_party.actors.size == 0 and @command_window.index < 4
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# It diverges at cursor position of the command window
case @command_window.index
when 0 # Item
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to item picture
$scene = Scene_Item.new
when 1 # Skill
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# The status window is made active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # Equipment
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# The status window is made active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # Status
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# The status window is made active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # Loading
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to game end picture
$scene = Scene_Load2.new
when 5 # Game end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to game end picture
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# - When frame renewal (the status window is active)
#--------------------------------------------------------------------------
def update_status
# The B when button is pushed
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# The command window is made active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# When C button is pushed
if Input.trigger?(Input::C)
# It diverges at cursor position of the command window
case @command_window.index
when 1 # Skill
# When conduct restriction of this actor is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to skill picture
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equipment
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to equipment picture
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Change to status picture
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
จากนั้นก็อปสคลิปท์นี้ไปไว้ข้างล่างScene_Loadอันเก่าตั้งเป็นScene_Load2ก็ได้
โดยไม่ต้องลบอันเก่าทิ้งเพราะมันทำงานแยกกันซีนโหลดอันนี้จะทำให้กดออกมาแล้วไม่ต้องไปเมนูเริ่มเกม
Code:
#==============================================================================
# * Scene_Load BY Natsukikung
#------------------------------------------------------------------------------
# It is the class which processes the load picture.
#==============================================================================
class Scene_Load2 < Scene_File
#--------------------------------------------------------------------------
# - Object initialization
#--------------------------------------------------------------------------
def initialize
# Rewriting temporary object
$game_temp = Game_Temp.new
# Time stamp selecting the up-to-date file
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..3
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
super("คุณต้องการจะโหลดข้อมูลจากไฟล์ไหน?")
end
#--------------------------------------------------------------------------
# - Processing when deciding
#--------------------------------------------------------------------------
def on_decision(filename)
# When the file does not exist
unless FileTest.exist?(filename)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing load SE
$game_system.se_play($data_system.load_se)
# Entry of saving data
file = File.open(filename, "rb")
read_save_data(file)
file.close
# BGM、BGS Return
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
#Map renewal (parallel event execution)
$game_map.update
# Change to map picture
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# - Processing when cancelling
#--------------------------------------------------------------------------
def on_cancel
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# When it is called from the event
if $game_temp.save_calling
# Clearing the saving call flag
$game_temp.save_calling = false
# Change to map picture
$scene = Scene_Map.new
return
end
# Change to menu screen
$scene = Scene_Menu.new(4)
end
#--------------------------------------------------------------------------
# - Reading the saving data
# file : File object for reading (opening it is completed)
#--------------------------------------------------------------------------
def read_save_data(file)
# The character data for saving file drawing is read
characters = Marshal.load(file)
# Frame count for play time measurement is read
Graphics.frame_count = Marshal.load(file)
# Various game objects are read
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
# When magic number differs from when saving
# When (compilation is added with the editor)
if $game_system.magic_number != $data_system.magic_number
# Map Setup
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refreshing the party member
$game_party.refresh
end
end