Welcome to the Game Creator support forum! 


This a place to ask questions, discuss ideas and report bugs. Please, provide your Unity and Game Creator versions as well as clear reproduction steps when opening a topic and full console logs.

+5
Under review

Advanced Inventory Module

Duffer123 4 months ago in Inventory updated by Sergei | Analog Limb 4 months ago 9

I set out below the desired features of a new v2 Inventory Module OR an Advanced Inventory Module:-

  • Customisable items at runtime which are loadable and saveable from Inventories (see below) or Containers;
  • Items customisable at runtime in the following ways:-
    1. Socket Items and sockettable items;
  • Multiple Socket item types;
    1. For example, gemstones, runestones, talismans etc
  • Affixes (prefixes, generic affixes, suffixes); and
  • Multiple Affix types (including substance item made from – metals, woods etc);
  • Affixes effect customisable item name (save and loadable) – so a Sword could become a Holy Elven Rangers Steel Fire Sword of the Lion etc.;
  • Enchantments and Upgrades.
  • (a)-(f) effect rarity, price, buy price and sell price, item properties
  • Multiple Inventories (not just one) for Player, Characters or Enemy Characters, NPCs, Monsters, Traders and Merchants;
  • Multiple Currencies and conversion;
    1. Example – 10 bronze pieces = 1 silver piece, 10 silver pieces = 1 gold piece, 10 gold pieces = 1 mithril piece etc etc
  • Craftable Items – from more than two other Items - and Recipes to allow for this;
  • More than 32 Item Types and SubTypes or Categories and SubCategories – so perhaps based upon ScriptableObject ‘types’ – any number of which can apply to an item – and searchable and filterable by types and more than one type;
  • Support for both Fixed Meshes and Skinned Meshes allowing/simplifying Character customisation at runtime; and
  • Wizards/Editors to support all the same and creation of Items, Equippable Items, Currencies, Socket Types, Affix Types in Editor mode.
+2
Under review

What Inventory 2.0 should consider

Necka 4 months ago in Inventory updated by Marti (Lead Developer) 3 months ago 5

Hi Marti, 

