Runtime Item Pickups & Drop Item Ability

CitrioN

New member
Hey,

I'm trying to get runtime pickups working without having the character pick up a new Item (including perspective, weapon, visible item etc.) and attaching it to the hierarchy every time.
I've seen that the demo scene does not define an item for the first assault rifle item pickup but that requires the item childed to the item placement beforehand to work which is not an option for my game.
I noticed the item pickup script will always pickup a new item if I define one but if I don't the item has to be in hierarchy before it is picked up to be usable.
This will result in the player getting more and more of the same item childed to the ItemPlacement object.
The same is true for the visible item below the item slots.
I also noticed that the drop item ability will only drop the items from the inventory and leave the item and visible item in the players hierarchy untouched.
I've manually tested what happens if I delete them manually but unfortunately picking up the same item with the ItemPickup will not work at all if I do.
My questions about this is if there is any internal caching on those items/visible items in the hierarchy that could interfere in that case?
Is there anything I missed in the documentation that would help me with this case?
My goal is to remove all the related information to a particular item (item placement, slots) when it is dropped so I have a fresh item the next time I pick it up.
 
@CitrioN I'm literally experiencing this same issue, glad it's not just me.

I think I need the same thing as you:
- Pickupable item that is not something you 'keep' after use/drop
- For me, it's an object that players pickup and is automatically equipped, then they can only use 'Fire1' input to use/fire it, OR they can drop it
- Changing weapons is disabled (not necessarily anything to do with this issue, just fyi)

So yeah the issue is that when dropped it spawns the Object_Pickup in it's place, but leaves behind the Item in the 'Items' object within the root of the character. So each time I pick it up it adds more and more. I like you, need this object to be completely removed from Inventory,ItemSet, and the Character as it is not a 'kept' item, just a temporary use but can be dropped to come back to later.

I too tried deleting or destroying this on the drop, but then when I go to pickup the item again everything breaks.

Happy to manually do what needs to be done, but I'm not sure what exactly that is?

Could it be this?
- Remove/destroy the 'item' from CharacterRoot > Items > 'Item'
- Remove the ItemSet
- Remove from Inventory

You had progress on this @CitrioN ??
 
Also weirdly, my object drops in the literal place the player is holding it at the moment of drop. How do you get it to drop the prefab at its normal rotation? I'm not using gravity on it as I don't want it to get lost lol
 
Last edited:
Items in the character's hierarchy are a separate thing from items in the character's inventory or items they're using. But yeah the item definitely shouldn't be getting added to the hierarchy more than once if it already exists, so hopefully this will be fixed in an update soon.

As for dropping an item, you'll need to add some extra logic to place the object in a specific position e.g. clipping it to the floor. You could use the "Drop Item Event" in the Item component for this.
 
Thanks @Andrew I'm still testing the effect of the item that gets left behind In hierarchy as child of 'items'.

What I'm experiencing is that I think I can manage even with this leftover except for couple of things kind of getting in the way:

1. While this object is active I make it enable a state that allows the 'drop' ability, (my other items do not). Problem is it remains after drop, so I have to work a way of disabling on drop rather than the object no longer existing therefore the state not being active.

2. After dropping this item the auto equip doesn't work when picking it up again. Is this the 'first time' option not being reset? Is there a way to manually reset this item memory or a way so that anytime this individual item type is picked up it will always auto equip? (I don't necessarily want other items Auto equipping on pickup).

Re: dropped prefab I find it odd that it drops in the exact transform of the item at moment of drop...does it inherit from the held item at that frame?
 
@CitrioN
So yeah the issue is that when dropped it spawns the Object_Pickup in it's place, but leaves behind the Item in the 'Items' object within the root of the character. So each time I pick it up it adds more and more. I like you, need this object to be completely removed from Inventory,ItemSet, and the Character as it is not a 'kept' item, just a temporary use but can be dropped to come back to later.

You had progress on this @CitrioN ??

Hey,

sorry for the late reply. Didn't check this during the holidays :)

It looks like the latest update to the asset fixed the issue with the same item getting added over and over.
What happens is that it does retains the item under Items and the visible item too but reuses those if you pick them up again.
This does not remove the associated ItemSet from the ItemSetManager but since it does remove it from the Inventory you can't equip it.
This fix, even if the behaviour is not what I originally thought would be intended, works for me. Maybe it does for you too
 
@CitrioN ok good to know about the update, I think I just resolved to have the added Items and tweak a few things so it doesn't interfere with the mechanic I use that item for, so not causing a problem ATM

Vlaxep
 
Top