[VX ACE/RGSS3] - Item/Custom Scene - Bypass "Category" selection

ZirconStorms

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
First Language
English
Primarily Uses
RMVXA
Script will be attached below. The original script (author: soulpour777):
http://www.rpgmakercentral.com/topic/31412-a-seperate-item-menu-for-a-custom-item-type/

Note that this scene is seperate from the default item menu. I wish to bypass the player selecting the item type through the category window, letting them select from the items available immediately. I've already assigned the return_scene method whenever the player cancels item selection (which would, ideally, be the player cancelling out of the menu entirely).
Just need some idea on where to start in order to attempt this modification, if it's even possible.

Code:
# SOURCE AND ORIGINAL SCRIPT: Soulpour777
# http://www.rpgmakercentral.com/topic/31412-a-seperate-item-menu-for-a-custom-item-type/
# --------------------------------------------------------------------------
module Soulpour
  module MailingList
    Battle_Item_RegEx = /<battle_item>/i
    Battle_Item_Name = "Extra_Item"
  end
end

class Window_CategMail < Window_HorzCommand
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :item_window
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    Graphics.width
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 4
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    @item_window.category = current_symbol if @item_window
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_command(Soulpour::MailingList::Battle_Item_Name, :mail_item)
  end
  #--------------------------------------------------------------------------
  # * Set Item Window
  #--------------------------------------------------------------------------
  def item_window=(item_window)
    @item_window = item_window
    update
  end
end

class Window_MailingList < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    @category = :none
    @data = []
  end
  #--------------------------------------------------------------------------
  # * Set Category
  #--------------------------------------------------------------------------
  def category=(category)
    return if @category == category
    @category = category
    refresh
    self.oy = 0
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 2
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  #--------------------------------------------------------------------------
  # * Get Activation State of Selection Item
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  #--------------------------------------------------------------------------
  # * Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      item.is_a?(RPG::Item)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  #--------------------------------------------------------------------------
  # * Display in Enabled State?
  #--------------------------------------------------------------------------
  def enable?(item)
    $game_party.usable?(item)
  end
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_mailing_list_items
    @data = $game_party.all_items.select {|item| item.note =~ Soulpour::MailingList::Battle_Item_RegEx }
    @data.push(nil) if include?(nil)
  end
  #--------------------------------------------------------------------------
  # * Restore Previous Selection Position
  #--------------------------------------------------------------------------
  def select_last
    select(@data.index($game_party.last_item.object) || 0)
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enable?(item))
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    make_mailing_list_items
    create_contents
    draw_all_items
  end
end

class Scene_BattleItems < Scene_ItemBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    create_category_window
    create_item_window
  end
  #--------------------------------------------------------------------------
  # * Create Category Window
  #--------------------------------------------------------------------------
  def create_category_window
    @category_window = Window_CategMail.new
    @category_window.viewport = @viewport
    @category_window.y = 10
    @category_window.set_handler(:ok,     method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end
  #--------------------------------------------------------------------------
  # * Create Item Window
  #--------------------------------------------------------------------------
  def create_item_window
    wy = 100
    wh = 200
    @item_window = Window_MailingList.new(0, wy, 640, wh)
    @item_window.viewport = @viewport
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:return_scene))
    @category_window.item_window = @item_window
  end
  #--------------------------------------------------------------------------
  # * Category [OK]
  #--------------------------------------------------------------------------
  def on_category_ok
    @item_window.activate
    @item_window.select_last
  end
  #--------------------------------------------------------------------------
  # * Item [OK]
  #--------------------------------------------------------------------------
  def on_item_ok
    $game_party.last_item.object = item
    determine_item
  end
  #--------------------------------------------------------------------------
  # * Item [Cancel]
  #--------------------------------------------------------------------------
  def on_item_cancel
    @item_window.unselect
    @category_window.activate
  end
  #--------------------------------------------------------------------------
  # * Play SE When Using Item
  #--------------------------------------------------------------------------
  def play_se_for_item
    Sound.play_use_item
  end
  #--------------------------------------------------------------------------
  # * Use Item
  #--------------------------------------------------------------------------
  def use_item
    super
    @item_window.redraw_current_item
  end
end

