Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #======================#
- # Z-Systems by: Zetu #
- #===========================#======================#===========================#
- # * * * Neo Menu System - LITE v1.10 * * * #
- #=#==========================================================================#=#
- # This script allows easy customization to you menu commands. The way it #
- # works is, the array 'MENU_ITEMS' stores all commands and the hash #
- # 'COMMAND' will run the script on that command's selection. If the #
- # COMMAND of the item contains '@status_window.index', then it will #
- # prompt you to select an actor, and if it exists in DISABLES and the #
- # statement is true, then the item will be disabled. #
- #--------------------------------------------------------------------------#
- # From the free customization of this script, you can add/remove/change #
- # order of the menu items. When you add a new item (from another #
- # script), you MUST add a new item in the COMMAND hash. #
- #--------------------------------------------------------------------------#
- # Tip on finding the code within a script: #
- # Use Ctrl+F '$scene ='. This should be able to locate the call method #
- # used in most every script. #
- #==========================================================================#
- module Z_Systems
- module NeoMenu
- # If script includes '@status_window.index', it will prompt you to
- # select an actor.
- MENU_ITEMS = [
- #symbol, label, command $scene = ???
- [:item, "Item", 'Scene_Item.new'],
- [:skill, "Skill", 'Scene_Skill.new(@status_window.index)'],
- [:equip, "Equip", 'Scene_Equip.new(@status_window.index)'],
- [:status, "Status", 'Scene_Status.new(@status_window.index)'],
- [:save, "Save", 'Scene_File.new(true, false, false)'],
- [:endgame, "End", 'Scene_End.new']
- ] # DO NOT REMOVE
- #Expression that tests if script is to be disabled.
- DISABLES = {#Disable option if true.
- #This shows disabling if Save Game is disabled.
- :save => '$game_system.save_disabled',
- #This shows disabling if game switch id 11 if off.
- :examp1 => '$game_switches[11] == false',
- #This shows disabling if variable id 1 is equal to or larger than 8.
- :examp2 => '$game_variables[1] >= 8'
- } # DO NOT REMOVE
- ICONS = { #Optional: Will not display an icon if nil.
- :item => 144,
- :skill => 137,
- :equip => 1,
- :status => 130,
- :save => 200,
- :endgame => 224
- } # DO NOT REMOVE
- # $m_index is last selected menu index (for return scenes)
- #========#======================#====#================================#========#
- #--------# #----# DO NOT EDIT PAST THIS POINT!!! #--------#
- #--------# End of Customization #----# Editing will cause death by #--------#
- #--------# #----# brain asplosions. #--------#
- #========#======================#====#================================#========#
- end
- end
- $zsys = {} if $zsys == nil
- $zsys["Menu"] = true
- module Z
- include Z_Systems::NeoMenu
- def self.menu_symbols
- result = []
- for i in 0...MENU_ITEMS.size
- result.push(MENU_ITEMS[i][0])
- end
- return result
- end
- def self.menu_vocab
- result = []
- for i in 0...MENU_ITEMS.size
- result.push(MENU_ITEMS[i][1])
- end
- return result
- end
- end
- class Scene_Menu < Scene_Base
- include Z_Systems::NeoMenu
- def create_command_window
- $m_index = 0
- @command_window = Window_CommandNMS.new(160, Z::menu_vocab)
- @command_window.index = @menu_index
- zs_nms_disable
- end
- def zs_nms_disable
- if $game_party.members.size == 0
- for i in 0...MENU_ITEMS.size
- command = Z::menu_symbols[i]
- if needs_selection?(i)
- @command_window.draw_item(i, false)
- end
- end
- end
- for i in 0...MENU_ITEMS.size
- command = MENU_ITEMS[i][0]
- if Z_Systems::NeoMenu::DISABLES.key?(command)
- @command_window.draw_item(i, false) if eval(DISABLES[command])
- end
- end
- end
- def needs_selection?(index)
- print index unless index.is_a?(Integer)
- return MENU_ITEMS[index][2].include? '@status_window.index'
- end
- def update_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif Input.trigger?(Input::C)
- selection = MENU_ITEMS[@command_window.index][0]
- if $game_party.members.size == 0 and needs_selection?(@command_window.index)
- Sound.play_buzzer
- return
- elsif DISABLES.key?(selection)
- if eval(DISABLES[selection])
- Sound.play_buzzer
- return
- end
- end
- Sound.play_decision
- if needs_selection?(@command_window.index)
- start_actor_selection
- else
- $m_index = @command_window.index
- $scene = eval(MENU_ITEMS[@command_window.index][2])
- end
- end
- end
- def update_actor_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif Input.trigger?(Input::C)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- $m_index = @command_window.index
- $scene = eval(MENU_ITEMS[@command_window.index][2])
- end
- end
- end
- class Scene_Base
- def dispose_menu_background
- @menuback_sprite.dispose if @menuback_sprite != nil
- end
- end
- #-------------------------------------------------------------------------------
- #Indexing Fix. All default return_scenes have been OVERWRITE
- class Scene_Item < Scene_Base
- def return_scene
- $scene = Scene_Menu.new($m_index)
- end
- end
- class Scene_Skill < Scene_Base
- def return_scene
- $scene = Scene_Menu.new($m_index)
- end
- end
- class Scene_Equip < Scene_Base
- def return_scene
- $scene = Scene_Menu.new($m_index)
- end
- end
- class Scene_Status < Scene_Base
- def return_scene
- $scene = Scene_Menu.new($m_index)
- end
- end
- class Scene_Status < Scene_Base
- def return_scene
- $scene = Scene_Menu.new($m_index)
- end
- end
- class Scene_File < Scene_Base
- def return_scene
- if @from_title
- $scene = Scene_Title.new
- elsif @from_event
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new($m_index)
- end
- end
- end
- #-------------------------------------------------------------------------------
- class Window_CommandNMS < Window_Selectable
- def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
- if row_max == 0
- row_max = (commands.size + column_max - 1) / column_max
- end
- super(0, 0, width, row_max * WLH + 32, spacing)
- @commands = commands
- @item_max = commands.size
- @column_max = column_max
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- if Z_Systems::NeoMenu::ICONS[@commands[index]] != nil
- draw_icon(Z_Systems::NeoMenu::ICONS[@commands[index]], rect.x, rect.y)
- rect.x += 24
- end
- self.contents.draw_text(rect, @commands[index])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement