Inventory and Quickbar
Last updated
Last updated
NOTE: This page has been deprecated, in favour of The Inventory System
Item: See How to Make an Quickbar Item for details on how these are represented.
Of these, some are considered “Use Items” - these are items that can be equipped/added to your Quickbar, and have actions that can be performed when selected.
Inventory: This is a list of all the Items you own (use items and other types).
Later down the line, we will want ways of viewing this, but for now it’s hidden away.
Equipment: This is a list of Use Items (Items with Use Item Details
) from your inventory.
These “equipped” use items are what are then displayed in your Quickbar
Of these equipped items, one can be “selected” - this marks it as the active item, to then perform functionality on e.g. mouse click.
Quickbar: This is a visualization of your currently equipped items.
NOTE: Currently the icons in the quickbar are wrong (due to us not having the correct icons yet. The controls are:
Q - unequip
1 - equip slot 1
2 - equip slot 2
3 - equip slot 3 (if we increase Inventory.MaxEquipmentSlots
to 2)
An item is defined using a J_ItemPrimaryAsset
.
If you want to make a new item, use Right Click -> Miscellaneous -> Data Asset
.
The main fields to consider are the Display Name
, the Icon
, and the Custom Item Details
(see Custom Item Details)
In the Custom Item Details
list, add a J Use Item Details
entry. This is used to provide the details required by use items. If no J Use Item Details
object is provided, the item will not be treated as a “Use Item”, so will not be allowed on your quickbar.
Once the Use Item Details
has been provided, you can provide use item specific details, such as the abilities and UI associated with the item (see Give the item an ability)
If you want your item to be interpreted as a specific “item type”, or have additional details that aren’t present in a base item, you can create a new item detail type, and add it to this list.
When you make the item detail type, make it inherit from J_ItemDetailsBase
When you do this, your new detail type can be added to the list, and any variables in this type can be configured from the J_ItemPrimaryAsset
You can then access the detail from a given item asset, using the GetCustomItemDetails
function. This will return null if the item asset does not contain those details (so this can also be used to check whether the item is of the specified type - e.g. you can check for the presence of J_UseItemDetails
to know whether the item is a use item.
This is the currently desired use case - when you switch to a particular role, your Quickbar is automatically set up, with a defined list of items
In the appropriate roles data table, add the item assets you want to the Starting Inventory Assets
list.
For now, we’re only wanting non-participants to have Quickbar items, so the place to add this is the non-participant roles (e.g. Presenter
), in the DT_Parkland_Roles
table.
The entries in the list are the “Item Assets” made in the previous section
Once these have been updated, you can switch to the role (e.g. using /role presenter correctflipcarrot
in the text chat) and your Quickbar should be automatically set up.
NOTE: The Inventory.Enabled
live config flag must be set to true
for your Quickbar to be displayed
NOTE: The number of slots in your Quickbar/equipment is controlled by live config (Inventory.MaxEquipmentSlots
). For now we're wanting the slots to match the number of items (so we don’t have any empty slots), but this may change later.
NOTE: By default, if you don’t have any items equipped, your Quickbar is hidden. If you don’t want this behavior, you can turn off the Inventory.Quickbar.HideIfEmpty
feature flag.
What’s going on under the hood
When you switch to a role with a starting inventory, a few things happen:
The items are added to your Inventory
The items are Equipped
(added to your quickbar from your inventory)
(Also, if switching from a role which had a starting inventory, those items are removed first)
We also have some console commands for testing out the inventory system, for e.g. granting and equipping different items:
Juno.Inventory.AddItems [ItemName list, separated by spaces
- will add the item(s) to your inventory.
e.g. Juno.Inventory.AddItems PDA_Item_Pointer PDA_Item_Coin
NOTE: Adding an item to your inventory will not automatically add it to your quickbar, since it doesn’t default to being “equipped”.
Juno.Inventory.RemoveItem [ItemName]
- will remove the item from your inventory
Juno.Inventory.EquipItem [ItemName]
- provided the item is in your inventory, equip it (which will add it to your quickbar)
Juno.Inventory.SelectItem [ItemName]
- selects the item, provided it is equipped (functionally the same as pressing e.g. 1, 2, 3 to select the appropriate item)
This is possible, but not currently a desired use case. I’ll expand on this section later as other approaches for adding items/equipment become necessary
NOTE: This flow assumes the abilities themselves have already been created. For guidance on how to make abilities, see the following documentation: Morpheus Abilities
There are 2 ways to link an item to some functionality:
For items that don’t have custom behavior, and just need to have e.g. “do ability X
on mouse click”, this will work:
In the Item primary asset, in the Use Item Details
, set the Item Executor Class
to J_ItemExecutorBase
This gives it the basic functionality of “Left click → Execute Ability 1”, “Right click → Execute Ability 2” (if the abilities are provided)
See The ItemExecutor
In the Ability Assets
list, add the ability assets you want to use. The asset at index 0
will be executed on Left Click, and the asset at index 1
will be executed on Right Click (if it exists)
Set the Quickbar Widget Class
to display the appropriate UI for your item.
(If you’re experimenting with a feature, and don’t want to deal with UI yet, WBP_QuickbarWidget_Base
should work fine as a placeholder)
ItemExecutor
)For items that want to do something more complicated than just executing an ability (e.g. if you want to modify a parameter on the ability on Right Click), you’ll want to use this.
In the Item Asset,
Leave the Ability Assets
and Quickbar Widget Class
fields blank.
Make a new Item Executor (A new blueprint that extends J_ItemExecutorBase
, and set the Item Executor Class
to that.
You can then control the behavior of the equipped item through the new Item Executor. See the section below for details on how this is done:
The ItemExecutor
is the class that handles what functionality is done when a given item is selected. It has the following details that can be overridden in blueprints, to make your item do specific functionality:
Class Defaults → Specify Abilities
:
If this is true, we will control the abilities used by the item here, in the Ability Assets
field. (It will ignore any abilities defined in the Item Asset)
This is useful if the Item Executor expects/depends on a particular ability for the given item.
Class Defaults → Override Widget Class
:
Same as above, if this is set, it will ignore the widget used in the Item Asset, and use this one here.
Event Initialize Executor
:
This is an overridable event called after the item in your Quickbar has been selected, once the executor has been set up, and has loaded all the abilities.
The default behavior for this event is to “activate” all the abilities (e.g. to turn on targeting or the like). If you don’t want this behavior, don’t call Parent: Initialize Executor
- you can instead manually call Handle Activate
when you want.
You can use GetAbilitiesList
after this point to get the loaded abilities defined from the Ability Assets
list.
Event Primary Input
:
This is an overridable event called when the primary input (currently Left Mouse Click) is modified - Pressed = true
when it is pressed, Pressed = false
when the button is released.
By default, this event will execute the first ability in the abilities list (if one exists). If you want this behavior (e.g. you have an ability, and want left click to perform the ability), you don’t need to implement the event.
If you want other behavior on left click pressed/released (e.g. clicking modifies an ability, that right click then performs), you can override the event.
Event Secondary Input
:
Same as Event Primary Input
, but on the secondary input (currently Right Mouse Click). By default, it’ll attempt to execute the second ability in the abilities list, if there is one.
When a Quickbar item is selected, it’ll attempt to create a J_QuickbarExecutorWidget
for that item, defined either in the Quickbar Widget Class
on the Item Asset, or the Override Widget Class
in the Item Executor. If you want to provide specific UI for your use item, create a widget extending J_QuickbarExecutorWidget
. This can be used to display controls for using the item, or adding extra details about the item, e.g. displaying the color of the ability, controlled in the ItemExecutor
.
The Widget blueprint has the following details that can be overridden:
Event Notify Item Executor Ready
- this is called when the item executor (and its abilities) has been set up. Initialization logic for the widget should be done here, if it depends on the existence of the item executor. (e.g. listening to updates on the status of the ability)
The item asset: PDA_Item_Pointer
It leaves the Quickbar Widget Class
and Ability Assets
fields blank, since these will be provided in the bespoke BP_ItemExecutor_Pointer
(see Bespoke items (using a custom ItemExecutor))
The Item Executor: BP_ItemExecutor_Pointer
It has overrides for the ability assets and quickbar widget, since the pointer expects a particular ability (PDA_Ability_Ping
) and associated UI (WBP_QuickbarWidget_Pointer
)
It doesn’t override Event Primary Input
, since it uses the base behavior of activating the first ability in the list (PDA_Ability_Ping
)
It does override the Event Secondary Input
, to update the color that the ability uses. (See BP_PingAbility
to see how the ability itself works)
It has a On Ping Color Updated
event that it broadcasts when the color changes, so that the UI knows to change the “current color”
We update Event Initialize Executor
to handle setup - casting the primary ability to the BP_PingAbility
, and informing the UI of the color
The Quickbar Widget: WBP_QuickbarWidget_Pointer
(NOTE: This example widget was taken before a proper art pass, so the actual visuals & setup will likely have changed)
Has simple input prompts on the bottom left
In Event Notify Executor Ready
, it listens to the OnColorUpdated
event from the item executor, to update the “current color” shown in the prompt.
The following is the recording of a meeting where we went through the following steps, to make an item with a basic ability:
NOTE: This demo video was made 09/06/2022, so some of the steps have since changed. These are as follows:
The UseItemDetails
is now no longer present on the J_ItemPrimaryAsset
by default. Instead, it is a “custom item detail” extending from UJ_ItemDetailsBase
, and is added to the CustomItemDetails
list. See Make the item for the updated steps on how to set this up.