More of the Same Item Stacks

Hi there!

So I'm in the process of making an ACE game with a foraging system - and thus, the player would be gathering lots of the same items. Therefore, I need a script that would modify the item menu, more specifically, how the item instances stack :

Upon reaching the maximum instance of an item stack (99), another stack of the same item would be created.​

Sorry if this sounds confusing, here's a visual of what I'm trying to achieve:
Untitled-1.png


I'm sorry if the feature had been requested before. But thank you very much for taking your time to read this.
https://yanflychannel.wordpress.com/rmvxa/core-scripts/adjust-limits/

Hi Ebanyle, thank you so much for your suggestion. I have look into some of these scripts that adjust item limits but they're not what I'm looking for. I'm looking for a script that creates a new "stack" of the same item upon reaching its maximum limit.

I really appreciate your help tho.
The problem is, for this to happen you'd also need someone to be able to break the item limit of 999 items, which I don't think can be done in ACE. The reason is, an item stack does a reference to a location in the database, so to get a new stack you'd have to create new references in the database, which will run into errors when you try to go over the 999 limit (which WILL happen if you have enough stacks of 99).

The best solution is to use the script referenced and let the stacks go over 99.
Hey, that makes a lot of sense. Thank you very much for your response, I will call it solved for now.
Not a problem. The only way I could see to do this in ACE is to fake stacks, as in, the menu shows more stacks but the database does it in one reference. But that would require a full menu rewrite at minimum, and shop rewrite too...and there might be more than that, but that is what I can think of off the top of my head.

If you want to leave it open to see if someone can do that, or make a script that will let you have stacks if the item limit of 999 isn't reached feel free though. If not, or you'd rather just use the Yanfly script posted, let us know and one of us will close this out.
Well that sounds horribly complicated. But I have high hope for sure. So for now, if you don't mind, I would like to keep this thread open.
Thank you again for your help!
I kind of figured it could be done if someone make a script similar to instance items with grouping like normal.
It might be something you could ask to be commissioned in the script commission section.
Ooh thanks, I'll definitely take a look at Hime's Instance Items, assuming this is what you're talking about.
And I appreciate the suggestion but can I ask where can I commission for a script?
Ooh thanks, I'll definitely take a look at Hime's Instance Items, assuming this is what you're talking about.
And I appreciate the suggestion but can I ask where can I commission for a script?
https://forums.rpgmakerweb.com/index.php?threads/counting-instance-items-in-shop.17291/
https://forums.rpgmakerweb.com/index.php?threads/individual-item-count.16377/#post-167617
Judging from this user + the date of their post(s), this can be done with pre-made stuff to an extent. Seems they managed to do something with Instance Items but they also seem to have used Instance Items by Enelvon. So the good news is that you might not have to commission someone just yet.

The script's broken though. (I found an old ver. of Enelvon's core script)
Core:

Maybe someone can go ahead and format Enelvon's instance items properly.

