question

wikt888r avatar image
wikt888r asked

Reset leaderboard and set new value for each player using rule when player_ranked_on_leaderboard_version

Is this the correct way to summarize the season and set a new statistic value based on a player's score? There are about 20k players in the leaderboard. Is there a limit on player_ranked_on_leaderboard_version event calls by server?

  • Manual reset of the leaderboard

  • Rule: Execute Clods Script on event player_ranked_on_leaderboard_version

Script:

 handlers.handleLeaderboardReset = function (args, context) {
        
     var profile = context.playerProfile;
     var eventData = context.playStreamEvent;
     var rank =  eventData.Rank;
     var value =  eventData.Value;
     var leaderboardName = eventData.LeaderboardSource.Statistic.StatisticName;
        
     var nawValue = getValueForNewSeason(value);
        
     var request = {
         PlayFabId: currentPlayerId, Statistics: [{
                 StatisticName: leaderboardName,
                 Value: nawValue 
             }]
     };
        
     var playerStatResult = server.UpdatePlayerStatistics(request);
 };
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.

wikt888r avatar image
wikt888r answered

Thank you, for your answer.

Summing up the season means updating the values in the leaderboards and player data based on the score at the end of the month.

I found the thread regarding the 1000 event limit and it looks like the only option is an enterprise subscription (10k+ per month).

A workaround might be to use scheduled tasks for each player in segment with similar cloudscript. I didn't encounter any limitations and managed to iterate the whole 20k players in the leaderboard.

Greetings

1 comment
10 |1200

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

Simon Cui avatar image Simon Cui commented ·

Thanks for the information. The workaround makes sense. Please let us know if there is any other concerns.

0 Likes 0 ·
Simon Cui avatar image
Simon Cui answered

Is this the correct way to summarize the season and set a new statistic value based on a player's score?

Could you please explain more about “summarize the season”? I tested your Cloud Script and it did updated players’ statistic as a rule action when a leaderboard reset.

Is there a limit on player_ranked_on_leaderboard_version event calls by server?

There is a limit of “Leaderboard prize table ranks”, which is the number of top-ranked participants from the leaderboard that fire rank events when the leaderboard version changes. The maximum is 1000. Therefore, the player_ranked_on_leaderboard_version event won’t fire for each player in the leaderboard since there are about 20k players in the leaderboard. For more information, you can navigate to [Game Manager] -> [Your Title] -> [Title settings] -> [Limit] -> [Leaderboard prize table ranks]. Please feel free to provide more details regarding your scenario and requirements such that we can offer more comprehensive support and assistance.

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.