here are my thoughts about what Inventory 2.0 should handle:

  1. Hotbar/Quick Bar - It's either a quick access or the pockets of your character. I personally use this as where the player can activate a slot (equip an item) while when the inventory is equipped, you can't click to equip in the inventory.
  2. Number of slots available in the inventory - Basically a setting to state that the inventory has a base of XX slots (quite easy, it defines how many Slots are instantiated in the GridLayout on the canvas. And no, people don't like a weight system :D for the dev it involves always calculating and not forgetting. For the player it's just an annoying limit (which can be here anyway for RPGs!) - this point introduce the notion of: Inventory full
  3. Extensibility of the inventory size as mentionned in #1 - Quite basic too, imagine the player picking up a bigger bagpack that will raise the number of inventory slots by +XX
  4. Inventory organization - That is something I also implemented (#1 and #2) and I can share with you the code for that for inspiration. So it allows to move slots in the inventory or from the inventory to the hotbar and vice versa. it goes well with the hotbar concept. Imagine the hotbar having the slot 5 selected (that's your currently selected weapon for example). You can move you item from inventory slot 8 to hotbar slot 5: it will equip that item. move item from equipped slot in the hotbar to empty slot in inventory or hotbar: move the item and unequip. Move from slot to another slot that is already occupied by an item: swap their position. It basically stick the item to your mouse position and then decide on what to do when you click on another slot. It resets it to the original slot if you close the inventory or click outside of it.
  5. Items stats + custom fields - Be creative but give the dev the possibility to set additional fields for item stats (IE: int. +10 // Firepower: 500 for a gun)
  6. Tooltip - this is also extremely important for any rpg/survival game. Think World of Warcraft, Diablo, Divinity, literally any RPG around here
  7. Other way of equipping - An alternative option instead of left clicking an item to equip/consume, it could be a right click button that shows a context menu (useful if we use left click to re-organize items. But you could also have a little lock button in the inventory to allow re-organization of the inventory and keep the left click for consume)
  8. Stacking limit and allowing multiple stack of the same item: This is really important to have. Many many games have that. So it is simply to limit that for example the item Wood can only be stacked 10 times. if you have 10 woods in a slot and pick-up 1 more wood, it will occupy a second slot. It can trigger an inventory full message
  9. Containers: Same rules as inventory - Slots amount limitation, re-organization, stacking limit (should be on the item anyway), naming the container (so the player can have maybe a wood container, a rock container etc. It doesn't limit what kind of items you put in there (even though it could be interesting) but just a name for the player to see 
  10. Containers owned by the player - To be fair I did not play with Containers yet but in case it is not how it is: some defined containers should the Player's inventory extension. So for other systems to look into the player inventory will check also the containers content (example in #11)
  11. Crafting evolved - Crafting should be kept simple but the option should be given to look up for more than 2 items to craft and this should be in an external GUI with blueprints possibility. Blue prints is for example a gray item in the Crafting UI, when you click on it you can see the requirements. The crafting system checks the player inventory (AND ITS CONTAINERS!!) and if the components are there, the crafting button is not greyed out for example
  12. On death prefab drop - simply a prefab item that the dev chose to have when the player dies. It basically drops the content of the inventory on the ground where player died and if the player pick-it up it restores the inventory (the container inventory is of course protected - think Minecraft

I'm sure I forgot things or will have other ideas, but here is my first version

+1
Fixed

Important piece of Inventory docs outdated

mode80 3 months ago in Inventory updated by Marti (Lead Developer) 3 months ago 1

Docs here claim that the inventory UI prefabs are located at "Assets/Plugins/GameCreator/Inventory/Prefabs/"

But it appears they're actually installed at "Assets/Plugins/GameCreator/Inventory/Skins"

Answer
Marti (Lead Developer) 3 months ago

Thanks for the heads up Mode80! Just fixed this in the documentation.

+1
Fixed

Inventory Container Bug

Eric Mathiasson 4 months ago in Inventory updated by Marti (Lead Developer) 2 months ago 3

I discovered a bug in the inventory module when using the container script.

When you loot all items from a container, switch scene, and open the container again, all items are back.

But if you remove all but one item and do the same, it works as espected.

Scenario (steps to reproduce):

  • Create a container and put some items in them
  • Play the game and loot the container from all items
  • Save game and transition to a new scene
  • Go back to the previous scene and open container
  • Container now holds all original items, as it was re-filled with the default items

I have not tried this with a Loot Table yet, only with pre-defined items in the container

Proposed solution:

File: GameCreator/Inventory/Mono/Container/Container.cs

Update the OnLoad() method to always flush the data variable before looping over the received items as such:

        public void OnLoad(object generic)
        {
            Container.Data newData = generic as Container.Data;
            if (newData == null) return;

            this.data = new Data();  // <--- Add this line

            foreach (KeyValuePair<int, ItemData> item in newData.items)
            {
                int uuid = item.Value.uuid;
                int amount = item.Value.amount;

                if (this.data.items.ContainsKey(uuid))
                {
                    this.data.items[uuid].amount = amount;
                }
                else
                {
                    this.data.items.Add(uuid, new ItemData(uuid, amount));
                }
            }
        }

This seems to fix the issue, since now, the container always resets whenever loaded data exists, and then gets updated with those items that should be there.

Cheers!

Eric

Answer
Marti (Lead Developer) 2 months ago

Fastest bug fix ever. You are 100% correct about clearing data property. Thanks! I'm marking this issue as fixed and it will be available in the upcoming Inventory update 1.0.1.

0

Climbing an object

Pandar 2 days ago in Inventory 0

Hey. Tell me, please, how to implement climbing into the GC?

0
Under review

GC Inventory & Invector cont.

Pandar 6 days ago in Inventory updated 6 days ago 2

Hey. Has anyone tried to use GC Inventory and a character with an Ivector Controller? The character has both a “hook” and a script “PlayerEquipment” - but things from the inventory do not attach.

0
Answered

Limiting items in inventory

Oliver Marshall 1 week ago in Inventory updated by Marti (Lead Developer) 6 days ago 1

Is it possible to limit the number of items supported in the inventory?

 

I can see a weight limit option, but I'm after a number-of-items option. Perhaps where the bag only holds, say, 10 things. 

I could give each one a weight of 1 and limit it to a weight limit of 10, but that also prevents me from using weight in the future.

Olly

Answer

Hi Oliver;

You're correct; there's currently no way to do that without using the Weight. However, you can also limit the amount of items stacked (not sure if this will help).

Games usually have a per-weight limit or per-amount-of-items constraint, but not both (usually, since makes it would make it more difficult to manage).

0
Under review

Adding Custom Skin to Inventory Breaks Things

Cr4shBarcode 1 week ago in Inventory updated 6 days ago 2

Okay, I've come back to working with the Inventory module after a long hiatus (it wasn't working). I disabled, then removed the module from the module manager, then re-imported it. That seems to fix everything and bring it back to square one, with the downside that it deletes everything I adjusted.

The issue now is that every time I use a custom inventory skin as opposed to one of the defaults, something stops working. I made the custom skins by duplicating one of the defaults and replacing the images with my own. Nothing crazy.

Currently, the "on drop" trigger has stopped working. With a default skin, dropping the key from the inventory onto the door makes the door open (I use the example scene to test). When I replace the skin with my own, dropping the key on the door does nothing. The inventory stays open, and none of the actions follow. I switch it back to the default skin and everything works.

I also noticed that when I create custom items to the inventory catalogue, they flat-out don't show up in the inventory. To make something show in the inventory, I have to change the name, sprite, and prefab of one of the default items. My game has dozens and dozens of inventory items to add-- what will happen when I run out of default items to customize?

0
Planned

Item acquire / Quest status

Denarius 2 weeks ago in Inventory updated by Marti (Lead Developer) 6 days ago 1
I am working on my first quest where certain items need to be acquired in order to continue. In the screenshot below, I have a Brazier which when clicked adds to Inventory and also marks the quest status as complete. I feel this is sub-optimal to embed the logic within the Item, since the item can always be dropped and the quest status is not changed to Incomplete.

Where should I be doing that? I think there should/could be a script that runs on every inventory change and manage the quest toggle there, but haven't been able to find an example.

0
Answered

Integrating Inventory with in-game UI

Oliver Marshall 2 weeks ago in Inventory updated by DigitalProphet 2 weeks ago 2

Hi

Is a GC inventory able to be queried via scripts?

I want to have a small inventory (3 or 4 items) and I want those items shown in the main in-game UI, so on the screen in the current game scene. 

I'd need to be able to find the number of items in the inventory, the item names, the thumbnails, and which slots each item is in. 

Can that be done?

Olly

Answer

Hi Oliver;

Definitely yes. Let me run you on how to do this. The base class from where to access any inventory information is the "InventoryManager". It's a singleton, so it can be accessed from anywhere like this:

InventoryManager.Instance

To access the Player's inventory items you can do it like:


InventoryManager.Instance.playerInventory.items

The "items" property is a Dictionary of type <int, int>. The key of the dictionary represents the ID of the item, and the dictionary's value represents how many of that item is in the player's possession.

Now, to access the item's avatar, name, description and the rest of its properties, you'll need to use that ID and access the item's catalogue. The item's catalogue is also contained inside the singleton instance of the InventoryManager.

For example, if you have a variable called "myItemID" which contains the ID of an item and ant to get the name of that item, do:

InventoryManager.Instance.catalogue[myItemID].itemName.GetText();

Note: Name and description are texts that can be localized, so instead of being a string value, they are LocString (which stands for localized string). In order to get the value of the localized string, use the GetText() method.

That's it. Let me know if you have further questions. Cheers!