question

shaswath avatar image
shaswath asked

How do I create a chest that can only be opened after let's say 20 minutes in Economy v2?

I want to create a chest that can only be opened after let's say 20 minutes. I will use Azure functions to add rewards to inventory. I just don't know how to achieve the timing functionality as I can't rely on the client device for time as he can spoof us.

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

Neils Shi avatar image
Neils Shi answered

If you want to create a chest that can only be opened after some times, Economy v2 does not support this feature, you may try to use Azure Function to implement it. When players get the chest, you can use Azure Function to get the time from server via server API GetTime, then store timestamp (when the chest can be opened) and the info of the reward (which you want to grant) in chest’s DisplayProperties. And if players try to open the chest, players should call another Azure Function which will get the current server time and the info of reward, then you can determine whether the chest’s reward can be granted to this player. If the time is met, you can check the reward info in chest’s DisplayProperties, then grant it to players.

10 |1200

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

kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

Also, you can use the PurchaseInventoryItems to swap one item for others. For example, you can "buy" a "Classy Chest" with a "Class Chest Key" (in the catalog, the chest is the item, and the key is the item price). The operation will swap the two on the backend.

That doesn't address the time issue, though, so maybe just using DisplayProperties and ExecuteInventoryOperations in an Azure Function would get you the result you want.

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.