question

Kim Strasser avatar image
Kim Strasser asked

Granting an item to all participants of a leaderboard?

1) How can I find out if it is the first time that a player calls UpdatePlayerStatistics to add his score on a certain leaderboard? I want that each participant gets an item or virtual currency when he/she adds the first time a score on a leaderboard. And only after the leaderboard reset each participant can get another item or virtual currency if he/she adds the first time a score on this new leaderboard version. A player should only get one time a free reward on each leaderboard version.

2) How can I grant a certain item of my shop to all participants of a leaderboard after the reset of a leaderboard? The score of the player doesn't matter. Is it possible to call a cloud script function in this case because I want to call server.WritePlayerEvent. I want to write an event so that I can find out if each participant got a reward after the reset of a leaderboard.

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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> 1) How can I find out if it is the first time that a player calls UpdatePlayerStatistics to add his score on a certain leaderboard? …

Please check the player’s statistic via client/server API GetPlayerStatistics before he updates the statistic, if the statistic’s value is empty, this update is “the first update”.

>> 2) How can I grant a certain item of my shop to all participants of a leaderboard after the reset of a leaderboard? …

You can call client or server API WritePlayerEvent to write the custom event, then use Rules feature to grant the items. You can check the doc Actions and rules for more info about rules.

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.

Kim Strasser avatar image Kim Strasser commented ·

Which event is triggered after the reset of the leaderboard? Is it player_ranked_on_leaderboard_version? Can I use this event type?

I just want to grant an item to the players who have added a score on this leaderboard version. If a player has not added his score on this leaderboard version, then he will not receive a reward.

1 Like 1 ·

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.