Broken code for Enelvon's Instance Items (somewhat fixed the description, didn't tamper past the module)
Code:
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ § Instance Items (v1.3) by Enelvon [License: CC BY-SA 3.0]
# ║ <RMVX Ace>
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Change Log
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ v1.0 (December 25th, 2012) - Released the script for the first time
# ║ v1.1 (December 26th, 2012) - Fixed a single-word error that could cause
# ║ issues with non-unique armor
# ║ v1.2 (February 16th, 2013) - Added the ability to check if an item is
# ║ instanced
# ║ v1.3 (February 17th, 2013) - Fixed a bug with equipping items
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Summary
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ This script adds the ability to have 'instances' of items. Each instance may
# ║ have slightly different stats/effects than the base item. This script
# ║ contains only the ability to have stat variance on equip items - it is
# ║ intended to be extended by others in order to add more features.
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Required Scripts
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ SES Core
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Known Incompatibilities
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ None.
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Installation
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ Place this below Materials and the SES Script Core, and above all other
# ║ non-SES custom scripts (though make sure it's above any Instance Item
# ║ extensions).
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Configuration
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ There is some simple configuration required to use this script. Locate
# ║ All_Unique in the SES::InstanceItems module (that should not be hard - it's
# ║ at the top of the script). Change the value of each key to change whether or
# ║ not items of that type will be treated as unique by default.
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Tags
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● Weapon/Armor
# ║ <Unique>
# ║ Placing this in the Notes box of an item will toggle uniqueness. If its
# ║ item type defaults to being unique, the item will be nonunique. If the
# ║ item type defaults to nonunique, the item will be unique.
# ║
# ║ <Vary !Stat!: !Value!, !Chance!>
# ║ Place this in a Notes box to set a variance of !Value! for !Stat!.
# ║ !Chance is the likelihood (as a percentage) that variance will occur.
# ║ This is a very basic implementation of variance - created items of the
# ║ type will have a value of up to the given number added or subtracted
# ║ from their base value for the stat. Don't expect it to work miracles,
# ║ just for it to work.
# ║ ► Replacements:
# ║ !Stat! with hp, mp, atk, def, mat, mdf, agi, or luk.
# ║ !Value! with an integer for the maximum variance of the stat.
# ║ !Chance! with a percentage chance of variance occurring║
# ║ ● Item
# ║ <Unique>
# ║ Placing this in the Notes box of an item will toggle uniqueness. If its
# ║ item type defaults to being unique, the item will be nonunique. If the
# ║ item type defaults to nonunique, the item will be unique.
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Aliased Methods
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● module DataManager
# ║ self.create_game_objects
# ║ self.make_save_contents
# ║ self.extract_save_contents
# ║
# ║ ● class Game_BaseItem
# ║ initialize
# ║
# ║ ● class Game_Party
# ║ gain_item - as trade_item so instancing can be avoided
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Redefined Methods
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● class Game_BaseItem
# ║ object
# ║ set_equip(is_weapon, item_id, unique)
# ║
# ║ ● class Game_Actor
# ║ equips_include?(item)
# ║ init_equips(equips)
# ║ trade_item_with_party(new_item, old_item)
# ║ change_equip_by_id(slot_id, item_id)
# ║
# ║ ● class Game_Party
# ║ gain_item(item, amount, include_equip = false)
# ║ lose_item(item, amount, include_equip = false)
# ║
# ║ ● class Window_ItemList
# ║ draw_item(index)
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § New Methods
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● class Game_Party
# ║ new_item(item, type)
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ ▼ module SES::InstanceItems
#═╩═════════════════════════════════════════════════════════════════════════════
module SES module InstanceItems
#═╦═══════════════════════════════════════════════════════════════════════════
# ║ α BEGIN CONFIGURATION
#═╩═══════════════════════════════════════════════════════════════════════════
# The hash defining the base uniqueness value of each type of item. Setting
# one of these to true makes items of the given type be true by default.
# Setting it to false will have them default to nonunique, as in base VXAce.
All_Unique = { RPG::Weapon => false, RPG::Armor => true, RPG::Item => true, }
#═╦═══════════════════════════════════════════════════════════════════════════
# ║ Ω END CONFIGURATION
#═╩═══════════════════════════════════════════════════════════════════════════
# RegExp for toggling uniqueness of an item.
Unique = /^<Unique>/i
# RegExp for stat variance.
StatVariance = /^<Vary (\w+):\s*(\d+),\s*(\d+)%?>/i
# List of stat indices. You can add custom stats to this to allow them to
# be varied, but the custom stats must be added to the game as part of the
# params array for this to have any effect.
StatIndex = ['hp', 'mp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk']
end
end
($imported ||= {})["SES - Instance Items"] = 1.0
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ module SES::InstanceItems
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class RPG::BaseItem
#═╩═════════════════════════════════════════════════════════════════════════════
class RPG::BaseItem attr_accessor :old_id; attr_accessor :instanced def unique; scan_ses_notes if !@unique; return @unique endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class RPG::BaseItem#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ class RPG::EquipItem#═╩═════════════════════════════════════════════════════════════════════════════class RPG::EquipItem < RPG::BaseItem # Scans the notes box of the item alias en_ii_ei_ssn scan_ses_notes def scan_ses_notes(tags = {}) @variances = [[0,100]] * 8 @unique = SES::InstanceItems::All_Unique[self.class] tags[SES::InstanceItems::StatVariance] = "stat = SES::InstanceItems::StatIndex.index($1.to_s.downcase) @variances[stat] = [$2.to_i, $3.to_i]" tags[SES::InstanceItems::Unique] = "@unique = !@unique" en_ii_ei_ssn(tags) end def variances; scan_ses_notes if !@variances; return @variances end # Allows basic variance def vary unless @varied ([email hidden]).each do |i| v = rand(variances[0]).to_i; v *= -1 if rand(8) <= 3 @params += v if rand(100) < variances[1] end @varied = true end endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class RPG::EquipItem#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ class RPG::Item#═╩═════════════════════════════════════════════════════════════════════════════class RPG::Item < RPG::UsableItem # Scans the Notes box of the item alias en_ii_i_ssn scan_ses_notes def scan_ses_notes(tags = {}) @unique = SES::InstanceItems::All_Unique[self.class] tags[SES::InstanceItems::Unique] = "@unique = !@unique" en_ii_i_ssn(tags) endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class RPG::Item#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ module DataManager#═╩═════════════════════════════════════════════════════════════════════════════module DataManager class << self alias en_fs_dm_cgo create_game_objects alias en_fs_dm_msc make_save_contents alias en_fs_dm_esc extract_save_contents end def self.create_game_objects en_fs_dm_cgo $game_armors, $game_weapons, $game_items = $data_armors, $data_weapons, $data_items end def self.make_save_contents contents = en_fs_dm_msc contents[:armors], contents[:weapons], contents[:items] = $game_armors, $game_weapons, $game_items contents end def self.extract_save_contents(contents) en_fs_dm_esc(contents) $game_armors, $game_weapons, $game_items = contents[:armors], contents[:weapons], contents[:items] endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ module DataManager#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ class Game_BaseItem#═╩═════════════════════════════════════════════════════════════════════════════class Game_BaseItem alias en_ii_gbi_i initialize def initialize en_ii_gbi_i @unique = false end def object id = @item_id return $data_skills[@item_id] if is_skill? if is_item? then return $game_items[id] elsif is_weapon? then return $game_weapons[id] elsif is_armor? then return $game_armors[id] end return nil end def set_equip(is_weapon, item_id, unique = false) @class = is_weapon ? RPG::Weapon : RPG::Armor @item_id = item_id @unique = unique endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class Game_BaseItem#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ class Game_Actor#═╩═════════════════════════════════════════════════════════════════════════════class Game_Actor < Game_Battler def equips_include?(item) equips.compact.each do |e| return true if e.old_id == item.id && e.class == item.class end return false end def init_equips(equips) @equips = Array.new(equip_slots.size) { Game_BaseItem.new } equips.each_with_index do |item_id, i| etype_id = index_to_etype_id(i) slot_id = empty_slot(etype_id) if etype_id == 0 then i, t = $data_weapons[item_id], :weapon else i, t = $data_armors[item_id], :armor end if !i.nil? && i.unique then id, u = $game_party.new_item(i, t).id, true elsif i.nil? then id, u = 0, false else id, u = i.id, false end @equips[slot_id].set_equip(etype_id == 0, id, u) if slot_id end refresh end def trade_item_with_party(new_item, old_item) return false if new_item && !$game_party.has_item?(new_item) $game_party.trade_item(old_item, 1) $game_party.lose_item(new_item, 1) return true end def change_equip_by_id(slot_id, item_id) if equip_slots[slot_id] == 0 change_equip(slot_id, $game_weapons[item_id]) else change_equip(slot_id, $game_armors[item_id]) end endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class Game_Actor#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ class Game_Party#═╩═════════════════════════════════════════════════════════════════════════════class Game_Party < Game_Unit alias trade_item gain_item def new_item(item, type) newi = Marshal.load(Marshal.dump(item)) newi.old_id = item.id newi.instanced = true newi.id = eval("$game_#{type}s.size") newi = process_new_item(newi) eval("$game_#{type}s.push(newi) $game_#{type}s[newi.id].vary unless type == :item return $game_#{type}s[newi.id]") end def process_new_item(item) return item end [:items, :weapons, :armors].each do |i| define_method(i) do eval("@#{i}.keys.sort.collect { |id| $game_#{i}[id] }") end end def gain_item(*args) oitem = args[0] if !args[0].nil? args[1].times do item = oitem if item && item.unique args[0] = if item.is_a?(RPG::Weapon) then new_item(item, :weapon) elsif item.is_a?(RPG::Armor) then args[0] = new_item(item, :armor) elsif item.is_a?(RPG::Item) then args[0] = new_item(item, :item) end end trade_item(args[0], 1) end end def lose_item(*args) args[1] *= -1 trade_item(*args) endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class Game_Party#─╫─────────────────────────────────────────────────────────────────────────────# ║ ▼ class Window_ItemList#═╩═════════════════════════════════════════════════════════════════════════════class Window_ItemList < Window_Selectable 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)) draw_item_number(rect, item) unless item.unique end endend#═╦═════════════════════════════════════════════════════════════════════════════# ║ ▲ class Window_ItemList#═╩═════════════════════════════════════════════════════════════════════════════
YES, thank you thank you. This looks the scripts I'm looking for. I did attempt to reorganize the code but it seems like I really really do suck at this.

