MasterMoes 19 Posted August 23, 2020 I've been trying to find a way to create multiple inventories for separate parties in VX Ace, but I can't find any scripts that perfect this function. Basically, I'm trying to create a battle scene that involves a character who isn't part of the main party. After some dialog, your party changes to the character and begins a battle. The problem is that the character is able to use all of the items the player has collected, which doesn't canonically make sense. What I want is for the character to be able to use his own collection of items and not the items the main party has collected. The simple thing to do would be to get a script for multiple inventories, but the only two options have some major issues. Fomar0153's script is horribly constructed and has a lot of bugs; plus, it isn't compatible with Yanfly's Ace Save Engine. Hime's Party Manager script would do the trick, but it is ALSO incompatible with Ace Save Engine. I've done a deep search on the internet, but these are the only two scripts I could find, so I'm wondering if anyone knows where I can get another alternative, whether it's a different inventory script or a way to get what I need accomplished. Actually, these scripts might be simple enough to make it compatible with Ace Save Engine; I just need it to be possible to load up an old save and have it work. If no alternatives are available and/or if anyone is willing to help, I'm willing to commission a compatible script. I'm not smart enough in programming to solve this problem... Fomar0153's script: Hime's Party Manager: https://forums.rpgmakerweb.com/index.php?threads/party-manager.17270/ Yanfly's Ace Save Engine: https://yanflychannel.wordpress.com/rmvxa/menu-scripts/ace-save-engine/ 1 Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted August 23, 2020 @TheoAllen made a script called Inventory Secure. This might solve your issue entirely. Spoiler # ============================================================================= # ♫ ~ Inventory Secure by TheoAllen ~ ♫ # Version : 1.2 # Contact : www.rpgmakerid.com # ============================================================================= # Requires : N/A # Rewrites method : N/A # Alliases method : Game_Party initialize # ============================================================================= # ♫ UPDATES : # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2013.02.23 - Fixed bugs in inventory check # - Secure inventory now also secure gold # 2013.02.21 - Added merge secured inventory and secured inventory check # - Fixed some typos and bugs # 2013.02.20 - Started and Finished script # # ============================================================================= # ♫ DESCRIPTION : # This script allow you to save current party's inventory when you're going to # switch party members into another team members for storytelling purposes. # # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # ♫ INSTRUCTION : # Put this script below material but above main in script editor. Don't forget # to save. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # ♫ HOW TO USE : # Type these all in script call # - secure_inv(n) = Secure party's inventory which "n" is an index where # you put the secured inventory. # - get_inv(n) = Get inventory from "n" index. It replaces the current # party's inventory. # - merge_inv(n) = Merge secured inventory from "n" index to party's # inventory. # - inventory_exist?(n) = check avalaibility of secured inventory. can be used # in conditional branch through script call # ============================================================================= # ♫ TERMS OF USE : # - Credit me, TheoAllen. # - You may use and edit this script both for commercial and non-commercial or # even adult game as long as u don't claim it yours. # - I'll be glad if you give me a free copy of your game if you use this script # in your commercial project. # ============================================================================= # # ============================================================================= # ♫ No custom configuration avalaible ~ ♫ # ♫ Do not edit unless you know what to do ~ ♫ # ============================================================================= class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ♫ Aliased initialize ~ #-------------------------------------------------------------------------- alias theo_inv_secure_init initialize def initialize theo_inv_secure_init init_all_bags end #-------------------------------------------------------------------------- # ♫ Initialize all bags ~ #-------------------------------------------------------------------------- def init_all_bags @item_bags = [] @weapon_bags = [] @armor_bags = [] @gold_bags = [] end #-------------------------------------------------------------------------- # ♫ Secure all inventories ~ #-------------------------------------------------------------------------- def secure_all(index) secure_items(index) secure_weapons(index) secure_armors(index) secure_gold(index) end #-------------------------------------------------------------------------- # ♫ Secure items ~ #-------------------------------------------------------------------------- def secure_items(index) @item_bags[index] = @items.clone @items.clear end #-------------------------------------------------------------------------- # ♫ Secure weapons ~ #-------------------------------------------------------------------------- def secure_weapons(index) @weapon_bags[index] = @weapons.clone @weapons.clear end #-------------------------------------------------------------------------- # ♫ Secure armors ~ #-------------------------------------------------------------------------- def secure_armors(index) @armor_bags[index] = @armors.clone @armors.clear end #-------------------------------------------------------------------------- # ♫ Secure gold ~ #-------------------------------------------------------------------------- def secure_gold(index) @gold_bags[index] = @gold @gold = 0 end #-------------------------------------------------------------------------- # ♫ Get all secured inventories ~ #-------------------------------------------------------------------------- def get_all(index) get_items(index) get_weapons(index) get_armors(index) get_gold(index) end #-------------------------------------------------------------------------- # ♫ Get secured items ~ #-------------------------------------------------------------------------- def get_items(index) item_bags_exist?(index) ? @items = @item_bags[index].dup : @items = {} @item_bags[index].clear end #-------------------------------------------------------------------------- # ♫ Get secured weapons ~ #-------------------------------------------------------------------------- def get_weapons(index) weapon_bags_exist?(index) ? @weapons = @weapon_bags[index].dup : @weapons = {} @weapon_bags[index].clear end #-------------------------------------------------------------------------- # ♫ Get secured armors ~ #-------------------------------------------------------------------------- def get_armors(index) armor_bags_exist?(index) ? @armors = @armor_bags[index].dup : @armors = {} @armor_bags[index].clear end #-------------------------------------------------------------------------- # ♫ Get secured gold ~ #-------------------------------------------------------------------------- def get_gold(index) gold_bags_exist?(index) ? @gold = @gold_bags[index] : @gold = 0 @gold_bags[index] = 0 end #-------------------------------------------------------------------------- # ♫ Merge secured inventories to current inventories ~ #-------------------------------------------------------------------------- def merge_all(index) merge_items(index) merge_weapons(index) merge_armors(index) merge_gold(index) end #-------------------------------------------------------------------------- # ♫ Merge secured items ~ #-------------------------------------------------------------------------- def merge_items(index) @item_bags[index].each_key do |id| gain_item($data_items[id], @item_bags[index][id]) if item_bags_exist?(index) end @item_bags[index] = {} end #-------------------------------------------------------------------------- # ♫ Merge secured weapons ~ #-------------------------------------------------------------------------- def merge_weapons(index) @weapon_bags[index].each_key do |id| gain_item($data_weapons[id], @weapon_bags[index][id])if weapon_bags_exist?(index) end @weapon_bags[index] = {} end #-------------------------------------------------------------------------- # ♫ Merge secured armors ~ #-------------------------------------------------------------------------- def merge_armors(index) @armor_bags[index].each_key do |id| gain_item($data_armors[id], @armor_bags[index][id]) if armor_bags_exist?(index) end @armor_bags[index] = {} end #-------------------------------------------------------------------------- # ♫ Merge secured gold ~ #-------------------------------------------------------------------------- def merge_gold(index) gain_gold(@gold_bags[index]) if gold_bags_exist?(index) @gold_bags[index] = 0 end #-------------------------------------------------------------------------- # ♫ Return true if secured inventory is avalaible #-------------------------------------------------------------------------- def inventory_exist?(index) return true if item_bags_exist?(index) || weapon_bags_exist?(index) || armor_bags_exist?(index) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured item is avalaible #-------------------------------------------------------------------------- def item_bags_exist?(index) return true if index <= @item_bags.size-1 && !@item_bags[index].nil? && check_values(@item_bags[index]) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured weapon is avalaible #-------------------------------------------------------------------------- def weapon_bags_exist?(index) return true if index <= @weapon_bags.size-1 && !@weapon_bags[index].nil? && check_values(@weapon_bags[index]) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured armor is avalaible #-------------------------------------------------------------------------- def armor_bags_exist?(index) return true if index <= @armor_bags.size-1 && !@armor_bags[index].nil? && check_values(@armor_bags[index]) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured gold is avalaible ~ #-------------------------------------------------------------------------- def gold_bags_exist?(index) return true if index <= @gold_bags.size-1 && !@gold_bags[index].nil? && @gold_bags[index] > 0 return false end #-------------------------------------------------------------------------- # ♫ Check avalaible items. Returns FALSE if all items are 0 #-------------------------------------------------------------------------- def check_values(bags) values = bags.values return values.any? {|value| value > 0} end end # ============================================================================= # ♫ End of Game_Party class ♫ # ============================================================================= # # These methods are to simplify script call # # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= def secure_inv(index) $game_party.secure_all(convert_index(index)) end def get_inv(index) $game_party.get_all(convert_index(index)) end def merge_inv(index) $game_party.merge_all(convert_index(index)) end def inventory_exist?(index) $game_party.inventory_exist?(convert_index(index)) end def convert_index(index) return 0 if index < 0 return index end # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= If it works, then great, glad I could help. If not, I'm sure that there would be at least one coder that's still here, that could aid you better than I, the RGSS novice, lolz Share this post Link to post Share on other sites
MasterMoes 19 Posted August 23, 2020 3 minutes ago, PhoenixSoul said: @TheoAllen made a script called Inventory Secure. This might solve your issue entirely. Reveal hidden contents # ============================================================================= # ♫ ~ Inventory Secure by TheoAllen ~ ♫ # Version : 1.2 # Contact : www.rpgmakerid.com # ============================================================================= # Requires : N/A # Rewrites method : N/A # Alliases method : Game_Party initialize # ============================================================================= # ♫ UPDATES : # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 2013.02.23 - Fixed bugs in inventory check # - Secure inventory now also secure gold # 2013.02.21 - Added merge secured inventory and secured inventory check # - Fixed some typos and bugs # 2013.02.20 - Started and Finished script # # ============================================================================= # ♫ DESCRIPTION : # This script allow you to save current party's inventory when you're going to # switch party members into another team members for storytelling purposes. # # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # ♫ INSTRUCTION : # Put this script below material but above main in script editor. Don't forget # to save. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # ♫ HOW TO USE : # Type these all in script call # - secure_inv(n) = Secure party's inventory which "n" is an index where # you put the secured inventory. # - get_inv(n) = Get inventory from "n" index. It replaces the current # party's inventory. # - merge_inv(n) = Merge secured inventory from "n" index to party's # inventory. # - inventory_exist?(n) = check avalaibility of secured inventory. can be used # in conditional branch through script call # ============================================================================= # ♫ TERMS OF USE : # - Credit me, TheoAllen. # - You may use and edit this script both for commercial and non-commercial or # even adult game as long as u don't claim it yours. # - I'll be glad if you give me a free copy of your game if you use this script # in your commercial project. # ============================================================================= # # ============================================================================= # ♫ No custom configuration avalaible ~ ♫ # ♫ Do not edit unless you know what to do ~ ♫ # ============================================================================= class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ♫ Aliased initialize ~ #-------------------------------------------------------------------------- alias theo_inv_secure_init initialize def initialize theo_inv_secure_init init_all_bags end #-------------------------------------------------------------------------- # ♫ Initialize all bags ~ #-------------------------------------------------------------------------- def init_all_bags @item_bags = [] @weapon_bags = [] @armor_bags = [] @gold_bags = [] end #-------------------------------------------------------------------------- # ♫ Secure all inventories ~ #-------------------------------------------------------------------------- def secure_all(index) secure_items(index) secure_weapons(index) secure_armors(index) secure_gold(index) end #-------------------------------------------------------------------------- # ♫ Secure items ~ #-------------------------------------------------------------------------- def secure_items(index) @item_bags[index] = @items.clone @items.clear end #-------------------------------------------------------------------------- # ♫ Secure weapons ~ #-------------------------------------------------------------------------- def secure_weapons(index) @weapon_bags[index] = @weapons.clone @weapons.clear end #-------------------------------------------------------------------------- # ♫ Secure armors ~ #-------------------------------------------------------------------------- def secure_armors(index) @armor_bags[index] = @armors.clone @armors.clear end #-------------------------------------------------------------------------- # ♫ Secure gold ~ #-------------------------------------------------------------------------- def secure_gold(index) @gold_bags[index] = @gold @gold = 0 end #-------------------------------------------------------------------------- # ♫ Get all secured inventories ~ #-------------------------------------------------------------------------- def get_all(index) get_items(index) get_weapons(index) get_armors(index) get_gold(index) end #-------------------------------------------------------------------------- # ♫ Get secured items ~ #-------------------------------------------------------------------------- def get_items(index) item_bags_exist?(index) ? @items = @item_bags[index].dup : @items = {} @item_bags[index].clear end #-------------------------------------------------------------------------- # ♫ Get secured weapons ~ #-------------------------------------------------------------------------- def get_weapons(index) weapon_bags_exist?(index) ? @weapons = @weapon_bags[index].dup : @weapons = {} @weapon_bags[index].clear end #-------------------------------------------------------------------------- # ♫ Get secured armors ~ #-------------------------------------------------------------------------- def get_armors(index) armor_bags_exist?(index) ? @armors = @armor_bags[index].dup : @armors = {} @armor_bags[index].clear end #-------------------------------------------------------------------------- # ♫ Get secured gold ~ #-------------------------------------------------------------------------- def get_gold(index) gold_bags_exist?(index) ? @gold = @gold_bags[index] : @gold = 0 @gold_bags[index] = 0 end #-------------------------------------------------------------------------- # ♫ Merge secured inventories to current inventories ~ #-------------------------------------------------------------------------- def merge_all(index) merge_items(index) merge_weapons(index) merge_armors(index) merge_gold(index) end #-------------------------------------------------------------------------- # ♫ Merge secured items ~ #-------------------------------------------------------------------------- def merge_items(index) @item_bags[index].each_key do |id| gain_item($data_items[id], @item_bags[index][id]) if item_bags_exist?(index) end @item_bags[index] = {} end #-------------------------------------------------------------------------- # ♫ Merge secured weapons ~ #-------------------------------------------------------------------------- def merge_weapons(index) @weapon_bags[index].each_key do |id| gain_item($data_weapons[id], @weapon_bags[index][id])if weapon_bags_exist?(index) end @weapon_bags[index] = {} end #-------------------------------------------------------------------------- # ♫ Merge secured armors ~ #-------------------------------------------------------------------------- def merge_armors(index) @armor_bags[index].each_key do |id| gain_item($data_armors[id], @armor_bags[index][id]) if armor_bags_exist?(index) end @armor_bags[index] = {} end #-------------------------------------------------------------------------- # ♫ Merge secured gold ~ #-------------------------------------------------------------------------- def merge_gold(index) gain_gold(@gold_bags[index]) if gold_bags_exist?(index) @gold_bags[index] = 0 end #-------------------------------------------------------------------------- # ♫ Return true if secured inventory is avalaible #-------------------------------------------------------------------------- def inventory_exist?(index) return true if item_bags_exist?(index) || weapon_bags_exist?(index) || armor_bags_exist?(index) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured item is avalaible #-------------------------------------------------------------------------- def item_bags_exist?(index) return true if index <= @item_bags.size-1 && !@item_bags[index].nil? && check_values(@item_bags[index]) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured weapon is avalaible #-------------------------------------------------------------------------- def weapon_bags_exist?(index) return true if index <= @weapon_bags.size-1 && !@weapon_bags[index].nil? && check_values(@weapon_bags[index]) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured armor is avalaible #-------------------------------------------------------------------------- def armor_bags_exist?(index) return true if index <= @armor_bags.size-1 && !@armor_bags[index].nil? && check_values(@armor_bags[index]) return false end #-------------------------------------------------------------------------- # ♫ Return true if secured gold is avalaible ~ #-------------------------------------------------------------------------- def gold_bags_exist?(index) return true if index <= @gold_bags.size-1 && !@gold_bags[index].nil? && @gold_bags[index] > 0 return false end #-------------------------------------------------------------------------- # ♫ Check avalaible items. Returns FALSE if all items are 0 #-------------------------------------------------------------------------- def check_values(bags) values = bags.values return values.any? {|value| value > 0} end end # ============================================================================= # ♫ End of Game_Party class ♫ # ============================================================================= # # These methods are to simplify script call # # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= def secure_inv(index) $game_party.secure_all(convert_index(index)) end def get_inv(index) $game_party.get_all(convert_index(index)) end def merge_inv(index) $game_party.merge_all(convert_index(index)) end def inventory_exist?(index) $game_party.inventory_exist?(convert_index(index)) end def convert_index(index) return 0 if index < 0 return index end # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= If it works, then great, glad I could help. If not, I'm sure that there would be at least one coder that's still here, that could aid you better than I, the RGSS novice, lolz Thank you so much! I'll test it out another day because it's so late for me, but in assumption that it works I'll just say "thank you for your help", 1 Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted August 23, 2020 Aye. Dé rìen, mon ami. Share this post Link to post Share on other sites
MasterMoes 19 Posted August 24, 2020 @PhoenixSoul So I tried out TheoAllen's script, but I'm still having compatibility issues. It works with Ace Save Engine, but I'm also using Seiryuki's "Categorize Item Scene" script, so I think Theo's script is having trouble handling how to store the items into the proper categories, like equipment versus items. I'm also using Hime's "Instance Items" script. In other words, it doesn't work, but I think this script concept is leading in the right direction. Know of any more? Or could you recommend some odd places I can find them on my own? {: 1 Share this post Link to post Share on other sites
Kayzee 4,032 Posted August 24, 2020 (edited) I found a rather brute force method to do something like this ages ago actually... Look at this old old experemental script I made: module PartySwitch def self.switch(num) return unless self.party_list[num] $game_party = self.party_list[num] $game_player.refresh $game_map.need_refresh = true end def self.make_party(num, actors) return if self.party_list[num] party = Game_Party.new party.set_actors(actors) self.party_list[num] = party end def self.party_list @party_list = [$game_party] unless @party_list @party_list end def self.party_list=(value) @party_list = value || [$game_party] end end class Game_Party < Game_Unit def set_actors(array) @actors = array end end module DataManager #-------------------------------------------------------------------------- # * Create Save Contents #-------------------------------------------------------------------------- class << self alias make_save_contents_partyswitch_base make_save_contents end def self.make_save_contents contents = make_save_contents_partyswitch_base contents[:partylist] = PartySwitch.party_list contents end #-------------------------------------------------------------------------- # * Extract Save Contents #-------------------------------------------------------------------------- class << self alias extract_save_contents_partyswitch_base extract_save_contents end def self.extract_save_contents(contents) extract_save_contents_partyswitch_base(contents) PartySwitch.party_list = contents[:partylist] end end This basically allows for multiple parties each with their own inventory, gold count, and everything else. It's made to be used with event calls. You can use PartySwitch.make_party(1, [1,2,3]) to make another party with actors 1, 2 and 3 for example. Then switch to it with PartySwitch.switch(1) and switch to the normal party with PartySwitch.switch(0) after you are done. It should work well enough for what you want to do, but it's pretty basic. I didn't make an easy way to have multiple parties trade items for example, but it's possible to manipulate a party's inventory without switching to them. It's also probably possible to switch to another party, do event stuff to mess with their inventory, and switch back right away if you want. Might cause visual bugs, but I don't think so. Edited August 24, 2020 by Kayzee 1 Share this post Link to post Share on other sites
MasterMoes 19 Posted August 24, 2020 And would you look at that, it works perfectly! Not a single inconvenience! Thank you VERY much Kayzee, you're quite the lifesaver! ❤ Permission to post this script with built-in instructions? Also, I don't think I ever mentioned what game these scripts are going into. https://store.steampowered.com/app/1291100/Night_Spasm/ Thanks again! 1 Share this post Link to post Share on other sites
PhoenixSoul 1,404 Posted August 25, 2020 7 hours ago, MasterMoes said: Seiryuki's "Categorize Item Scene" script Ah, that's one I've never used. I use Victor's Item Command (same thing just different script and thus different code). Anyway, glad someone came along and provided more aid than I could. @Kayzee is pretty amazing. 1 Share this post Link to post Share on other sites
Kayzee 4,032 Posted August 25, 2020 12 hours ago, MasterMoes said: And would you look at that, it works perfectly! Not a single inconvenience! Thank you VERY much Kayzee, you're quite the lifesaver! ❤ Permission to post this script with built-in instructions? Also, I don't think I ever mentioned what game these scripts are going into. https://store.steampowered.com/app/1291100/Night_Spasm/ Thanks again! Sure, you can clean it up and post it if you want... I think I might have posted it somewhere before ages ago but I am not sure where. Also, a game where your decisions effect everyone's game huh? I can kinda imagine a few different ways to do that. Sounds like it would make a lot of things pretty complicated though! 1 1 Share this post Link to post Share on other sites
MasterMoes 19 Posted August 25, 2020 12 hours ago, Kayzee said: Sure, you can clean it up and post it if you want... I think I might have posted it somewhere before ages ago but I am not sure where. Also, a game where your decisions effect everyone's game huh? I can kinda imagine a few different ways to do that. Sounds like it would make a lot of things pretty complicated though! Not it really, it only took me about 2 years to make . Thank you for the permission. Also, I'm hosting a giveaway for Night Spasm right here: https://gleam.io/RUvUN/night-spasm-steam-code-giveaway 1 Share this post Link to post Share on other sites