question

lu.zhang@sectionstudios.com avatar image
lu.zhang@sectionstudios.com asked

Variable lock?

Is there anyway for the system to only let the first people to access a certain variable?

For example, there is a super powerful weapon for the first player who find it. However, if two players find the weapon and send a getting weapon request to the server at the same time, who will get the weapon? Will they both get the weapon? Is there anyway to lock the variable immediately on the server after it is accessed by someone ?

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

·
brendan avatar image
brendan answered

What's the mechanic by which the players are getting the items?

It sounds like what you're looking for is an item scarcity system, where you can define items in your catalog for which only a specific, finite number can exist. We have an item on our backlog to support this, but it is not on the schedule currently.

One way you could do this now would be by having a "GM" player in the game which you control, and to which you add these limited items. You would then create a Trade record with no specified recipient, so that the first person to claim the Trade gets the item. You could provide the ID for the Trade via Cloud Script, then.

Please note though, that the "GM" player would be subject to the same restrictions as any other player, so you would want to be careful not to use this extensively (overloading the player with hundreds of items awaiting trades).

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.