question

Thom [not provided] avatar image
Thom [not provided] asked

Questions about rewarding a random item

I'm trying to reward a random item (1 of 320) to a user depending on whether that user owns that item or not using cloud scripting.

Would it be better to compare the user's inventory to the catalog in question in my cloud script instead of using a random drop table and generate a random award based on the leftover items? And if so, how would I go about that after first retrieving them like this:

var userInventory = server.GetUserInventory(
{
PlayFabId: currentPlayerId,
CatalogVersion: "Purchasable"
});

var catalogItems = server.GetCatalogItems(
{
CatalogVersion: "Purchasable"
});

Thanks in advance.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Yes, currently we do not have uniqueness in inventory - the random result tables are designed as classic loot drops, where it's a random selection from all the items in the list. We do have a backlog item for uniqueness - I'll add your name to the list of those asking for it.

The problem with using random drop tables, in this context, is that you would have to have a random drop table for each combination of things the user might have in his inventory, to be able to pick from the ones remaining. That would be a huge number of tables, potentially.

For right now, I would have to recommend using the properties and tags of the items in your catalog to provide info on which items are part of your randomization what weightings you want to use. That way, you can adjust those on the fly, the same as you can for a random result table. When you want to generate an item, you would then use the logic you describe - get the user's inventory and the catalog, so that you can build the list of items from the catalog which are the target of the operation, then remove the items in the player's inventory from that list before using random() to pick something.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.