Anyway, this is my best attempt so far (still broken), and if I do manage to figure it out I'll put it up here.

Code:
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ § Instance Items (v1.3) by Enelvon [License: CC BY-SA 3.0]
# ║ <RMVX Ace>
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Change Log
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ v1.0 (December 25th, 2012) - Released the script for the first time
# ║ v1.1 (December 26th, 2012) - Fixed a single-word error that could cause
# ║ issues with non-unique armor
# ║ v1.2 (February 16th, 2013) - Added the ability to check if an item is
# ║ instanced
# ║ v1.3 (February 17th, 2013) - Fixed a bug with equipping items
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Summary
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ This script adds the ability to have 'instances' of items. Each instance may
# ║ have slightly different stats/effects than the base item. This script
# ║ contains only the ability to have stat variance on equip items - it is
# ║ intended to be extended by others in order to add more features.
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Required Scripts
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ SES Core
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Known Incompatibilities
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ None.
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Installation
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ Place this below Materials and the SES Script Core, and above all other
# ║ non-SES custom scripts (though make sure it's above any Instance Item
# ║ extensions).
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Configuration
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ There is some simple configuration required to use this script. Locate
# ║ All_Unique in the SES::InstanceItems module (that should not be hard - it's
# ║ at the top of the script). Change the value of each key to change whether or
# ║ not items of that type will be treated as unique by default.
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Tags
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● Weapon/Armor
# ║ <Unique>
# ║ Placing this in the Notes box of an item will toggle uniqueness. If its
# ║ item type defaults to being unique, the item will be nonunique. If the
# ║ item type defaults to nonunique, the item will be unique.
# ║
# ║ <Vary !Stat!: !Value!, !Chance!>
# ║ Place this in a Notes box to set a variance of !Value! for !Stat!.
# ║ !Chance is the likelihood (as a percentage) that variance will occur.
# ║ This is a very basic implementation of variance - created items of the
# ║ type will have a value of up to the given number added or subtracted
# ║ from their base value for the stat. Don't expect it to work miracles,
# ║ just for it to work.
# ║ ► Replacements:
# ║ !Stat! with hp, mp, atk, def, mat, mdf, agi, or luk.
# ║ !Value! with an integer for the maximum variance of the stat.
# ║ !Chance! with a percentage chance of variance occurring║
# ║ ● Item
# ║ <Unique>
# ║ Placing this in the Notes box of an item will toggle uniqueness. If its
# ║ item type defaults to being unique, the item will be nonunique. If the
# ║ item type defaults to nonunique, the item will be unique.
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Aliased Methods
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● module DataManager
# ║ self.create_game_objects
# ║ self.make_save_contents
# ║ self.extract_save_contents
# ║
# ║ ● class Game_BaseItem
# ║ initialize
# ║
# ║ ● class Game_Party
# ║ gain_item - as trade_item so instancing can be avoided
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § Redefined Methods
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● class Game_BaseItem
# ║ object
# ║ set_equip(is_weapon, item_id, unique)
# ║
# ║ ● class Game_Actor
# ║ equips_include?(item)
# ║ init_equips(equips)
# ║ trade_item_with_party(new_item, old_item)
# ║ change_equip_by_id(slot_id, item_id)
# ║
# ║ ● class Game_Party
# ║ gain_item(item, amount, include_equip = false)
# ║ lose_item(item, amount, include_equip = false)
# ║
# ║ ● class Window_ItemList
# ║ draw_item(index)
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ § New Methods
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ● class Game_Party
# ║ new_item(item, type)
# ║
#═╬═════════════════════════════════════════════════════════════════════════════
# ║ ▼ module SES::InstanceItems
#═╩═════════════════════════════════════════════════════════════════════════════
module SES module InstanceItems
#═╦═══════════════════════════════════════════════════════════════════════════
# ║ α BEGIN CONFIGURATION
#═╩═══════════════════════════════════════════════════════════════════════════
# The hash defining the base uniqueness value of each type of item. Setting
# one of these to true makes items of the given type be true by default.
# Setting it to false will have them default to nonunique, as in base VXAce.
All_Unique = { RPG::Weapon => false, RPG::Armor => true, RPG::Item => true, }
#═╦═══════════════════════════════════════════════════════════════════════════
# ║ Ω END CONFIGURATION
#═╩═══════════════════════════════════════════════════════════════════════════
# RegExp for toggling uniqueness of an item.
Unique = /^<Unique>/i
# RegExp for stat variance.
StatVariance = /^<Vary (\w+):\s*(\d+),\s*(\d+)%?>/i
# List of stat indices. You can add custom stats to this to allow them to
# be varied, but the custom stats must be added to the game as part of the
# params array for this to have any effect.
StatIndex = ['hp', 'mp', 'atk', 'def', 'mat', 'mdf', 'agi', 'luk']
end
end
($imported ||= {})["SES - Instance Items"] = 1.0
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ module SES::InstanceItems
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class RPG::BaseItem
#═╩═════════════════════════════════════════════════════════════════════════════
class RPG::BaseItem
  attr_accessor :old_id; attr_accessor :instanced
 
  def unique;
    scan_ses_notes if !@unique;
    return @unique
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class RPG::BaseItem
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class RPG::EquipItem
#═╩═════════════════════════════════════════════════════════════════════════════
class RPG::EquipItem < RPG::BaseItem # Scans the notes box of the item
 
  alias en_ii_ei_ssn scan_ses_notes
      
  def scan_ses_notes(tags = {})
    @variances = [[0,100]] * 8
    @unique = SES::InstanceItems::All_Unique[self.class]
    tags[SES::InstanceItems::StatVariance] = "stat = SES::InstanceItems::StatIndex.index($1.to_s.downcase) @variances[stat] = [$2.to_i, $3.to_i]"
    tags[SES::InstanceItems::Unique] = "@unique = !@unique"
    en_ii_ei_ssn(tags)
  end
 
  def variances;
    scan_ses_notes if !@variances;
    return @variances
  end # Allows basic variance
 
  def vary
    unless @varied
      ([email hidden]).each do |i| v = rand(variances[0]).to_i; v *= -1 if rand(8) <= 3
      @params += v if rand(100) < variances[1]
    end
    @varied = true
  end
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class RPG::EquipItem
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class RPG::Item
#═╩═════════════════════════════════════════════════════════════════════════════
class RPG::Item < RPG::UsableItem # Scans the Notes box of the item
 
  alias en_ii_i_ssn scan_ses_notes
 
  def scan_ses_notes(tags = {})
    @unique = SES::InstanceItems::All_Unique[self.class]
    tags[SES::InstanceItems::Unique] = "@unique = !@unique"
    en_ii_i_ssn(tags)
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class RPG::Item
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ module DataManager
#═╩═════════════════════════════════════════════════════════════════════════════
module DataManager
 
  class << self
    alias
    en_fs_dm_cgo
    create_game_objects
    alias en_fs_dm_msc
    make_save_contents
    alias en_fs_dm_esc
    extract_save_contents
  end
 
  def self.create_game_objects
    en_fs_dm_cgo
    $game_armors, $game_weapons, $game_items = $data_armors, $data_weapons, $data_items
  end
 
  def self.make_save_contents
    contents = en_fs_dm_msc
    contents[:armors], contents[:weapons], contents[:items] = $game_armors, $game_weapons, $game_items
    contents
  end
 
  def self.extract_save_contents(contents)
    en_fs_dm_esc(contents)
    $game_armors, $game_weapons, $game_items = contents[:armors], contents[:weapons], contents[:items]
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ module DataManager
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class Game_BaseItem
#═╩═════════════════════════════════════════════════════════════════════════════
class Game_BaseItem
 
  alias en_ii_gbi_i initialize
 
  def initialize
    en_ii_gbi_i
    @unique = false
  end
 
  def object id = @item_id
    return $data_skills[@item_id] if is_skill?
    if is_item? then return $game_items[id]\
    elsif is_weapon? then return $game_weapons[id]
    elsif is_armor? then return $game_armors[id]
    end
    return nil
  end
 
  def set_equip(is_weapon, item_id, unique = false)
    @class = is_weapon ? RPG::Weapon : RPG::Armor
    @item_id = item_id
    @unique = unique
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class Game_BaseItem
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class Game_Actor
#═╩═════════════════════════════════════════════════════════════════════════════
class Game_Actor < Game_Battler
 
  def equips_include?(item)
    equips.compact.each do |e| return true
    if e.old_id == item.id && e.class == item.class
    end
    return false
  end
 
  def init_equips(equips)
    @equips = Array.new(equip_slots.size) { Game_BaseItem.new }
    equips.each_with_index do |item_id, i|
      etype_id = index_to_etype_id(i)
      slot_id = empty_slot(etype_id)
      if etype_id == 0 then i, t = $data_weapons[item_id], :weapon
      else i, t = $data_armors[item_id], :armor
      end
      if !i.nil? && i.unique
        then id, u = $game_party.new_item(i, t).id, true
      elsif i.nil?
        then id, u = 0, false
      else id, u = i.id, false
      end
      @equips[slot_id].set_equip(etype_id == 0, id, u) if slot_id
    end
    refresh
  end
 
  def trade_item_with_party(new_item, old_item)
    return false if new_item && !$game_party.has_item?(new_item)
    $game_party.trade_item(old_item, 1)
    $game_party.lose_item(new_item, 1)
    return true
  end
 
  def change_equip_by_id(slot_id, item_id)
    if equip_slots[slot_id] == 0
      change_equip(slot_id, $game_weapons[item_id])
    else change_equip(slot_id, $game_armors[item_id])
    end
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class Game_Actor
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class Game_Party
#═╩═════════════════════════════════════════════════════════════════════════════
class Game_Party < Game_Unit
 
  alias trade_item gain_item
 
  def new_item(item, type)
    newi = Marshal.load(Marshal.dump(item))
    newi.old_id = item.id
    newi.instanced = true
    newi.id = eval("$game_#{type}s.size")
    newi = process_new_item(newi)
    eval("$game_#{type}s.push(newi)
    $game_#{type}s[newi.id].vary unless type == :item
    return $game_#{type}s[newi.id]")
  end
 
  def process_new_item(item)
    return item
  end
 
  [:items, :weapons, :armors].each do |i| define_method(i) do eval("@#{i}.keys.sort.collect { |id| $game_#{i}[id] }")
  end
end

  def gain_item(*args)
    oitem = args[0] if !args[0].nil?
    args[1].times do item = oitem if item && item.unique
    args[0] = if item.is_a?(RPG::Weapon)
    then new_item(item, :weapon)
  elsif item.is_a?(RPG::Armor)
    then args[0] = new_item(item, :armor)
  elsif item.is_a?(RPG::Item)
    then args[0] = new_item(item, :item)
  end
end

  trade_item(args[0], 1)
  end
end

  def lose_item(*args)
    args[1] *= -1
    trade_item(*args)
  end
end
#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class Game_Party
#─╫─────────────────────────────────────────────────────────────────────────────
# ║ ▼ class Window_ItemList
#═╩═════════════════════════════════════════════════════════════════════════════
class Window_ItemList < Window_Selectable
 
  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))
    draw_item_number(rect, item) unless item.unique
  end
