How do we equip Armor ?

Are you able to advise my what script or place that controls the highlighting for equipped items ?

I works fine for the Weapons and shields, but not for the armour. I would have though its to do with the Actions sets but I don't see anything obvious or the Item view slot container.

is it related to the armour using the "Move to CollectionItemAction" and the Weapons needing to use the "Character Equip Unequip Item action" ?
can you please advise ?

Thanks

1631445207938.png

1631445228249.png
 
Last edited:

Sangemdoko

Moderator
Staff member
Item Actions are only used to run function on items.
Item Views are the ones that draw the item in the UI.

So you want to double check that your Item View prefabs within the ItemViewDrawer component.
1631516384979.png
usually we set the background to blue using a background image when the item is in a specific collections:
1631516494755.png
In your case though, the item view should always show the blue background within the ItemSlotCollectionView, so you could simply set it manually in the prefab instead of using a component to set the background dynamically.
Item Views are super moduler so you can mix and match different item view modules to your liking and even creat new ones.
Between that and being able to spawn different item view prefabs depending on the item category of the item being drawn allows you a ton of freedom on how to show your items in the UI
 
The Item view Draw script just has all, which I would have though is fine.

1631536866237.png

The "Equipped select item view" script has the same defaults as the weapons which work.
I tried changing it to match the Collection ID and the Purpose to match the Inventory script, but it also has not made any change.

am I not referencing the correct collection somewhere ?

1631536818429.png


1631536964796.png
 

Sangemdoko

Moderator
Staff member
It seems good to me.
Are you prehaps not swapping the Item Views at runtime? There is an option to keep the Item Views without spawning them at runtime using the prefabs
1631538244351.png

Check your Item View at runtime, that should let you know if you are indeed using the correct Item View.

As I mentioned in the previous reply, you can have a different prefab for your Weapon Item Views and your Armor Item Views, They don't need to be the same. It's completely up to you. Also the Item Views you'll show in the item Slto Collection Views (aka Equipment panel), will always be "equipped" so you could simply make a prefab with a default blue background instead of setting the background dynamically via script.
 
I would prefer to use it dynamically via script, if I can, but if I need to do that I will.

The Swap Item View On Assign is ticked,

However, the "Equipped selected item view" script its defaulting back on runtime


1631539307502.png

1631539484245.png
 

Sangemdoko

Moderator
Staff member
Well that's odd, If I remember correctly that's the only place you can decide whether the prefab should be spawned or not.
Try making a change to your Item view within your scene at edit time to confirm whether or not it is staying or if it is being replaced.

Could you double check that you are indeed referencing the prefab you think you are. It's possible you have two prefabs with the same name and are confusing them, I know it happens to me sometimes.
 
I updated the "Equipment Collection ID" (Name a purpose) at runtime and it then worked, as seen below for the items that are Equipped, but its didn't highlight the one in the inventory on the left (Which I cant see an obvious place to fix that either).

Any thoughts on why it might be reverting at runtime ?

The only difference I can see is that it creates a clone

1631547506999.png

1631547466408.png
 
Last edited:

Sangemdoko

Moderator
Staff member
Each Item View Slot Container (Inventory Grid, ItemSltoCollectionView, Hotbar, etc...) has an ItemViewDrawer which defines what prefab will be spawned for any Item Category.
You need to create multiple Item View prefab and explicitly define which one should be spawned.
You should have at 3 prefabs (You might want more):
Grid Item View
Armor Grid Item View
Weapon Grid Item View

Make sure that your Item View Drawers are set to draw the correct Item View using the Item Category Weapon, Armor, Null (any other category).
My guess is that you are using the same prefab for Armor and Weapon Item Views and that's what is causing you the confusion.
 
Yeah you were right it was the needing to create the multiple Item View prefab and explicitly define which one should be spawned.

"Grid Item View"
"Armor Grid Item View"
"Weapon Grid Item View"

Thanks

1631607885820.png

1631607951280.png
 
