Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: bullymays on February 20, 2016, 11:10:24 AM

Title: Inventory/Item Saving
Post by: bullymays on February 20, 2016, 11:10:24 AM
I am new and love playmaker!

I wanted to make my own inventory system since it seems the ones on the asset store do more than just inventory and I also want to be able to understand to manipulate it better.

After a couple days of pouring over tutorials, pdfs, and google...it would seem that the best way to do it is with arrays and hash tables.  Arrays I am starting to understand along with how to display the items in the GUI.

My question is with stacking items and the item count. 

Is the best way to create two hash tables?  One with a reference to Game Object as "items" then another referencing Int as a "count" of those items?

Some of the information is really old, but it seems that this is the way a lot of the inventory systems worked 1+ years ago and wasn't sure if this was still the way to go.

Thanks!
Title: Re: Inventory/Item Saving
Post by: mdotstrange on February 20, 2016, 09:50:08 PM
You can have as many hash tables as you need to store the data you want to use for your inventory system-

Like your items and count examples- you can also have a hash table that stores sprites for the items icon- and another string hash table for the item info- anything you need-

You use an array to store the names of the items (keys) and cycle through that array (array get next) when an item is selected than pull the data in from your hash tables using the key.