Having weapons only added to Hotbar

nathanj

Active member
Hello again,

This possibly belongs in the main thread but since I'm using UCC I figured it might belong here. But feel free to move if you disagree.

I would like to have my weapons add directly to the Hotbar when picked up, is this possible?

Thank you,
Nathan
 
This is not possible out of the box, but you can use a bit of custom code with event listeners to set that up yourself.

Here are a few events from the documentation that might help.
Code:
EventHandler.RegisterEvent<ItemInfo, ItemStack>(m_InventoryBridge.Inventory, EventNames.c_Inventory_OnAdd_ItemInfo_ItemStack, OnAddItemToInventory);
EventHandler.RegisterEvent<ItemInfo>(m_InventoryBridge.Inventory, EventNames.c_Inventory_OnRemove_ItemInfo, OnRemoveItemFromInventory);
EventHandler.RegisterEvent<Items.Item, int>(m_CharacterGameobject, "OnAbilityUnequipItemComplete", OnUnequipItemComplete);
EventHandler.RegisterEvent<Items.Item, int>(m_CharacterGameobject, "OnInventoryEquipItem", OnEquipItemComplete);
EventHandler.RegisterEvent<Items.Item, int>(m_CharacterGameobject, "OnAbilityWillEquipItem", OnWillEquipItem);

Feel free to replace the ItemHotbar component by something custom whether its by inheriting the ItemHotbar class, or the ItemViewSlotContainer (to have more control)
you can listen to the OnAdd_ItemIno_ItemStack event to know when an Item is picked up/added to the inventory, and then you can check if that item is a weapon by checking its category or the item collection it was added to, then from there you can choose to add it to you custom hotbar or not.

I hope that helps
 
Top