question

Claudio Junior avatar image
Claudio Junior asked

How to make the ranking reset the scores of all players in it?

Hi, my ranking doesn't delete (leaves the score at 0) after resetting automatically, is there any error or misconfiguration on my part?

Title ID: E06D

Statistic ID: 3587210331399022

Specific steps: The ranking automatically resets monthly, it should reset or delete points for all players in this ranking, but it doesn't. Currently I do this "manually" by deleting the player's score when he is awarded, but ideally I wanted this score to be reset when the ranking is reset.

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

Sarah Zhang avatar image Sarah Zhang commented ·

Which leaderboards could not be successfully reset? Could you please provide the Leaderboard Names?

0 Likes 0 ·
Claudio Junior avatar image Claudio Junior Sarah Zhang commented ·

Hi Sarah Zhang. Thanks for the answer. The name is: SeasonPoints

0 Likes 0 ·
Sarah Zhang avatar image
Sarah Zhang answered

The API GetLeaderboard you called is designed to get the leaderboard, in other words, retrieve the list of ranked users for the given statistics. It's not designed to reset the leaderboard.

You can call the Server API UpdatePlayerStatistics on the Cloud Script in batch to update all players' statistics value to 0 manually. You can also consider calling the Admin API IncrementPlayerStatisticVersion to reset the leaderboard, it should make the same affects with the "manually reset". But please note that the Admin API isn't designed for the Cloud Script, please call them in your custom administrative tool.

10 |1200

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

Sarah Zhang avatar image
Sarah Zhang answered

Thanks for the reply. Firstly, to clarify, all resets for the leaderboard (manually reset and scheduled reset) will trigger the event -- title_statistic_version_changed. Based on this principle, we queried all title_statistic_version_changed events for the SeasonPoints in the Data Explorer and found there is only a corresponding event of monthly reset. This event shows that title performed monthly reset operation for SeasonPoints on June 1st and change the statistic version to 23. After checking, 23 is also the latest version number of leaderboard -- SeasonPoints. It seems to be executed successfully, and the version 23 of SeasonPoints is also different from version 22.

We did not find an event indicating that SeasonPoints were manually reset. Did we miss something? Could you please describe what the ranking list looks like after the monthly reset is performed? What is the expected behavior and what is the actual behavior?

We use the following syntaxt to query the event:

['events.all'] 
  | project FullName_Name, Timestamp, Entity_Id, EventData 
  | where Timestamp between(datetime(2021-05-27T00:00:00Z) .. datetime(2021-06-10T02:43:43Z)) 
  | where (FullName_Name == "title_statistic_version_changed" and EventData.StatisticName == "SeasonPoints") 
  | top 1000 by Timestamp 
3 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.

Claudio Junior avatar image Claudio Junior commented ·

Hi Sarah, thanks for the reply.

I don't do manual reset, the idea is that the reset is done automatically at the end of each month.

What happens now is that at the end of each month, the Pay Tables award the positions correctly, but it doesn't reset the scores of all players and, for some reason, this score is only reset when the player logs in after the reset.

What I would like to see happen is that in addition to the payout from the Prize Tables, I would like the leaderboard to reset all players' scores to zero at the end of each month, so when I log into the game and display the leaderboard, it will all show 0, even if that player has not yet logged into the game after the reset.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Claudio Junior commented ·

Thanks for the clarification. Could you provide the PlayerId of the player whose statistic value is not reset? So that we can investigate it. Besides, as the workaround, you can consider using Scheduled Tasks to reset player statistic values in batch.

0 Likes 0 ·
Claudio Junior avatar image Claudio Junior Sarah Zhang commented ·

So, actually everyone in the rankings only reset when they enter the game, as I mentioned before. So I can't send a userid that hasn't been reset, as probably a lot have already logged in and been reset, I can do this as a test on my own account and not log in with it, so you can see why it hasn't reset. , but this will only happen automatically at the end of the month.

This is the ID: A19DAAB28EE7A4C7

Thanks and I'll try what you sent me, but if I'm not mistaken, I already do this in an attempt I made to fix this problem, I made it so that when the first place was awarded, it would reset everyone's score, so I run this code in CloudScript.

var leaderboard = server.GetLeaderboard
({
StatisticName: "SeasonPoints",
StartPosition: 0,
MaxResultsCount: 0
});

Should this code reset the leaderboard?

0 Likes 0 ·

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.