Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - On-Map Item Menu
- # Last Date Updated: 2010.06.20
- # Level: Normal
- #
- # This script allows the player to access the on-map item menu by pressing the
- # A button on the keyboard. The items that show up on the on-map item menu are
- # only items that will begin common events.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["On-MapItemMenu"] = true
- #==============================================================================
- # ** Window_Map_Item
- #==============================================================================
- class Window_Map_Item < Window_Item
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 240, 128)
- self.openness = 0
- self.active = false
- end
- #--------------------------------------------------------------------------
- # * Refresh
- #--------------------------------------------------------------------------
- def refresh
- @column_max = 1
- self.index = 0 unless @starting
- @starting = true
- @data = []
- for item in $game_party.items
- next unless include?(item)
- @data.push(item)
- end
- @item_max = @data.size
- self.index = [[self.index, @item_max-1].min, 0].max
- self.height = [[128, @item_max*24+32].min, 56].max
- self.y = Graphics.height-self.height
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # * Whether or not to include in item list
- #--------------------------------------------------------------------------
- def include?(item)
- return false if item.nil?
- return false unless item.is_a?(RPG::Item)
- return false if item.common_event_id == 0
- return true
- end
- end
- #==============================================================================
- # ** Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- alias start_sss_on_map_item_menu start unless $@
- def start
- start_sss_on_map_item_menu
- @on_map_help_window = Window_Help.new
- @on_map_item_window = Window_Map_Item.new
- @on_map_item_window.help_window = @on_map_help_window
- @on_map_help_window.opacity = 0
- @on_map_help_window.openness = 0
- end
- #--------------------------------------------------------------------------
- # * Termination Processing
- #--------------------------------------------------------------------------
- alias terminate_sss_on_map_item_menu terminate unless $@
- def terminate
- unless @on_map_item_window.nil?
- @on_map_item_window.dispose
- @on_map_item_window = nil
- @on_map_help_window.dispose
- @on_map_help_window = nil
- end
- terminate_sss_on_map_item_menu
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- alias update_on_map_item_menu update unless $@
- def update
- update_on_map_item_menu
- if not $game_message.visible and not $game_map.interpreter.running?
- map_item_window if Input.trigger?(Input::X)
- end
- end
- #--------------------------------------------------------------------------
- # * Update Map Item Window
- #--------------------------------------------------------------------------
- def map_item_window
- disabled = true
- for item in $game_party.items
- next unless item.is_a?(RPG::Item)
- next unless item.common_event_id >= 0
- disabled = false
- break
- end
- return if disabled
- if $imported["LocationName"]
- hidden_location_name = $game_system.hide_location_name
- $game_system.hide_location_name = true
- end
- Sound.play_decision
- @on_map_item_window.refresh
- @on_map_item_window.open
- @on_map_help_window.open
- @on_map_item_window.active = true
- loop do
- update_basic
- @on_map_help_window.update
- @on_map_item_window.update
- if Input.trigger?(Input::C)
- Sound.play_decision
- item = @on_map_item_window.item
- $game_temp.common_event_id = item.common_event_id
- $game_party.consume_item(item)
- break
- elsif Input.trigger?(Input::B)
- Sound.play_cancel
- break
- end
- end
- @on_map_item_window.close
- @on_map_help_window.close
- loop do
- break if @on_map_item_window.openness < 1
- update_basic
- @on_map_help_window.update
- @on_map_item_window.update
- end
- if $imported["LocationName"]
- $game_system.hide_location_name = hidden_location_name
- end
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement