Secondary Grenade not return 'Item'

AntL

Member
Hey @Justin , I'm having trouble setting up a secondary grenade on the left hand. Having added a breakpoint to the CanStartAbility function within 'Use', it appears that 'item' is being returned as null which is causing the function to return false. (m_SlotID is being passed as 1)

Capture.PNG

However, when I run this on the working FirstPersonDemo scene, item is returning the 'Item' data. Where am I going wrong?
Thanks for any help

Just to add, I'm pretty confident this is set up as it should be in the inspector and I've ran through the equip troubleshooting. For whatever reason, the grenade isn't being assigned to slot 1..
 

Attachments

  • Capture.PNG
    Capture.PNG
    74.1 KB · Views: 4
Last edited:
Is the grenade currently equipped in a slot? You can see this within the Inventory inspector. My guess is that it is not being equipped. Do you have an Equip Unequip ability that will equip your second ItemSet category?
 
So when I run the game, the secondary grenade isn't appearing with the Slot1 suffix within the current inventory (as yours does in the demo scene). There is an Equip/Unequip ability which again, looks correct to me.
 

Attachments

  • 1.PNG
    1.PNG
    82.7 KB · Views: 7
  • 2.PNG
    2.PNG
    57.7 KB · Views: 7
  • 3.PNG
    3.PNG
    63.1 KB · Views: 7
That looks correct. Does Item Set 0 within the left hand category get selected? Try removing Item Set 1 as a test. Beyond that, one way to debug this is to place a breakpoint within EquipUnequip.ShouldEquip. ShouldEquip should return true when the ItemType is the SecondaryFragGrenade within Slot 1.
 
No, item set 0 within the left hand never gets selected (i.e. doesn't say 'Active' beside it). If I remove Set 1, I get the same result.

If I put a breakpoint, in ShouldEquip, the result is (see screenshot also) currentItem == null, itemCount = -1, shouldEquip = true


and in else if ((m_AutoEquip & AutoEquipType.Unequipped) != 0 && currentItem == null && m_EquipItems[item.SlotID] == null) {

m_AutoEquip = 30, m_EquipItems [0] and m_EquipItems[1] both == null
 

Attachments

  • Untitled.png
    Untitled.png
    65.9 KB · Views: 4
ok, so I've resolved this but I don't quite understand why. As well as secondaryFraggrenade, I added ThrownFragGrenade - and it worked as expected....what's the difference between the two? I thought secondaryFragGrenade was an object time, which you could assign a number to - why would it only work if ThrownFragGrenade exists? Cheers
 
Glad you got it working! On the Throwable Item component there is a Can Equip Empty Item field. When this is deselected it will require the consumable ItemType (which is the ThrownFragGrenade in the demo).
 
Top