question

Andy Metcalfe avatar image
Andy Metcalfe asked

Cloudscript Increment Player Statistic

Hi,

I'm trying to increment player statistics in cloudscript using the UpdatePlayerStatistics method. I know that this method rather confusingly uses the setting in the leaderboard settings for aggregation method (last/min/max/sum).

There seems to be no way to set this aggregation method from the API - is this correct?

I am generating stats on the fly in the form "GameModePlayCount_<GameModeName>", and these stats need to have an aggregation method of sum, so that I can increment them using the UpdatePlayerStatistics method with a value set to 1.

I will also be having leaderboards per level and these will need a min or max aggregation method set. I will be using the same dynamic stat naming methods, and I really do not want to have to manually go through each stat and set these using the website!

How can I do this using the API?

Cheers,

Andy

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

·
Hernando avatar image
Hernando answered

There is no API that can update the aggregation method in Server API collect, so you can't do it in CloudScript. However, you can call Admin.UpdatePlayerStatisticDefinition from Azure function to update a player statistic configuration for the title. The AggregationMethod field in the request defined the aggregation method to use in updating the statistic. More information please see: Update Player Statistic Definition

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.

Andy Metcalfe avatar image Andy Metcalfe commented ·

Ah that sucks. I presume I could call that method from a cloudscript by manually making a http.request and calling https://titleId.playfabapi.com/Admin/UpdatePlayerStatisticDefinition?

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.