Hiding Save Option - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Archives (https://www.save-point.org/forum-105.html) +--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html) +---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html) +----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html) +----- Thread: Hiding Save Option (/thread-6823.html) |
Hiding Save Option - Necrol The Mage - 12-22-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 have recently decided to try scripting, so I opened up a few tutorials. This is my second attempt at a vaguely useful script. While this has probably been done before, here is my script for hiding the ‘Save’ button when it is disabled. NOTE: There are two methods that can be used to insert this script. METHOD ONE is a tutorial, showing you how to insert and modify ONLY the script that is affected. METHOD TWO is a complete copy of the 'Scenes' that will be modified. You can replace your 'Scene' pages with these if you have not made any alterations tto them already, otherwise you will lose you work so far. METHOD ONE: How to later your existing 'Menu Sytem' to use this script: Open up your script editor, and go to 'Scene_Menu'. Line 26 should look like this (if it doesn’t, just look for this beneath ‘s6’): Code: @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) Replace it with the following: Code: if $game_system.save_disabled Look for lines 43 to 46, which should look like this: Code: if $game_system.save_disabled Delete the aforementioned lines. Look for lines 152 to 158, which should look like the following: Code: when 4 # セーブ Replace it with the following: Code: when 4 Now delete everything between "end"(line 159) and " when 5 # ゲーム終了". Now go to 'Scene_End'. Line 56 should look like this: Code: $scene = Scene_Menu.new(5) Replace it with the following: Code: if $game_system.save_disabled Now repeat with what should be line 110. METHOD TWO: Replace your current 'Scene' pages with completed pages: #============================================================================== # ■ Scene_Menu #------------------------------------------------------------------------------ # メニュー画面の処理を行うクラスです。 #============================================================================== class Scene_Menu #-------------------------------------------------------------------------- # ● オブジェクト初期化 # menu_index : コマンドのカーソル初期位置 #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main # コマンドウィンドウを作成 s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Status" s5 = "Save" s6 = "End Game" if $game_system.save_disabled @command_window = Window_Command.new(160, [s1, s2, s3, s4, s6]) @command_window.index = @menu_index else @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index end @command_window.index = @menu_index # パーティ人数が 0 人の場合 if $game_party.actors.size == 0 # アイテム、スキル、装備、ステータスを無効化 @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # セーブ禁止の場合 # プレイ時間ウィンドウを作成 @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 224 # 歩数ウィンドウを作成 @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 320 # ゴールドウィンドウを作成 @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # ステータスウィンドウを作成 @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # フレーム更新 update # 画面が切り替わったらループを中断 if $scene != self break end end # トランジション準備 Graphics.freeze # ウィンドウを解放 @command_window.dispose @playtime_window.dispose @steps_window.dispose @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @command_window.update @playtime_window.update @steps_window.update @gold_window.update @status_window.update # コマンドウィンドウがアクティブの場合: update_command を呼ぶ if @command_window.active update_command return end # ステータスウィンドウがアクティブの場合: update_status を呼ぶ if @status_window.active update_status return end end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_command # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # マップ画面に切り替え $scene = Scene_Map.new return end # C ボタンが押された場合 if Input.trigger?(Input::C) # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合 if $game_party.actors.size == 0 and @command_window.index < 4 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # コマンドウィンドウのカーソル位置で分岐 case @command_window.index when 0 # アイテム # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アイテム画面に切り替え $scene = Scene_Item.new when 1 # スキル # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータスウィンドウをアクティブにする @command_window.active = false @status_window.active = true @status_window.index = 0 when 2 # 装備 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータスウィンドウをアクティブにする @command_window.active = false @status_window.active = true @status_window.index = 0 when 3 # ステータス # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータスウィンドウをアクティブにする @command_window.active = false @status_window.active = true @status_window.index = 0 when 4 if $game_system.save_disabled $game_system.se_play($data_system.decision_se) $scene = Scene_End.new else $game_system.se_play($data_system.decision_se) $scene = Scene_Save.new end when 5 # ゲーム終了 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ゲーム終了画面に切り替え $scene = Scene_End.new end return end end #-------------------------------------------------------------------------- # ● フレーム更新 (ステータスウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_status # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # コマンドウィンドウをアクティブにする @command_window.active = true @status_window.active = false @status_window.index = -1 return end # C ボタンが押された場合 if Input.trigger?(Input::C) # コマンドウィンドウのカーソル位置で分岐 case @command_window.index when 1 # スキル # このアクターの行動制限が 2 以上の場合 if $game_party.actors[@status_window.index].restriction >= 2 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # スキル画面に切り替え $scene = Scene_Skill.new(@status_window.index) when 2 # 装備 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 装備画面に切り替え $scene = Scene_Equip.new(@status_window.index) when 3 # ステータス # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # ステータス画面に切り替え $scene = Scene_Status.new(@status_window.index) end return end end end #============================================================================== # ■ Scene_End #------------------------------------------------------------------------------ # ゲーム終了画面の処理を行うクラスです。 #============================================================================== class Scene_End #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main # コマンドウィンドウを作成 s1 = "To Title" s2 = "Shutdown" s3 = "Cancel" @command_window = Window_Command.new(192, [s1, s2, s3]) @command_window.x = 320 - @command_window.width / 2 @command_window.y = 240 - @command_window.height / 2 # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 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 #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # コマンドウィンドウを更新 @command_window.update # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # メニュー画面に切り替え if $game_system.save_disabled $scene = Scene_Menu.new(4) else $scene = Scene_Menu.new(5) end return end # C ボタンが押された場合 if Input.trigger?(Input::C) # コマンドウィンドウのカーソル位置で分岐 case @command_window.index when 0 # タイトルへ command_to_title when 1 # シャットダウン command_shutdown when 2 # やめる command_cancel end return end end #-------------------------------------------------------------------------- # ● コマンド [タイトルへ] 選択時の処理 #-------------------------------------------------------------------------- def command_to_title # 決定 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 = Scene_Title.new 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 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # メニュー画面に切り替え if $game_system.save_disabled $scene = Scene_Menu.new(4) else $scene = Scene_Menu.new(5) end end end This means that if you disable ‘Saving’, then the save option will not be visible. Thanks for looking at my script. I hope that it will be of some use to you, but if it isn’t, then please don’t bash me :hammer: ! It is, after all, only my second attempt. *** Special thanks to Makeamidget for finding my error *** |