end

end

#═╦═════════════════════════════════════════════════════════════════════════════
# ║ ▲ class Window_ItemList
#═╩═════════════════════════════════════════════════════════════════════════════
I tried my hand at it as well. I don't know what to do with the Game_BaseItem.new
If I take the brackets out of comment it out, then there is an error with game actor linking back to
slot_id = empty_slot(etype_id)

Commenting out the method def init_equips(equips)
gets it working (in my test with items) but it doesn't stack items. It's the same as Hime's Instance items.

Leaving it all in for the armor and weapons it give me errors.
Honestly, it just the matter on how to draw it in the item window. Before you strayed so far like using/modifying instance item, I'd tell you, you don't need it at all. Because I'm bored, here's a quick script I made.
Code:
class Window_ItemList
  Splitter = 30 # <-- Split number here
 
  alias theo_item_grouper_make_list make_item_list
  def make_item_list
    theo_item_grouper_make_list
    old_data = @data
    @data = []
    old_data.each do |item|
      next unless item
      num = $game_party.item_number(item)
      until num <= Splitter
        num -= Splitter
        @data << [item, Splitter]
      end
      @data << [item, num]
    end
  end
 
  def draw_item(index)
    item = @data[index][0]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y, enable?(item))
      draw_text(rect, sprintf(":%2d", @data[index][1]), 2)
    end
  end
 
  def item
    @data && @data[index] && index >= 0 ? @data[index][0] : nil
  end
