How do I use ItemPickedUpEvent ?

That’s how you cast the agent to a player, as for getting the item that was picked up and by which spawner, looking at the docs (item_spawner_device class), currently there aren’t any members which provide that information, unless I’ve missed something.

This may not be the most elegant solution, but you could have separate item spawners as their own @editable prop and assign them to your creative_device, say one with a Pistol and one with an Assault Rifle.

Then in that custom device’s Verse script, subscribe to each spawner individually but pass through a unique callback function to the Subscribe method depending on the spawner/item. Example: ItemCollectedPistol and ItemCollectedAssaultRifle.

That way when a player picks up the item up from that spawner, only the specific method you requested gets fired, so that way you know which spawner, which item, then if you cast Agent to Player in that method, you also know the player. Not sure how to get the players inventory yet, but there is a post here asking the same question which you might want to set up notifications for!

1 Like