Inventories for NPCs

Hi Magic Timm

An Inventory is a component that stores a collection of items organized in groups called ItemCollections. It doesn't do anything more than that.

That means you can use the Inventory component for anything: character, npc, chest, pickup, shop, etc...

Check out the demo. You'll see that the character, enemies, shop, pickup and chest all use Inventories. They all have other scripts that use the Inventory to do other things, like equipping, exchanging items, etc...
 
Hey, ok. I had remembered that some time ago it was said that this is not possible. I want to use it with the behaviour designer. I have an inventory system that works but it has no editor options like your UIS. But until now my system has no equipment.
The thing I need it that a npc (i have up to 20 in my game) can pick up an item, store an item and drop an item. And the npc should have an small equipment. Is this possible (with not much work) ?
 
You will need to program your own enemies.

Picking up and dropping items shouldn't be very hard, equipping cloths and weapon should be fairly simple using the Equipper script. The Equipper script is quite limited in scope, so if you wish to do some complex equipping then you may want to look into writing a custom Equipper.

Like I mentioned in the previous post, you should check out the UIS Demo: https://opsive.com/demos/ultimate-inventory-system-demo/
There are enemies on the right of the map. They use the same weapons as the character as Equipment. And when killed they drop items. It does not use Behaviour Designer obviously but the idea would be similar.

It will require some work, but most of your use cases wouldn't require custom scripts.
 
Thanks for your answer. I bought the asset after I watched the demo.
What do you mean with "complex equipment"? I need 4 equipment slots (head, body, legs, weapon).
What do you suggest if i have no player character? I have some npcs and all should have an equipment and an inventory with max 3 slots. I do a lot in my game with some managers singletons. Could it be a good way to have a singleton game object inventory manager and use it as a player for the UIS? Besides the npcs the game have storage boxes.
 
By complex equipment I mean equipment that changes the character or other items when equipped. It could also mean items that prevents other items from being equipped. Example a two handed weapon can't be equipped with a shield. That's not possible to do without writing a custom Equipper script.
In your case you shouldn't have any issues.

If you do not have a player character in your game but still want an inventory for the player to interact with in the UI, you could add one on an empty game object, or together with your singletons if you want, although I prefer keeping those separate.
 
Back
Top