Inventory Core
This plugin provides a standard way to manage inventories of items and gold.
It offers multiple inventories so that the party for example can have multiple inventories, which can be swapped depending on your needs.
A new “Inventory” object is available for plugin developers, which allows you to easily provide inventory support for any object that you like.
Additional inventory functionality will be added over-time as they are developed.
Download
Plugin: download here (right-click, save-as)
You will also need this bug fix: Orange Circular Json. Required to address a problem where you can’t save your game.
Related Plugins
- Feldherren Inventory Value – calculates the total value (price) of all items in the inventory and stores them in variables.
Installation
Download ths plugin and place it in the “plugins” folder in your project’s “js” folder. Then open your Plugin Manager (F10), double-click an empty row, and select the HIME_InventoryCore plugin.
Once it is in your list of plugins, turn the plugin on.
Usage
Multiple Inventories
This plugin offers you the ability to manage multiple inventories.
The party, for example, can have multiple inventories.
To create an inventory, use the script call
$gameParty.createInventory( ID )
Where the ID is a name that you will use to reference the inventory throughout the game. For example, you can say things like
$gameParty.createInventory( "Main Inventory" ) $gameParty.createInventory( 1 )
To switch inventories, use the script call
$gameParty.switchInventory( ID )
Assuming the inventory is already created, the party will use the specified inventory as the default inventory. For example, assuming you have a second inventory called “sub”, you could switch to that inventory using
$gameParty.switchInventory( "sub" )
To merge inventories, use the script call
$gameParty.mergeInventory( ID1, ID2 )
This will merge inventory 1 into inventory 2, and delete inventory 1.
Inventory 2 will be set as the default inventory.
For Developers
The default inventory implementation for parties is no good. The inventory should be abstracted into its own class and an instance of it held by the party. The purpose of this plugin is to provide such an abstraction so that it is easier to work with inventories.
The two objects that you will be interested in are
- Game_Inventory
- Game_Inventories
The Game_Inventory object holds all of the usable items, weapons, armors, and gold. It has the same interface as the party; you can take a look at the methods provided.
The Game_Inventories object is a container that’s used to manage multiple inventories. Any object that can have support for multiple inventories should use this to work with individual inventory objects.
For backwards compatibility, all of the methods that were originally in Game_Party have been replaced with calls to its “current” inventory, which is defined to be the inventory that all items/gold will be sent to. The current inventory may be switched at anytime using script calls.
Ever since adding this script, I am unable to fight battles without an error in line 4 of the script. something about a repeat. even after deleting the script i get the same error. why is this occuring even after I got rid of the script?
actually, Im unable to even start my game!
Fixed it. Sorry about that XD
Is there a script call to delete an inventory? For example, switch to inventory 2 then delete inventory 1, no merge at all, i want the items lost.
How can I give the different Inventory new and different items?
Is there a demo available?
I can’t seem to get the inventory merge feature to work right? Do we use the numbers you have or do we place the names we created in quotes?
Right now I have an event creating and inventory called “sub” and then removing that inventory which works. However it seems to not want to merge this inventory with the main that is created within the plugin itself. I’m writing the merge script like this $gameParty.mergeInventory( main, sub ) but that doesn’t seem to be working?
Yes the default inventory is written as “main” within the plugin as well
I am looking forward to playing with this plugin! It looks to be what I need. I am a little confused on some wording though, can we have a party with multiple inventories but a joint gold pool? Ex. You have two memebers in the party with two seperate inventories but one gold pool, and they can trade items in the inventory tab by selecticing the item and a choice like’trade’ or something? Can this plugin work like that? I was looking to add weight limits to my inventories to make this relevant/strategic. This weight limitsomething we can look forward to seeing as an addition to this already amazing plugin?
Have to say great plug in its exactly what I was looking for. Little confusing at first and I can’t get numbers to work as inventory names but a string is a better option for me anyway. I’m am really looking foward to item trading.
Hello there,
I would like to use your Inventory Corescript in my project.
In my project you start playing with a character.
After a while you play from an orc’s perspective (add orc remove player).
I can “block out” weapons, armor and skills.
Items on the other hand are tranfered to (kept by) that orc.
I would like to keep the players inventory and that of the orc separated.
I was advised on the RPGmakerform to use your script.
I have already installed it and turned on in my pluginlist.
It tells me to make a second inventory by adding $gameParty.createInventory( ID ) as a script call.
But I don’t know what this means. what’s a script call?
Could you help me out please?
thanks in advance!
Are you going to make any add-ons to this plugin that can cause actors to have their own personal inventories?
Are there any compatibility problems with any of Yanfly’s plugins?
I do not know if there are issues with “any” of yanfly’s plugins since I do not test my code with all of yanfly’s work.
So I created an event at the beggining of the game to create a new inventory: $gameParty.createInventory( Dei ). And when I start the game and get to the part where it creates the inventory it says ReferenceError Dei is not Defined, I really dont know what I did wrong if someone has the solution to this it would really be appreciated.
Inventory names are strings, so you should write "Dei" with the quotes. Script calls will treat anything that isn’t surrounded with quotes as actual code.
And now it says: “TypeError undefined is not a function”, my god this is more complicated than I thought.
Can you reproduce the issue in this demo? If it still occurs send it to me http://himeworks.com/2016/01/super-small-debug-demo/
I’m getting this error:
cannot read property “gainItem” of undefined
I allow the player to Select Item (command) an item, lose that item and then switch to a new inventory. Then add back that same item to the new inventory (Thus the new one is a scenario where the player is limited in item usage).
This works. However, after I merge the inventories (which works) and repeat the above process. It gives out the
“cannot read property “gainItem” of undefined”
Error for:
$gameParty.gainItem($dataItems[$gameVariables.value(32)]
, $gameVariables.value(37));
Ah, I figured it out.
After merging the inventories, I didn’t realise it also deleted the old one. So when I repeat the “above” process it was attempting to switch to an inventory that was just deleted and adding items via gainItem was running into an error I assume.
By re-creating the inventory right after merging the two, my problem has been resolved :3
Yes, merging inventories will delete the old one. I will see if I can put some emphasis on that in the description.
Amazing plug-in, it’s really what i need in my game. I just have encountered a big problem. I don’t know if i am using it wrong, but when i try to use this plug-in (Inventory Core alone, or with the Multiple Inventory) i can’t save in-game. It doesn’t collide with other plug-ins because i tried to run it alone and it still doesn’t work.
Maybe you have a suggestion for me, or maybe other people have the same problem.
The plug-in works fine otherwise.
There's another plugin in the download section that is required in order to save the game: Orange Circular JSON It is a critical bug that needs to be addressed.
Well, until I figure out a way to avoid the problem.
This looks like an amazing Plugin, but i have one question , would it be possible to use this to make a Grid based inventory and a bank/stash for a player to store extra items ? Kinda like the inventory’s in the Diablo games from Blizzard runs?
I will be building some custom inventory scenes on top of this plugin. Thanks for the suggestions!
For the bank/stash, I have an “item trading” scene in development, which you can use to trade between two inventories.
The second inventory could be treated as a storage inventory.
My inventory value script is now up to date for your Inventory Core script, and even works better now – you can just get the value of the current inventory’s holdings, as well as the value of specific named inventories.
https://github.com/Feldherren/mv-inventory-value
Enjoy.
Looks good.