Modified Scene_End - Hero - 04-16-2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
I modified the Scene_End script to take out the "Return To Title" but however, I added the "Load Data" and "New Game" command. Hope this actually proves useful seeing as I'm only a beginner at scripting.
Replace your Scene_End with this script:
Code: #==============================================================================
# Scene_End < Modified By Hero
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_End
#--------------------------------------------------------------------------
# � メイン処�
#--------------------------------------------------------------------------
def main
# Scnene_End Commands
s1 = "Load Data"
s2 = "New Game"
s3 = "Shutdown"
s4 = "Back to Menu"
@command_window = Window_Command.new(192, [s1, s2, s3,s4])
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 340 - @command_window.height / 2
@command_window.windowskin = RPG::Cache.windowskin("001-Blue01")
# Transition
Graphics.transition
# Loop Command
loop do
# Updates graphics
Graphics.update
# Updates Input
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# â—? Modified Area
#--------------------------------------------------------------------------
def update
# コマンドウィンドウを更新
@command_window.update
# B ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥?
$game_system.se_play($data_system.cancel_se)
# メニュー画��切� 替�
$scene = Scene_Menu.new(5)
return
end
# C ボタンã?Œæ� ¼ã?•ã‚Œã?Ÿå� ´å?ˆ
if Input.trigger?(Input::C)
# コマンドウィンドウ�カーソル�置�� �
case @command_window.index
when 0 # Calls Scene_Load2
$scene = Scene_Load2.new
when 1 # Starts New Game
command_new_game
when 2 # Calls Shutdown Command
command_shutdown
when 3 # Returns To The Menu
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# â—? コマンド [シャットダウン] é?¸æ� žæ™‚ã?®å‡¦ç?�
#--------------------------------------------------------------------------
def command_shutdown
# 決定 SE を演�
$game_system.se_play($data_system.decision_se)
# BGM�BGS�ME をフェードアウト
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# シャットダウン
$scene = nil
end
#--------------------------------------------------------------------------
# â—? コマンド [ã‚„ã‚?ã‚‹] é?¸æ� žæ™‚ã?®å‡¦ç?�
#--------------------------------------------------------------------------
def command_cancel
$game_system.se_play($data_system.decision_se)
$scene = Scene_Menu.new(5)
end
#--------------------------------------------------------------------------
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$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)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
#------------------------------------------------------------------------
def command_new_game
$game_system.se_play($data_system.decision_se)
Audio.bgm_stop
Graphics.frame_count = 0
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
$game_party.setup_starting_members
$game_map.setup($data_system.start_map_id)
$game_player.moveto($data_system.start_x, $data_system.start_y)
$game_player.refresh
$game_map.autoplay
$game_map.update
$scene = Scene_Map.new
end
end
Now add a new script and call it Scene_Load2 then paste the below script in it (This script makes it so that if you go into the load screen from Scene_End, then you'll return to the menu instead of the title screen if you hit the cancel button) :
Code: class Scene_Load2 < Scene_File
#--------------------------------------------------------------------------
# Modified Scene_Load By Hero
#--------------------------------------------------------------------------
def initialize
# ãƒ� ンãƒ?ラリオブジェクトをå� ?作æˆ?
$game_temp = Game_Temp.new
# タイãƒ� スタンプã?Œæœ€æ–°ã?®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é?¸æ� ž
$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("Load which file?")
end
#--------------------------------------------------------------------------
# � 決定時�処�
#--------------------------------------------------------------------------
def on_decision(filename)
# ファイルã?Œå˜åœ¨ã?—ã?ªã?„å� ´å?ˆ
unless FileTest.exist?(filename)
# ブザー SE を演�
$game_system.se_play($data_system.buzzer_se)
return
end
# ãƒãƒ¼ãƒ‰ SE ã‚’æ¼”å¥?
$game_system.se_play($data_system.load_se)
# セーブデータã?®æ›¸ã??è¾¼ã?¿
file = File.open(filename, "rb")
read_save_data(file)
file.close
# BGM�BGS を復帰
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
# マップを更新 (並列イベント実行)
$game_map.update
# マップ画��切� 替�
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# â—? ã‚ャンセル時ã?®å‡¦ç?�
#--------------------------------------------------------------------------
def on_cancel
# ã‚ャンセル SE ã‚’æ¼”å¥?
$game_system.se_play($data_system.cancel_se)
# タイトル画��切� 替�
$scene = Scene_End.new
end
#--------------------------------------------------------------------------
# â—? セーブデータã?®èªã?¿è¾¼ã?¿
# file : èªã?¿è¾¼ã?¿ç”¨ãƒ•ã‚¡ã‚¤ãƒ«ã‚ªãƒ–ジェクト (オープン済ã?¿)
#--------------------------------------------------------------------------
def read_save_data(file)
# セーブファイルæ??画用ã?®ã‚ャラクターデータをèªã?¿è¾¼ã‚€
characters = Marshal.load(file)
# プレイ時間計測用ã?®ãƒ•ãƒ¬ãƒ¼ãƒ� カウントをèªã?¿è¾¼ã‚€
Graphics.frame_count = Marshal.load(file)
# å?„種ゲーãƒ� オブジェクトをèªã?¿è¾¼ã‚€
$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)
# マジックãƒ� ンãƒ?ーã?Œã‚»ãƒ¼ãƒ–時ã?¨ç•°ã?ªã‚‹å� ´å?ˆ
# (エディタã?§ç·¨é›� ã?Œå� � ã?ˆã‚‰ã‚Œã?¦ã?„ã‚‹å� ´å?ˆ)
if $game_system.magic_number != $data_system.magic_number
# マップをリãƒãƒ¼ãƒ‰
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# パー� ィメン�ーをリフレッシュ
$game_party.refresh
end
end
If you want to change the window skin for Scene_End, then look on line 20 and replace "001-Blue01" with the name of your window skin. Hope you guys like it!
|