I followed the same process again but the shoulder pads are just spawning in a strange position and I cant move them after being equipped.

I also appears to be spawning two of them

1631882459225.png1631882554837.png
 

Sangemdoko

Moderator
Staff member
I'm looking at the code and I don't see how this could be happening. I made a small change such that the "Main" Skinned Mesh can be specified in the inspector now, instead of automatically picked.
But that doesn't explain why the item would be spawned twice and in two different positions at that.

Could you show me your Equipper inspector, showing Item Object Slot settings for that item?

Also try adding some Debug.Logs within the ItemObjectSlot script inside the "SetItemObject(itemObject, skinnedMesh)" function. That might give us a lead as to why the item is being spawned twice and why in two different parents and none in the right one.
 
Hi Here is the Equipper script, I have tried changing the Transform to see if it move to the correct location but didn't worked.

I have also tried doing this for the helmet and had the same kind of issue.

1631891227071.png

debug log for the helmet

Debug Item Info: 1 Elf Helmet (949308979) || ItemCollection Armor Equippable (None) || ItemStack(-194749696)[ 1 Elf Helmet (949308979) in ItemCollection Armor Equippable (None)]
With Definition "Elf Helmet" | Category "Helmet" | and Attributes:
Armour Value : 10
BuyPrice : Silver x3
SellPrice : Silver x2
Description : Armour Will Increase the Protection when taking damage
Game Icon : 3_Mail_head (UnityEngine.Sprite)
Icon : Helm_49 (UnityEngine.Sprite)
EquipmentPrefab : Elf_knight Helmet 1 (UnityEngine.GameObject)
UsableItemPrefab : Elf_knight Helmet 1 (UnityEngine.GameObject)
DropPrefab : Elf_knight Helmet 1 (UnityEngine.GameObject)
Attribute : 0
UnityEngine.Debug:Log (object)
Opsive.UltimateInventorySystem.ItemActions.DebugItemAction:InvokeActionInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo,Opsive.UltimateInventorySystem.ItemActions.ItemUser) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/ItemActions/DebugItemAction.cs:58)
Opsive.UltimateInventorySystem.ItemActions.ItemAction:InvokeAction (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo,Opsive.UltimateInventorySystem.ItemActions.ItemUser) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/ItemActions/ItemAction.cs:97)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ItemActionPanel:InvokeActionInternal (int) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ItemActionPanel.cs:66)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1<Opsive.UltimateInventorySystem.ItemActions.ItemAction>:InvokeAction (int) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:119)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1/<>c__DisplayClass13_0<Opsive.UltimateInventorySystem.ItemActions.ItemAction>:<OpenInternal>b__0 () (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:69)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:press () (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:72)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:OnPointerClick (UnityEngine.EventSystems.PointerEventData) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:123)
UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:377)




Shoulder Pad

Debug Item Info: 1 Elf Pauldron Armor (2102272908) || ItemCollection Armor Equippable (None) || ItemStack(-1910987008)[ 1 Elf Pauldron Armor (2102272908) in ItemCollection Armor Equippable (None)]
With Definition "Elf Pauldron Armor" | Category "Pauldron" | and Attributes:
Armour Value : 10
BuyPrice : Silver x3
SellPrice : Silver x2
Description : Armour Will Increase the Protection when taking damage
Game Icon : armor_icon (UnityEngine.Sprite)
Icon : 17_Leather_Shoulder (UnityEngine.Sprite)
EquipmentPrefab : Elf_knight Pauldron Armor 1 (UnityEngine.GameObject)
UsableItemPrefab : Elf_knight Pauldron Armor 1 (UnityEngine.GameObject)
DropPrefab : Elf_knight Pauldron Armor 1 (UnityEngine.GameObject)
UnityEngine.Debug:Log (object)
Opsive.UltimateInventorySystem.ItemActions.DebugItemAction:InvokeActionInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo,Opsive.UltimateInventorySystem.ItemActions.ItemUser) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/ItemActions/DebugItemAction.cs:58)
Opsive.UltimateInventorySystem.ItemActions.ItemAction:InvokeAction (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo,Opsive.UltimateInventorySystem.ItemActions.ItemUser) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/ItemActions/ItemAction.cs:97)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ItemActionPanel:InvokeActionInternal (int) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ItemActionPanel.cs:66)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1<Opsive.UltimateInventorySystem.ItemActions.ItemAction>:InvokeAction (int) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:119)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1/<>c__DisplayClass13_0<Opsive.UltimateInventorySystem.ItemActions.ItemAction>:<OpenInternal>b__0 () (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:69)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:press () (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:72)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton:OnPointerClick (UnityEngine.EventSystems.PointerEventData) (at Assets/Character Controller/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:123)
UnityEngine.EventSystems.EventSystem:Update () (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:377)
 

