question

giorgiotino avatar image
giorgiotino asked

Set CustomData to items rewarded by Prize Tables

Hello,

I need to somehow link a container item rewarded on a leaderboard reset to the statistic name and version that the player ranked on.

Right now I have tried different ways to achieve this task but none of them seems solid nor safe, and strongly relies on the order of events that get triggered and any delay on the PlayFab side could mess up the data.

I need to have the info provided by player_ranked_on_leaderboard_version to be set as CustomData for the instance of the container item granted by the prize table.

I couldn't find a specific place to do this reliably.

My final goal is to be able to get the player inventory at startup and check for container items with class "LeaderboardReward" and be able to tell the player exactly on which leaderboard version they ranked when they got that reward.

Is there any way to link this info to the granted item reliably?

Do Leaderboard v 2.0 provide something like that maybe?

Leaderboards and Statistics
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

·
Seth Du avatar image
Seth Du answered

It is not supported. A workaround is not to use Prize Table at all and create a Rule, which is triggered by “Player ranked on leaderboard version” event to execute a Cloud Script function. The prize for different ranks is predefined in the script so that you can grant any item and update the custom data using the instance ID returned from the previous API.

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

giorgiotino avatar image giorgiotino commented ·

Thanks for the answer,

Do you know if there's any plan to maybe add such info to the args of the cloudscript triggered by the Prize Table? That would basically be perfect as I could just call a script with the itemid as parameter, and I can read this additional ranking and version data from the player context...

0 Likes 0 ·
giorgiotino avatar image giorgiotino commented ·

Also, your suggested solution technically should work fine, I have added the "fake" Prize Table in the Internal Title Data as JSON. The problem is that I need to retrieve such info, parse it, find the right rank and item(s) awarded to the player and call GrantItemsToUsers with the right CustomData - but the time limit for scripts triggered by events is 1 second, for us, and it constantly fails because it exceeds it. I can't do less that that to be honest, it's the bare minimum number of calls and code needed to handle this scenario in a clean way...

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ giorgiotino commented ·

Yes, exceeding 1s limit is possible. I will suggest define reward table in a static value in the script so that we can reducing the API calls.

0 Likes 0 ·
giorgiotino avatar image giorgiotino Seth Du ♦ commented ·

If the call exceeds the 1s limit is the cloudscript function killed instantly or does it complete but then we get charged at the end of the month?

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.