question

anoainteractive avatar image
anoainteractive asked

I want to make a limited item that can be purchase using VC

Hello, I want to make an item that have limited amount so the item can be sold out. But using the limited item feature can only be use for RM. I've tried using custom data in the item and update the amount/custom data by cloud script, but cloud script can't use admin function to update catalog items. What do you think is the best method for this?

Thanks

CloudScriptIn-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

·
Sarah Zhang avatar image
Sarah Zhang answered

If the “limited item” that you said means all users under the title share one limit of this item. For example, the total number of purchases by all users cannot exceed 10. If so, although items that check [LIMITED EDITION] option can only be purchased by RM, you still can let players purchase such items with VC through some workarounds. A possible workaround is to combine Server API GrantItemsToUser with Server API SubtractUserVirtualCurrency. Limited Items can be granted to users by server or admin API GrantItemsToUser(s), SubtractUserVirtualCurrency can be used to decrement the user's balance of the specified virtual currency by the stated amount. These two Server API can be accessed by CloudScript directly. Then you can write a custom CloudScript function to handle the process of purchase.

If you want that every user has a separate limit of it. For example, everyone can purchase at most 10 items. If so, you can choose “TitleData” to store the “initial limit number”, and choose “Player Read-Only Data” to store the “Items remaining”. Server API GetUserReadOnlyData and UpdateUserReadOnlyData can be used to do the judgment and update the “item remaining”. They also can be used on CloudScript with your custom code logic.

4 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.

anoainteractive avatar image anoainteractive commented ·

Thank you for the thought

The limited items is for everyone and I want to show the number of item left. I also thought to use the [LIMITED EDITION] way. But I thought if it can disturb the dashboard/analysis if I use item with RM. Also, if I want to get the items stock, I need to use the admin API in my project. But if there's no other way, I think I'll just stick with your idea.

Thanks

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang anoainteractive commented ·

Yes, currently, only can use Admin API CheckLimitedEditionItemAvailability to check the global count for the limited edition item. It's not recommended to use it on CloudScript or clients, if you have a custom admin tool, you can use admin API on it. Besides, right now, to manage such global data that need to be updated frequently(more than limited edition item), an external cache like Redis still is a recommended workaround.

0 Likes 0 ·
anoainteractive avatar image anoainteractive Sarah Zhang commented ·

Hi, I've implemented it and use RM, but I get this OperationNotSupportedForPlatform 1219 when I tried to buy the item. Any idea how to fix this?

0 Likes 0 ·
Show more comments

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.