I have an item spawner that spawns an item (a diamond) as a random response to the player doing something. The player may continue doing that some thing and eventually cause it to spawn another one. And then perhaps another one. Or whatever.
In any case, more than one of the item (the diamond) may spawn and fall down on the ground and combine into a “stack”.
This is the whole Fortnite mechanic. We should all already know how that works.
SO … there’s a diamond laying on the ground. You can’t tell, by looking at it, how many diamonds are actually there. Because more than one of them may be combined in a “stack” if they landed next to each other.
The player walks over and picks it up.
How many diamonds did the player pick up?
Seems like a simple question. I subscribed to the ItemPickedUpEvent
assuming it would be sent once per item. After all, it is named ITEM (not ITEMS) PickedUpEvent. But, nope. It sends it once per pick up, no matter how many items were picked up. And, it does not provide any information about how many were picked up nor provide any sort of interface to obtain such information.
@editable ItemSpawnerDevice : item_spawner_device = item_spawner_device {}
OnBegin<override>()<suspends>:void=
{
ItemSpawnerDevice.ItemPickedUpEvent.Subscribe( OnItemPickedUp )
}
OnItemPickedUp( PlayerAgent:agent ):void=
{
# uhhh ... how many diamonds did the player pick up??
}
The diamonds are in the players inventory. I can clearly see them there. In this example, they picked up 3. So I figure fine, I’ll just query or remove them from the players inventory to see how many were there. And now I’m just starting to think f*ck, are you kidding me? Is there no way to determine how many diamonds are in the inventory using Verse?
At first I thought, perhaps item_remover_device could work. However, it really does not appear to be of any help. The Remove
function doesn’t even return a value indicating how many were removed or if it succeeded or anything like that. And, there does not appear to be any interface for querying the inventory.
So, I am I SOL??
How in the heck is a player supposed to be able to pick up something on the ground and the Verse code know how many they picked up???