end
Screenshot_709.jpg


And to adjust the maximum owned
Code:
class Game_Party
  def max_item_number(item)
    return 99999999
  end
end

EDIT: This snippet may have an unintended effect. I haven't tested it much further as I'm going away to play Stellaris. Please report any glitch/bug. Or someone could just continue the script based the one I wrote above.
I wrote the exact same script like Theo did above, but after testing it out on other scenes, it just threw errors after errors, so I just left it at that (not enough time to debug it properly), and didn't post it.

But you add the last batch of items even if the remaining number is 0, which should not happen obviously. There should be an if num > 0 condition there.
Other than that, it needs testing because many scenes use the same window class or it's child class (the battle scene, the equip scene and several custom scripts also), and more often than not, this change will cause an error or two in these scenes.
report any glitch
The only thing I see wrong is that items are not usable. Weapons and armor work fine.
Going into my item screen I cannot select the potion to use it on an actor, you just get the buzzer sound.
Yeah, it misses a few methods like:
Spoiler
Code:
  def current_item_enabled?
    @data[index] && enable?(@data[index][0])
  end

  def select_last
    litm = $game_party.last_item.object
    dt = @data.find {|itm| itm[0] == litm }
    select(@data.index(dt) || 0)
  end
Add these in and you should be able to use items.
YAY thank you much everyone. The script by TheoAllen + little fix by Sixth work amazingly!
(It'd be great if this script was shared by Theo or Sixth as its own post, I can see it being useful for a bunch of people.)

Original thread: https://forums.rpgmakerweb.com/threads/more-of-the-same-item-stacks.107406/