Custom Item Data
Custom Item Data opens up a number of options for modders to customize their Primal Items. In its most basic application, Custom Item Data can be used to modify the title and description of the tooltip that appears when players hover over items in an inventory. For this tutorial, we'll be creating a simple read-only item based off of a "Starting Note" item (the player's implant,) which can be found here: Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Notes/PrimalItem_StartingNote.PrimalItem_StartingNote'; however, this can be done with any Primal Item that appears in an inventory.
Setup & Blueprint Defefaults:
- Make a copy of that blueprint [into your mod project folder], and rename it, etc.
- In your Blueprint Defaults, you'll need to enable: "Use BPInitialize Item" (the blueprint function name is different, BPPreInitializeData), ``"Use BPGet Item Description"``, and ``"Use BPGet Item Name"`` -- this is what we'll use to set the Title and Description of your Primal Item.
- Set My Item Type to Artifact to change it to read-only.
- Create a variable of type Name, call it "Item Data Name" (or whatever you prefer) and set the Name of your Custom Item Data--you'll use this reference in a few places in your graph. In this tutorial, use "InitData"
Implement the following methods:
- BPPreInitializeItem - This graph is where you'll be initializing the Custom Item Data defaults
- BPGetItemName - This simple graph overrides the default function call, returning your custom Item Name
- BPGetItemDescription - This simple graph overrides the default function call, returning your custom Item Description
- Setting Custom Item Data requires that logic to be run from Authority if your changes are to be propagated to all clients, e.g. when you drop the note for another player to pick up.
- IMPORTANT: Make sure you call Update Item after setting your Custom Data otherwise, you won't see the changes to the Primal item in your inventory. You'd have to drop the item and pick it up to force an update -- not ideal, and no guarantee that other clients will see your customization.
- In your BPInitializeItem graph, be sure to expand the Make Custom Item Data node to show the additional fields. There are several arrays to make use of; however, the execution will fail unless you provide each of those unused arrays with an empty array of the corresponding type. This node can be found by right-clicking on your graph and selecting "Make Array" -- turn off context sensitive if you don't find it immediately.
- The initial Custom Item Data can be set through your Primal Item BP defaults as well.