Attachments

  • 1631891438437.png
    1631891438437.png
    298.6 KB · Views: 0
Last edited:

Sangemdoko

Moderator
Staff member
What happens if you set the Transform to "None"? That's how I have it setup usually for skinned Mesh items.
When I have time I'll try to replicate your setup to see if I can replicate the issue.

If I can replicate the issue then I should be able to fix it.

Aslo can you show my what prefabs you've set for "Equipment Prefab" and "Usable Item Prefab" attributes?
 

Sangemdoko

Moderator
Staff member
Ah I see now... I'm very sorry it wasn't very clear.

The Equipment Prefab is the prefab what will be shown visually is shouldn't have any code on it normally.
The Usable Item Prefab is the prefab that does not have any visual part, but has the code to use the item.
Normally you spawn the UsableItemPrefab and then spawn the Equipment prefab as a child. Example Usable Sword as the parent and then any Sword Model as the child. So the Usable Item Prefab is usually a Category Attribute while the Equipment prefab is usually an ItemDefinition attribute.
In the integration you'll never use the "usable Item Prefab" normally because you'll use the UCC system to use weapons and not UIS.

So I'd recommend simply removing the Usable Item Prefab attribute from your items.

I will update the documenation on the Equipper page to explain it more in depth. And I'll also update the integration documentation page.

I'm very sorry about that, I should have explained this better from the start.
 
No worries, its good just to get the help, I removed the Usable Item Prefab and Its now only spawning the one Armor piece.

Although its still spawning them in the wrong place (just a side note, the chest piece is working correctly)

1631897025680.png

1631897070583.png

1631897094858.png
 
Last edited:

Sangemdoko

Moderator
Staff member
So from the images I see that the Helmet and the shoulder pads ar placed incorrectly.
Can you confirm that the "Character" and "Armor" transforms are position 0,0,0, rotation 0,0,0 and scale 1,1,1?
If you were to spawn the armor without defining a parent (in the Equipper inspector in the ItemObjectSlots) does it work correctly?

If not my assumption is that the problem comes from the rig. Is it possible that your character rig does not match your helmet or shoulder pad rigs?
 
Hi

Armour transforms transforms are position 0,0,0, rotation 0,0,0 and scale 1,1,1

spawn the Armor without defining a parent (in the Equipper inspector in the ItemObjectSlots) - Nothing in the Transform or Item object

I copied my character and then deleted everything as you did in the tutorial video, so I am not sure where this would have gone wrong with rig.

tried it with both the helmet and the pauldrons

1632301870664.png

1632302031997.png

1632302307579.png
 

Sangemdoko

Moderator
Staff member
All seems good...
I'm afraid the only way to go forward with this is by sending us your character and armor models such that we can try it out ourselves.
You can send us a package at support@opsive.com. Make sure to test the package before you send it, to make sure there aren't any compilation errors or depedencies missing.
Make sure to reference this post in your email.
Once I have some time I'll check it out and let you know how to fix the issue.
 
I am not sure what exactly you want to me send, are you asking for a copy of the project (Unity file to download) but cut down to just the controller ?
 
Top