question

henagames avatar image
henagames asked

Advice for store setup

I am making a game that includes a feature that when players reach certain levels, they get discounts on store items.

I have roughly 50 items in the catalog and planning to add more. All items are categorized into 5 different categories (Residential, Commercial, Decorations, Roads, Special). Every item has 4 custom properties ("levelRequirement", "benefitValue", "benefitType", "xpValue").

When a player reaches level 2, the Residential category needs to be discounted by 5%.

When a player reaches level 3, the Residential and Decorations category needs to be discounted by 5%....and so on.

My first inclination would be to just apply the discount in-game, but I get the 1503 error "WrongPrice" (which is understandable).

My second inclination would be to create a specific store for every level. Is this the right approach? If so, how can I get all of the custom properties to migrate over to the new stores? When I create a new store, none of the custom properties come through, making this a super intensive time suck to copy/paste.

Secondly, if this is the case and at some point I want to increase or decrease the benefits (say instead of 5% I wanted to discount by 3% instead), would I have to go and manually update all stores?

Third, this is rather hard-coded in that I have to know how many levels the player could possibly achieve and setup a store for each one. This limits scalability as I'd like my players to just continue on leveling up as much as they care to.

It might be worth noting that I have the PlayerLevel set as a statistic and can create a segment out of it, but again, this doesn't seem super scalable.

TL;DR - Any suggestions on how to offer progressive discounts to store items based on player level?

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

·
v-humcin avatar image
v-humcin answered

If you wanted to proceed with creating a separate store for every level, one option would be to utilize the Admin API to make migrating custom data easier. You could create a script using API calls such as SetStoreItems to automate parts of the process.

There is no hard limit to the number of stores you can create, but you could expect some slowdown eventually, so if you decide scalability is a concern and you would want more than a hundred or so stores, then it might be a better idea to approach this by creating a custom item purchasing Cloud Script.

In Cloud Script there is no PurchaseItem API call, but you can use SubtractUserVirtualCurrency and GrantItemsToUser to simulate purchases and you will be able to dictate the price of items based on the discount dynamically.

1 comment
10 |1200

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

henagames avatar image henagames commented ·

"In Cloud Script there is no PurchaseItem API call, but you can use SubtractUserVirtualCurrency and GrantItemsToUser to simulate purchases and you will be able to dictate the price of items based on the discount dynamically."

This seems to be the approach I'm looking for. It shouldn't be too difficult to change to this approach, and gives me full control of dynamically pricing items based on player progression.

Thank you so much for the tip @Hunter McIntyre!

0 Likes 0 ·

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.