Semi-complex inventory system (at least to me) with chest opening, picking up items in the world, storing them, using them (and destroying upon use) with items being stackable, destroyable, sortable, droppable, pickup-able, etc. In backpack you will be able to click on the item to bring out the description of the item.
This will be a lot of work and research so it will take quite some time to develop it to the point that I feel it is reliable enough to be used. This is only the start.
Project can be seen here:
https://playcanvas.com/project/948045/overview/inventorysystem
If you want to learn more you can find it inside the project in āVersionsā where I will keep everything updated and āReadmeā that is general description of the project. It also has Version Control to roll back to version you want but I donāt know if you can access that.
Sorry for the wall of text, have fun!
1 Like
Non team members can only access the whatever is latest on the master branch
Of, did not know that. Thought that if someone forks the project he can access the version control
Hi @JustVlaxx!
Itās great that you make projects like this. I have regularly seen the question how to make an inventory system and maybe it can help myself too.
Is it easy for novice users to apply it in their own project? (I canāt find the responsible script in your project).
Hey @Albertos ,
I think itās semi-easy to apply to the project but the problem is my hierarchical folder structure since itās easier for me to know where scripts are but for others it can get really hectic.
These are the only things you need to do to actually use the base system:
- ItemSlotImage (Template) - since it has a tag āItemSlotā (main thing that is checked if the inventory is full.
- FItemStruct (ES6_class) - This is your created item, it holds all the data (name, texture, description, etc. for your item).
- InventoryBase (ES6_class) - This is the brain of your inventory. Has functions like add item, remove item, sort item, checkForEmpty slot, etc. I wrote in comments what each function does so that you can use it easier.
- ItemDatabase (JSON) - Holds all of the items data in JSON file (name, texture, description, etc.). This is what is randomized to generate one of the items and apply it to the FItemStruct.
- Item (PC_class) - Just assigns the āitemā variable to entity (template).
If you wish to change what data the item will hold you need to change FItemStruct constructor to match the ItemDatabase. If you wish to add items you need to call inventoryās function addItem, to remove removeItem, etc.
Quickly created the basic template (just stripped everything that is not needed):
https://playcanvas.com/project/949547/overview/inventorysystem_basictemplate
1 Like
Thanks! This makes it a lot easier to integrate it into a project!
1 Like
No problem, hope it helps you.
1 Like
Lots of changes since the initial posting.
- Added chests
- Inventory UI
- Items on the ground
- Destroying items
and more, if you are interested here is a short video showcasing the build:
and the link can be found here (or at the first post): InventorySystem
3 Likes
Well done! Looks amazing already!
1 Like
Well done, looks brilliant!
1 Like
@Albertos @pjburnhill Thanks, itās a really fun project for me
Hey, will you be adding a āCollect all featureā? IN addition, will you also be adding a system to save the inventory, or does that already exist?
I am new to JS and this engine so I have no clue how to save the inventory. Would need to research that part. Collect all items feature is easy, can add that for the next build.
Will probably add a radius for collect all items
When you are finished with the project, do you want to update the basic template too please?
Sure, not really a problem. I donāt want to put unecesarry stuff there so I would need to think what to add.
If you have any suggestions you can tell me.
Sure, that is not difficult but will not add that now. Did add collect all feature in the newest build
Must say, this is really fun to do. Even though I am only doing it with JS itās really fun. Some new stuff:
- Item description on hover
- Range for item pickups (red line - outside range, yellow line - inside range)
- Collect all items with Q button
Here is the short video!
@Albertos I started adding/changing the inventory template. You can delete selected items in UI. Will probably only add the item pickup to the template.
Yeah I think thatās fine, otherwise we still have the full project. Thanks.