Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Name · Aug 20, 2020 at 07:38 AM · CloudScriptunity3dsdksIn-Game Economy

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?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by SethDu · Aug 20, 2020 at 08:35 AM

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.

Comment

People who like this

0 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Name · Aug 20, 2020 at 08:41 AM 0
Share

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]

avatar image SethDu ♦ Name · Aug 21, 2020 at 02:47 AM 1
Share

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.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    4 People are following this question.

    avatar image avatar image avatar image avatar image

    Related Questions

    {"PlayFabId":["must be a hex-encoded number"]} on Giv 1 Answer

    Using Custom Tags with Email verification rule 1 Answer

    Unity: player has not played this title? 1 Answer

    UserData object different between client and server? 1 Answer

    Apple (iOS) receipt validation in Unity IAP 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges