Introduction Very basic main menu script that would probably go great with adventure games.
Features This script is pretty much what it says on the tin. It just has a small command window and a gold window.
Script
Munkis' Simple Main Menu
CODE
#------------------------------------------------------------------------------ # * Munkis' Simple Menu V 1.0 # * Made by munkis by request for Deadbox # •”•••••••••••— # •‘ FEATURES •‘ # •š••••••••••• # * Basically this reduces the main menu to a very basic command window. # * OVERWRITES Scene_Menu! # * V 1.0: Initial release #------------------------------------------------------------------------------
#[module] module MNK_SimpleMenu
MENU_TEXT = ["Resume","Inventory","Exit"]
#Change where the player goes when they select "Exit". #0 = To Title. #1 = To the Scene_End Menu. #2 = Exit completely.
EXIT_TYPE = 1
#The first two numbers in this array CANNOT be zero or negative. The last #three can, however. But setting the opacity to a negative number won't make #it any more transparent. #CHOICE_WINDOW_DIM = [width, columns, center_x, center_y, opacity]
CHOICE_WINDOW_DIM = [175,1,-3,0,0]
#[show gold window,X,Y co-ordinates and opacity of the gold window]
GOLD_WINDOW = [false,191,260,0]
end #[/module]
class Scene_Menu < Scene_Base #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super create_menu_background create_command_window if MNK_SimpleMenu::GOLD_WINDOW[3] == true @gold_window = Window_Gold.new(MNK_SimpleMenu::GOLD_WINDOW[1], MNK_SimpleMenu::GOLD_WINDOW[2]) @gold_window.opacity = MNK_SimpleMenu::GOLD_WINDOW[3] end end #-------------------------------------------------------------------------- # * Post-Start Processing #-------------------------------------------------------------------------- def post_start super open_command_window end #-------------------------------------------------------------------------- # * Pre-termination Processing #-------------------------------------------------------------------------- def pre_terminate super close_command_window end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super dispose_command_window dispose_menu_background @gold_window.dispose if MNK_SimpleMenu::GOLD_WINDOW[3] == true end #-------------------------------------------------------------------------- # * Return to Original Screen #-------------------------------------------------------------------------- def return_scene $scene = Scene_Map.new end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super update_menu_background @command_window.update @gold_window.refresh if MNK_SimpleMenu::GOLD_WINDOW[3] == true if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) case @command_window.index when 0 # to title command_resume when 1 # shutdown command_inventory when 2 # quit command_quit end end end #-------------------------------------------------------------------------- # * Update Background for Menu Screen #-------------------------------------------------------------------------- def update_menu_background super @menuback_sprite.tone.set(0, 0, 0, 128) end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window s1 = MNK_SimpleMenu::MENU_TEXT[0] s2 = MNK_SimpleMenu::MENU_TEXT[1] s3 = MNK_SimpleMenu::MENU_TEXT[2] @command_window = Window_Command.new(MNK_SimpleMenu::CHOICE_WINDOW_DIM[0], [s1, s2, s3], MNK_SimpleMenu::CHOICE_WINDOW_DIM[1]) @command_window.x = (544 - @command_window.width + MNK_SimpleMenu::CHOICE_WINDOW_DIM[2]) / 2 @command_window.y = (416 - @command_window.height + MNK_SimpleMenu::CHOICE_WINDOW_DIM[3]) / 2 @command_window.openness = 0 @command_window.opacity = MNK_SimpleMenu::CHOICE_WINDOW_DIM[4] end #-------------------------------------------------------------------------- # * Dispose of Command Window #-------------------------------------------------------------------------- def dispose_command_window @command_window.dispose end #-------------------------------------------------------------------------- # * Open Command Window #-------------------------------------------------------------------------- def open_command_window @command_window.open begin @command_window.update Graphics.update end until @command_window.openness == 255 end #-------------------------------------------------------------------------- # * Close Command Window #-------------------------------------------------------------------------- def close_command_window @command_window.close begin @command_window.update Graphics.update end until @command_window.openness == 0 end #-------------------------------------------------------------------------- # * Process When Choosing [Resume] Command #-------------------------------------------------------------------------- def command_resume Sound.play_decision return_scene end #-------------------------------------------------------------------------- # * Process When Choosing [Inventory] Command #-------------------------------------------------------------------------- def command_inventory Sound.play_decision $scene = Scene_Item.new end #-------------------------------------------------------------------------- # * Process When Choosing [Exit] Command #-------------------------------------------------------------------------- def command_quit if MNK_SimpleMenu::EXIT_TYPE == 0 Sound.play_decision RPG::BGM.fade(800) RPG::BGS.fade(800) RPG::ME.fade(800) $scene = Scene_Title.new close_command_window Graphics.fadeout(60) elsif MNK_SimpleMenu::EXIT_TYPE == 1 Sound.play_decision $scene = Scene_End.new elsif MNK_SimpleMenu::EXIT_TYPE == 2 Sound.play_decision RPG::BGM.fade(800) RPG::BGS.fade(800) RPG::ME.fade(800) $scene = nil end end end
Customization You can change the menu command text, where you end up when you select the "exit" command, the dimensions of the command window, and a few properties of the gold window.
Compatibility Overwrites Scene_Menu.
Screenshot
DEMO The script is pretty simple to use, so a demo shouldn't be necessary.
Installation Place in MATERIALS, above MAIN.
FAQ Q: ZOMG teh scriptz doesn't werk!!! A: First of all, be more specific. Second, all reports typed in chat-speak or 1337-speak will be ignored.
Terms and Conditions I don't mind this script being posted or linked on other sites AS LONG AS YOU GIVE CREDIT!!! Same goes for using this in your project. Contact me if you want to use this in a commercial project.
Credits Credit me (munkis).
This post has been edited by munkis: Jan 11 2011, 11:45 AM