question

Name avatar image
Name asked

Store with random items

A merchant randomly appears in the game and offers to buy random items(with soft or hard currency).

For example, two random common item(each 100 gems) and one uncommon(250 gems). Or just one rare item(1000 gems). The price is static, based on rarity.

Can this be somehow implemented through a store(as I understand it, you cannot select drop tables there)? Or does it need to be done through a cloud script?

Perhaps the correct option is to create a shop with all the items and use the drop tables to choose a random item? But for drop tables, we still need to use a cloud script, since they require server api?

unity3dsdksCloudScriptIn-Game Economy
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

·
Seth Du avatar image
Seth Du answered

I am not sure how you define the random item. If it is like a black box (which is drop table behavior), players only know what they get after the purchase, I think you can define 3 drop tables, where items in different rarity are contained separately, and let 3 bundles/containers have them so that you can add bundle/containers to the store.

If the Store is a global store and the randomly generated items are determined when this store shows up, since store management is administrative behavior, and you may use Admin API SetStoreItems or UpdateStoreItems. Cloud Script doesn’t support it because admin API is not permitted there. I believe you may use Azure function to make those changes, where items can be randomly generated in the function.

2 comments
10 |1200

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

Name avatar image Name commented ·

The user sees specific items and buys them. And the items themselves when the store appears are random.

We went to the location, a store appeared, there [Common Item 1, Common item 2, Common item 30]

We went to another location, a store appeared, there [Common Item 10, Common item 3, Ucommon item 5]

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Name commented ·

In terms of this scenario, it seems to be unnecessary to use PlayFab Store because the merchant is player-specific. My solution would be:

  • Define 3 drop table, which is the same as what I have mentioned above
  • Store a JSON data in Player Read-Only Data. It contains the randomly generated result from drop table.
  • Write a Cloud Script function. When executed, the function will call API GetRandomResultTables, then update Player Read-Only Data. This corresponds "went to the location, a store appeared, there [Common Item 1, Common item 2, Common item 30]"
  • Write another Cloud Script for purchase. The function will check Player Read-Only Data first to make sure the player is allowed to make the purchase. Then substract VC and gran the item.
1 Like 1 ·

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.