VX - VX ACE Conversion - Shanghai's On-Map Item Menu

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
Hi there! I'm not sure if this is difficult or not and I haven't found another alternative yet, but I would like for this script to be converted to work for RMVX ACE.

Shanghai's On Map Item Menu -

Code:
#=============================================================================
# 
# 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,30, 640, 450)
    @column_max = 2
    self.openness = 0
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # * Whether or not to include in item list
  #     item : item
  #--------------------------------------------------------------------------
  def include?(item)
    return false if item == nil
    if $game_temp.in_battle
      return false unless item.is_a?(RPG::Item)
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Whether or not to display in enabled state
  #     item : item
  #--------------------------------------------------------------------------
  def enable?(item)
    return $game_party.item_can_use?(item)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.index = 0 unless @starting
    @starting = true
    @data = []
    for item in $game_party.items
      next unless include?(item)
      @data.push(item)
      if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
        self.index = @data.size - 1
      end
    end
    @data.push(nil) if include?(nil)
    @item_max = @data.size
    self.index = [[self.index, @item_max-1].min, 0].max
    self.height = [[424, @item_max*12+44].min, 56].max # 104

    self.y = 56 #  changed from: self.y = Graphics.height-self.height

    create_contents
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    item = @data[index]
    if item != nil
      number = $game_party.item_number(item)
      enabled = enable?(item)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, sprintf(":%2d", number), 2)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Help Text
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(item == nil ? "" : item.description)
  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 = 255 # changed from 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
      disabled = false # put above 'next' to show 1 item window
      next unless item.is_a?(RPG::Item)
      break
    end
    if disabled

  # ADDED begin

      Sound.play_buzzer

      @on_map_help_window.open
      @on_map_help_window.contents.draw_text(0, 0, 505, 23, 'NO ITEMS', 1)
                                      # text to show in help window when 0 items

      loop do # loop nedded so that help window opens gradually
        update_basic
        @on_map_help_window.update
        if Input.trigger?(Input:: or Input.trigger?(Input::X)
          Sound.play_cancel
          break
        end
      end
      @on_map_help_window.close
      loop do # loop nedded so that help window closes gradually
        break if @on_map_help_window.openness < 1
        update_basic
        @on_map_help_window.update
      end

  # ADDED end

    return
  end

    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_party.consume_item(item)
        break
      elsif Input.trigger?(Input::
        Sound.play_cancel
        break
      end
    end
    @on_map_item_window.close
    @on_map_help_window.close
    loop do

      # condition changed to both to solve timing problem on closing windows
      break if (@on_map_help_window.openness < 1) && (@on_map_item_window.openness < 1)
      # condition changed to both to solve timing problem on closing windows

      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
# 
#=============================================================================
Thank you in advance.
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
This script does nothing other than reduce the item you select by 1...
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
@Xypher - Nope, it makes an item menu pop up on map rather than having to enter through the main menu and stuff, check the script.

Bumping this.
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
test it yourself on vx... it does nothing
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
@xypher: did you have any items in your inventory?

@quigon: as far as I know Tsukihime is thinking of doing something like this ^^
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
I've already converted it but it does absolutely nothing other than reduce the item you select by 1, it does not do anything in vx or vxace.
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
As far as I see the code there will be a window when you have items in your inventory and press the X button (don't know which key that is)
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
And I'm saying the window does nothing other than reduce the item you select by 1.

This is what happens when you select the item



Code:
		  if Input.trigger?(Input::C)
			    Sound.play_decision
			    item = @on_map_item_window.item
			    $game_party.consume_item(item)
			    break


Code:
  def consume_item(item)
    if item.is_a?(RPG::Item) and item.consumable
	  lose_item(item, 1)
    end
  end
 

mobychan

CodeMaster
Veteran
Joined
Mar 23, 2012
Messages
297
Reaction score
45
First Language
German
Primarily Uses
and that's exactly what he wants, isn't it?

He doesn't need to enter the menu, he just needs to press the x button ^^
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
@mobychan - Yeah, that's what I want haha.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
What he means is you're basically throwing the item away.

But I guess that's to be expected, since

The items that show up on the on-map item menu are only items that will begin common events.
 
Last edited by a moderator:

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
What he means is you're basically throwing the item away.

But I guess that's to be expected, since
Yeah but it doesn't check for common events either, and it has the same effect for items with/without common events.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Did you translate it to Ace using VX's original code as reference?

I don't have VX but assuming the script was actually working and did execute common events, I would assume the common event checks were done when the $game_party.consume_item was called.
 

Xypher

Veteran
Veteran
Joined
Apr 1, 2012
Messages
148
Reaction score
26
Primarily Uses
I already posted what consume_item from game_party does a few posts up.
 

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
I'm really not sure what's happening >.< haha.

If there's someone who's wanting to convert this/already has then go ahead, if not I can wait and see if Tsukihime makes something like this.
 

Mr. Bubble

Makes stuff.
Member
Joined
Mar 1, 2012
Messages
853
Reaction score
163
Is there a reason why the "Select Key Item" event command isn't suitable?



If not, Window_KeyItem would be easier to modify than porting that script.
 
Last edited by a moderator:

Quigon

electric boogaloo
Veteran
Joined
Mar 17, 2012
Messages
1,982
Reaction score
954
First Language
English
Primarily Uses
N/A
@Mr. Bubble -

I'm using an ABS and would like the item menu to appear on screen while events are still running. Is it possible to use the key item event and just event my own item screen?
 

Mr. Bubble

Makes stuff.
Member
Joined
Mar 1, 2012
Messages
853
Reaction score
163
@Mr. Bubble -

I'm using an ABS and would like the item menu to appear on screen while events are still running.
This is important information that you should've mentioned in your first post. -_-

Is it possible to use the key item event and just event my own item screen?
I don't know what you want and apparently neither do the other people trying to help you in this thread. You should at least try to see if it works though.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top