This feature is in an experimental state so you can try it out, provide feedback, and see what we are planning. You cannot publish a project that uses Custom Inventory and Items at this time.
Please keep in mind that we do not guarantee backward compatibility for assets created at the Experimental stage, the APIs for these features are subject to change, and we may remove entire experimental features or specific functionality at our discretion. Check out the list of known issues before you start working with the feature.
Items and inventory systems are a critical part of many kinds of games. Using Scene Graph's entities and components, you can customize Fortnite's player inventory, and create custom items unique to your island.
Items are objects in an island that players and agents can use and own. Inventories include the existing Fortnite player inventory, as well as any custom inventories you create with the inventory_component. Custom Inventory and Items is a system for creating, controlling, and storing items. This system is an experimental feature that you need to enable in Project Settings, and you use it with Scene Graph in UEFN and Verse.
Scene Graph Basics
Scene Graph is an entity and component system, built on top of Verse. Entities are containers for components, and components give an entity functionality. You can attach entities to each other in a parent-child relationship, which creates hierarchies. Reusable arrangements of entities and components are called prefabs. For more information on entities and components, see Working with Entities and Components. For more information on prefabs in Scene Graph, see Prefabs and Prefab Instances.
Known Issues
Custom Inventory and Items is the first system to leverage Scene Graph in UEFN. Because of that, there are a number of bugs in the Experimental release that you might encounter when using this system. You can find the list of known issues here. We are working on many fixes and improvements which will be included in a future release.
Items
An item is an entity in Scene Graph that has an item_component. By default, items can be merged and stacked, can have categories for comparison and sorting, and can be equipped and unequipped.
Since the Custom Inventory and Items system uses Scene Graph, you can add components to items to increase their functionality. The system comes with several basic components to start with, which are listed in the table below.
| Component | Description |
|---|---|
| This component makes an entity an item. It also gives the entity the ability to be stacked, and to be owned and controlled by an inventory. |
| This stores an icon for the item that is displayed in the Fortnite UI. |
| This contains text data such as the item's name and description. |
| This stores a mesh asset that represents the item in the game. |
| This component allows the item to be treated the same as a Fortnite item pickup. This includes an interaction prompt to pick it up, UI, and pickup/drop animations. |
An item can only have one component of each type. This includes components that inherit from other components that are already attached to the item.
So for example, if you create a custom component for a specific item that is a child of the item_component, your custom item component would display instead of the generic item component.
Item Modularity
With Custom Inventory and Items, we can introduce proper modularity. This means you can use components to build item functionality additively. Below are examples of components attached to an item entity that grant functionality.
Entity
item_component: makes an entity an item.item_details_component: stores text data such as the item's name and description.item_icon_component: stores an icon for the item that displays in the Fortnite UI.mesh_component: stores a mesh asset that represents the item in the game.
Inventories
An inventory is an entity that has an inventory_component.
Inventories are containers for item entities and the inventory controls what happens to those items.
The Custom Inventory and Items system uses inventories and sub-inventories to compartmentalize items. This makes it easier to sort, add and retrieve items within an inventory. Since an item may only exist inside one inventory at a time, inventories also determine the ownership of item entities.
By default, inventories can hold an infinite number of any kind of item. However, you can create restrictions and rules that determine which items can be added. Some examples of these restrictions and rules:
Add items to an inventory only if they meet the required type query.
Limit the number of items in an inventory.
Allow items of higher priority to eject items of lower priority when the inventory is full.
Restrict an inventory to a single item.
When an AddItem() function can't resolve on the target inventory, it looks for other inventories that could potentially hold the item. The function uses Scene Graph hierarchies
— it will first attempt to add the item to sibling inventories (inventories that share a parent with the initial target inventory), then it will look at child inventories (inventories that are parented by the initial target inventory). The function will check all inventories in the hierarchy before returning a fail.
In the above image, the following inventories would have a chance to receive the AddItem() request: SubInventory #1, SubInventory #4, and SubInventory #5.
Inventory Filtering with Scene Events
When an inventory is targeted with an AddItem() function call, it will receive a scene event (add_item_query_event). By overriding a component's SendDown() function, custom logic can be triggered to affect the entry of the item. This allows for inventory rules, such as checking the item type before allowing, only allowing a certain number of items in the inventory, and so on. The SendDown() event is implemented in the base component class and is available to all Scene Graph components.
The add_item_query_event collects a response from the inventory it targets. You can choose to veto the adding of the item by providing an error to the event. The add_item_query_event holds an array of errors and can be updated with a unique error based on your inventory rule. For example, I could write a new error which can be instantiated and added to the errors array if the inventory is full.
Fortnite Inventories
Custom Inventory and Items comes with a number of inventory_component subclasses, called fort_inventory_components. These have item filtering and UI elements that mimic the Fortnite Battle Royale player inventory.
| Component | Description |
|---|---|
| Corresponds to the Harvest Tool slot of the default Fortnite player inventory. |
| Corresponds to the hotbar of the default Fortnite player inventory. |
| Corresponds to the building tools hotbar of the default Fortnite player inventory. |
| Corresponds to the trap slot of the default Fortnite player inventory. |
| Corresponds to the currencies section of the default Fortnite player inventory. |
| Corresponds to the collectibles section of the default Fortnite player inventory. |
| Corresponds to the ammo section of the default Fortnite player inventory. |
You can also create your own configuration of sub-inventories to add to, remove from, or replace the default player inventory.
Items and inventories are as simple or complex as the number of components that are added to the item or inventory entity. As the Custom Inventory and Items system continues to be developed, more components will be added that provide even more functionality.