Special Items Separate Menu
#11
So BASICALLY, there is no difference between the Normal Item menu and the Special Item menu other than one generates a list of items 'except' special items and the other 'only' special items. The two work the same otherwise.

And you may not know this, but you can already call the default Item menu with a script call:
Code:
$scene = Scene_Item.new

Script calls can be made by selecting the very very very very very VERY last option in the list of map events. Winking



So I guess... um...

Code:
#==============================================================================
# ** Simple Second Item Menu
#------------------------------------------------------------------------------
#  This lets you add a feature to show a different selection of items.
#
#------------------------------------------------------------------------------
#
#  The normal Item Menu is typically called like this:
#      $scene = Scene_Item.new
#
#  To call the 'special' Item Menu, call it with this:
#      $scene = Scene_Item.new(true)
#
#------------------------------------------------------------------------------
#
#  Adding it into the default main menu would wish a bit of an edit/addition
#  into the @command_window (line 26 of Scene_Menu), and working a bit of an
#  edit into 'update_command' where the item command is in question  (either
#  adding or editing).
#
#
#==============================================================================


module Special_Items
  
  ITEMS   = [1]   # List of Item IDs from the database
  WEAPONS = []    # List of Weapon IDs from the database
  ARMORS  = []    # List of Armor IDs from the database
  
end



#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
#  This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_Item < Window_Selectable
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Add Special Item flag from Scene
    special = $scene.special
    # Clear the screen
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    @data = []
    # Add item
    for i in 1...$data_items.size
      if $game_party.item_number(i) > 0
        if Special_Items::ITEMS.include?(i) == special
          @data.push($data_items[i])
        end
      end
    end
    # Also add weapons and items if outside of battle
    unless $game_temp.in_battle
      for i in 1...$data_weapons.size
        if $game_party.weapon_number(i) > 0
          if Special_Items::WEAPONS.include?(i) == special
            @data.push($data_weapons[i])
          end
        end
      end
      for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          if Special_Items::ARMORS.include?(i) == special
            @data.push($data_armors[i])
          end
        end
      end
    end
    # If item count is not 0, make a bit map and draw all items
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
end



#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
#  This class performs item screen processing.
#==============================================================================

class Scene_Item
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :special                  # Special Item Menu flag
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     special : command special item feature
  #--------------------------------------------------------------------------
  def initialize(special=false)
    @special = special
  end  
end

That alters the Item system itself so ONE Item menu can do the work of both! Just adding a second Item menu option as described is all you need.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#12
Instead of things like...

Code:
for i in 1...$data_armors.size
        if $game_party.armor_number(i) > 0
          if Special_Items::ARMORS.include?(i) == special
            @data.push($data_armors[i])
          end
        end
      end

It could have been like this...

Code:
1.upto($data_armors.size -1) do |i|
        next if $game_party.armor_number(i) == 0
        next unless Special_Items::ARMORS.include?(i) == special
            @data.push($data_armors[i])
      end

Just my two cents on the way some portions of that script were implemented XD
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#13
Hey since you guys were so kind as to answer, I wanted to respond to this before I go on vacation.
So I'm having this error when I'm trying my event call:

"ArgumentError occurred while running script. wrong number of arguments(1 for 0)"

So yeah, what's an argument and how do I fix it? It's not the usual "error on this line blablabla".
Reply }
#14
That can happen if you have placed this script in your Script Library incorrectly, and/or have another Item Menu script which conflicts.

This script 'assumes' you have no other Item Menu script, and that you have it below Scene_Debug and above Main. If you have another script that also alters the Item Menu, then it would likely need to be placed below the other... something we call 'script placement'.

The script supplied (above) overrides the normal entry of the Scene_Item.new method, adding the ability to have a new value (or parameter) in the way it is called: Scene_Item.new(true). BUT.... if you have another script 'below this one' that alters either the Scene_Item class or the Window_Item class, it overrides THIS script... causing the error.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#15
Ok good now it seems to work with the manual call in an event. Now what do I do to make the items appear in this menu?
Reply }
#16
Ah, that's the beauty of what I did.

In the main menu, ala Scene_Menu, it activates the Item menu with a call like $scene=Scene_Item.new. The rewrite/script allows that statement to still be used, though it would 'remove' all the special items you designate. But if you instead use $scene=Scene_Item.new(true), you only get the special items.

