question

entelicon avatar image
entelicon asked

Random Inventory System

I'm trying to create a system where you have 10 "cards" on your screen, that are flipped on their backside so the player would not know what content the card holds.

From there you would be able to select 3 random cards, once you do that, the cards flip over and the user is granted the item that the card displays.

My plan was:

Get 10 random items from the catalog. I've been looking into this a bit and I'm pretty sure I would want to use GetRandomResultTables to gather the items. I would then store these values server sided to prevent exploiting. I was going to use bundles to generate the 10 random items, but that automatically grants the player with the contents, and I don't want that.


When the client selects 3 cards, it detects what ItemId the card relates to from the server, and sends that info to the client, displaying it on the card, along with equipping it to their inventory.

Before trying to do this myself and failing, I was just wanting some advice on the best way to handle doing something like this.


10 |1200

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

brendan avatar image
brendan answered

If your requirements are that you not add the items to the player directly, you could use EvaluateRandomResultTable to get a "draw" from the table whenever you want to. There's no need to do all the work to evaluate the random result tables in your own code. I do see that a recent update to the Drop Tables tutorial added that as an example - I've opened a bug to remove that, since that's clearly causing confusion. The recommendation would be to use the Evaluate... API call.

By the way, I would recommend keeping follow-up questions to an existing thread in that thread, so that folks who encounter the information later can view it all in one place. For those viewing this later, here are the related threads:

https://community.playfab.com/questions/12001/getrandomresulttables-question.html

https://community.playfab.com/questions/11999/stacked-droptable-question.html

10 |1200

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

dragonfoundry avatar image
dragonfoundry answered

A more efficient solution might be to use a random result table to generate the 3 items, then have your client display 10 cards, and display one of the three items on each of the 3 clicks. That'll be the most responsive way of doing things, uses the fewest PlayFab calls, and would still be 100% secure.

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.