class Window_ItemList < Window_Selectable
  attr_accessor :only_if_noted
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super
    @category = :none
    @data = []
    @only_if_noted = false
  end
  #--------------------------------------------------------------------------
  # * Set Category
  #--------------------------------------------------------------------------
  def category=(category)
    return if @category == category
    @category = category
    refresh
    self.oy = 0
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 2
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  #--------------------------------------------------------------------------
  # * Get Activation State of Selection Item
  #--------------------------------------------------------------------------
  def current_item_enabled?
    enable?(@data[index])
  end
  #--------------------------------------------------------------------------
  # * Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    case @category
    when :item
      @only_if_noted = true
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      @only_if_noted = true
      item.is_a?(RPG::Weapon)
    when :armor
      @only_if_noted = true
      item.is_a?(RPG::Armor)
    when :key_item
      @only_if_noted = true
      item.is_a?(RPG::Item) && item.key_item?
    else
      false
    end
  end
  #--------------------------------------------------------------------------
  # * Display in Enabled State?
  #--------------------------------------------------------------------------
  def enable?(item)
    $game_party.usable?(item)
  end
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) && !(item.note =~ Soulpour::MailingList::Battle_Item_RegEx) }
    @data.push(nil) if include?(nil)
  end
end

class Window_EquipItem < Window_ItemList
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) }
    @data.push(nil) if include?(nil)
  end 
  #--------------------------------------------------------------------------
  # * Overwrite Refresh
  #-------------------------------------------------------------------------- 
  def refresh
    make_item_list
    create_contents
    draw_all_items   
  end
end
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,661
Reaction score
563
First Language
English
Primarily Uses
RMVXA

ZirconStorms

Veteran
Veteran
Joined
Dec 22, 2014
Messages
359
Reaction score
111
First Language
English
Primarily Uses
RMVXA
What you are requesting sounds similar to other posts before you.

How many actors are in your game? https://forums.rpgmakerweb.com/inde...tem-automatically-force-it-to-player-1.75598/

I do not know if this removes all category windows. https://forums.rpgmakerweb.com/inde...nk-storage-edit-remove-category-window.73086/

If what you need is different from these posts, then please describe more and maybe @vFoggy can help.
Thanks for the reply-

I do not need to bypass/remove actor selection when using an item, as I set all items to scope: none. The second link isn't applicable, as I'm not using Galv's script nor am I intending on using the "bank/item storage" script.

When opening this scene, there is a category display, in this case, called "Extra_Item". Pressing that "extra_item" command will allow the activation of the item scene (containing all items marked as part of the "Extra_Item" category).

I've attempted to incorporate some code by Sixth in this script, which is meant to remove category windows. Doing so has removed the category window, but no items marked as "Extra_Items" are displayed. You can still freely exit and enter this scene with this modification, however.

If you wish to attempt using this script and opening the scene for yourself, use "SceneManager.call(Scene_BattleItems)" in a script call, tag items with <battle_item> inside the item's note box (database > bottom right corner of an item page), and add those items before using the script call.


# SOURCE AND ORIGINAL SCRIPT: Soulpour777
# http://www.rpgmakercentral.com/topic/31412-a-seperate-item-menu-for-a-custom-item-type/
# MODIFICATION: Added script lines, originally written by Sixth
# https://forums.rpgmakerweb.com/index.php?threads/remove-item-category-window.61260/
# This script is a WIP. It will not work for your project properly.
# --------------------------------------------------------------------------
module Soulpour
module MailingList
Battle_Item_RegEx = /<battle_item>/i
Battle_Item_Name = "Extra_Item"
end
end

class Window_CategMail < Window_HorzCommand
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0)
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
Graphics.width
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 4
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
@item_window.category = current_symbol if @item_window
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_command(Soulpour::MailingList::Battle_Item_Name, :mail_item)
end
#--------------------------------------------------------------------------
# * Set Item Window
#--------------------------------------------------------------------------
def item_window=(item_window)
@item_window = item_window
update
end
end

class Window_MailingList < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data = []
end
#--------------------------------------------------------------------------
# * Set Category
#--------------------------------------------------------------------------
def category=(category)
return if @category == category
@category = category
refresh
self.oy = 0
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# * Get Activation State of Selection Item
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# * Include in Item List?
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
item.is_a?(RPG::Item)
#~ when :key_item
#~ item.is_a?(RPG::Item) && item.key_item?
else
false
end
end
#--------------------------------------------------------------------------
# * Display in Enabled State?
#--------------------------------------------------------------------------
def enable?(item)
$game_party.usable?(item)
end
#--------------------------------------------------------------------------
# * Create Item List
#--------------------------------------------------------------------------
def make_mailing_list_items
@data = $game_party.all_items.select {|item| item.note =~ Soulpour::MailingList::Battle_Item_RegEx }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# * Restore Previous Selection Position
#--------------------------------------------------------------------------
def select_last
select(@data.index($game_party.last_item.object) || 0)
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
if item
rect = item_rect(index)
rect.width -= 4
draw_item_name(item, rect.x, rect.y, enable?(item))
end
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
make_mailing_list_items
create_contents
draw_all_items
end
end