What I am assuming you want is to have 'two' Item menu options in the main menu. This requires that YOU add a new option for the special item menu.

FIRST.... look at the block in Scene_Menu within the main method which looks like this:
Code:
# Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Save"
    s6 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end

This makes the 6 items in your menu. Let's assume you are adding the 2nd item menu below the first item menu... change it to THIS

Code:
# Make command window
    s1 = $data_system.words.item
    s2 = $data_system.words.item
    s3 = $data_system.words.skill
    s4 = $data_system.words.equip
    s5 = "Status"
    s6 = "Save"
    s7 = "End Game"
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # If number of party members is 0
    if $game_party.actors.size == 0
      # Disable items, skills, equipment, and status
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
      @command_window.disable_item(4)
    end
    # If save is forbidden
    if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(5)
    end
This increases the number of options from 6 options to 7



In the update command method, you normally have this:
Code:
# If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
You need to do some changes like this:
Code:
# If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 5
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # THE SPECIAL ITEM!!!!
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new(true)
      when 2  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false

Note that I added a new ITEM option with the 'when 1' block, and changed the Skill to work for 'when 2'. Change all other 'when' values down one more value to match.



Now that you did that, go into the update_status methods and advance all the when values by one as well....
when 2 # Skill
when 3 # equipment
when 4 #status

Hopefully, you can follow this. If you need to add/remove menu options like adding other features like 'party order', 'crafting' or the like, you'd need to know about this. We learn by doing, so I suggest a little practice on a test project. Winking
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#17
Or you, DerVV, could offer him a modified case statement that includes symbols instead of numbers, that would make it easier to identify and make sure every single comparison is as unique as the menues they have to open...
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#18
We learn by doing. And if he needs to adapt the menu a second time, it would be good for him to learn. And in that, in the manner the default scripts are initially written instead of a new style which could confuse.

The instructions I gave display before/after examples. With that, he should see where changes are made within each section so he doesn't just see what to change, but why the change is made. Give him the basics in math before sending him into calculus (which my idiot College Advisor did...Threw me into Calculus II before I ever took Trig.).
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }
#19
Wait, I already know how to add a new menu in the main menu script, but is this the only way to make the special items appear in the second item menu? Because I wanted to try first with only a call in event for starter.


So does that mean the second item menu wont show special items unless it is set in the main menu?
Reply }
#20
The suggestion in adding the second menu which only shows the special items assumed you did not know how to add a new option to the menu.

But it looks like you may not have read the script itself. As I stated on the 19th last month, you could normally bring up the item menu in a script call with:
$scene = Scene_Item.new

And the script which I supplied that same day stated you may use the script call of...
$scene = Scene_Item.new to show items other than special objects, and a script call of ...
$scene = Scene_Item.new(true) which only shows the special objects.

I altered the Item system so just adding (true) to the end of the statement shows only the special items, while it regularly hides them instead.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Need help with my menu - Current issue is item grid layout LilyFrog 41 39,143 09-24-2018, 02:03 AM
Last Post: LilyFrog
   Sorting Items in Shop Window Mel 13 17,617 01-18-2018, 05:49 AM
Last Post: DerVVulfman
Question  Mog Menu script: help me stop the crazy picture movement during transitions Zachariad 4 9,800 05-31-2017, 05:10 AM
Last Post: Zachariad
   XAIL MENU from RPG VX ACE to RPG XP RASHIDA12 46 51,917 05-02-2016, 08:08 PM
Last Post: RASHIDA12
Tongue  Healing Spell doesn't work right in Menu? Bounty Hunter Lani 8 12,436 01-15-2015, 07:45 PM
Last Post: Bounty Hunter Lani
   My Options Menu needs help firestalker 0 3,276 08-11-2014, 02:31 PM
Last Post: firestalker
   Vx Ace Custom Menu help? Skitzen 1 5,378 10-07-2013, 03:10 PM
Last Post: JayRay
   Dargor's Large Party script and shop menu Simon Greedwell 2 6,549 08-28-2013, 10:12 PM
Last Post: Simon Greedwell
   Help with Shop Menu [RPG Maker XP] JackMonty 6 12,904 05-23-2013, 10:14 AM
Last Post: JackMonty
Brick Sub-menu Tab Iqus 5 9,267 01-23-2013, 02:01 PM
Last Post: Pherione



Users browsing this thread: 3 Guest(s)