question

fanwu avatar image
fanwu asked

How to grant multiple items to player

We have a reward system based on level, each level will automatically grant 2-3 items to a player. Now if a player suddenly level up 10 times, system tries to grant 30 items and the following error showed up:

"Error": "CloudScriptAPIRequestCountExceeded"

What is the best practice here? I can see that this is going to be a problem for other system too.

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

The best practice is to aggregate them into fewer calls. GrantItemsToUser can give the player all the items in a single call. So first, make the few calls needed to collect the authoritative info you need, then step through your logic for evaluating the change to the player, then make a single Grant... call to add the items.

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.