class Scene_BattleItems < Scene_ItemBase
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
create_category_window
create_item_window
end
#--------------------------------------------------------------------------
# * Create Category Window
#--------------------------------------------------------------------------
def create_category_window
# Removed!
end
#--------------------------------------------------------------------------
# * Create Item Window
#--------------------------------------------------------------------------
def create_item_window
wy = 100
wh = 200
#~ Graphics.width = 400
@item_window = Window_MailingList.new(0, wy, 640, wh)
@item_window.viewport = @viewport
@item_window.set_handler:)ok, method:)on_item_ok))
@item_window.set_handler:)cancel, method:)return_scene))
@item_window.activate
@item_window.select_last
end

#--------------------------------------------------------------------------
# * Category [OK]
#--------------------------------------------------------------------------
def on_category_ok
@item_window.activate
@item_window.select_last
end
#--------------------------------------------------------------------------
# * Item [OK]
#--------------------------------------------------------------------------
def on_item_ok
$game_party.last_item.object = item
determine_item
end
#--------------------------------------------------------------------------
# * Item [Cancel]
#--------------------------------------------------------------------------
def on_item_cancel
return_scene
end
#--------------------------------------------------------------------------
# * Play SE When Using Item
#--------------------------------------------------------------------------
def play_se_for_item
Sound.play_use_item
end
#--------------------------------------------------------------------------
# * Use Item
#--------------------------------------------------------------------------
def use_item
super
@item_window.redraw_current_item
end
end

class Window_ItemList < Window_Selectable
attr_accessor :only_if_noted
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@category = :none
@data = []
@only_if_noted = false
end
#--------------------------------------------------------------------------
# * Set Category
#--------------------------------------------------------------------------
def category=(category)
return if @category == category
@category = category
refresh
self.oy = 0
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
def col_max
return 2
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
@data && index >= 0 ? @data[index] : nil
end
#--------------------------------------------------------------------------
# * Get Activation State of Selection Item
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# * Include in Item List?
#--------------------------------------------------------------------------
def include?(item)
case @category
when :item
@only_if_noted = true
item.is_a?(RPG::Item) && !item.key_item?
when :weapon
@only_if_noted = true
item.is_a?(RPG::Weapon)
when :armor
@only_if_noted = true
item.is_a?(RPG::Armor)
when :key_item
@only_if_noted = true
item.is_a?(RPG::Item) && item.key_item?
else
false
end
end
#--------------------------------------------------------------------------
# * Display in Enabled State?
#--------------------------------------------------------------------------
def enable?(item)
$game_party.usable?(item)
end
#--------------------------------------------------------------------------
# * Create Item List
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) && !(item.note =~ Soulpour::MailingList::Battle_Item_RegEx) }
@data.push(nil) if include?(nil)
end
end

class Window_EquipItem < Window_ItemList
#--------------------------------------------------------------------------
# * Create Item List
#--------------------------------------------------------------------------
def make_item_list
@data = $game_party.all_items.select {|item| include?(item) }
@data.push(nil) if include?(nil)
end
#--------------------------------------------------------------------------
# * Overwrite Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
end
 

vFoggy

Veteran
Veteran
Joined
Nov 3, 2012
Messages
71
Reaction score
31
Primarily Uses
The edit I wrote for Galv's script could give you an idea on how to edit the Customer Item script to skip the category selection (ignoring the class Window_BankGive < Window_ItemList).
You will need to add some extra methods to class Scene_BattleItems < Scene_ItemBase from Scene_ItemBase that soulpour777 hasn't.
Basically what you need to do is:
  1. Make the category window not visible
  2. Skip the category selection by activating the items window instead of the category after initializing the window
  3. When leaving the window skip the activation of category window
I can't check the modified code because the colons and parentheses are converted to smilies.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,883
Messages
1,017,232
Members
137,607
Latest member
Maddo
Top