question

52487 avatar image
52487 asked

How do I update all players' information?

Hi.

I did not speak English well and I used Google Translator.

Sorry. I will write it as simple as possible.

I want to update all players' information.

I tried to use GameManager -> Automation -> Scheduled Task.

The screenshot shows a new task that calls resetPlayerData in the cloud script.

I pressed save and run and saw the results.

But it failed.

The error occurred because the currentPlayerId was not found in resetPlayerData.

The resetPlayerData method uses the server.GetUserReadOnlyData method and should reference

urentPlayerId. Are there any correct ways to update all players' information?

Please tell me how.

Thank you.

1.png (54.6 KiB)
10 |1200

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

v-humcin avatar image
v-humcin answered

If you set type of task to "Run actions on each player in a segment" using segment "All Players" and add an action of "Execute Cloud Script" this will allow the Cloud Script to run on every player in the segment and access their currentPlayerId.


scheduledtask.png (37.7 KiB)
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.

v-humcin avatar image v-humcin ♦ commented ·

It is also worth pointing out that Scheduled Tasks can take a non-trivial amount of time to work through all of the players. Another method for accomplishing this would be to have a "OnLogin" Cloud Script that will check whether an update needs to be made to the Player's account when the game is loaded and then perform the action.

In the case that the change being made affects gameplay. This can be useful to prevent having one player log in without the scheduled task having reached their account yet and providing them a potential advantage over a player who has already had their custom data reset.

0 Likes 0 ·
52487 avatar image
52487 answered

Sorry for the late @Hunter McIntyre



I tried to test it with a new one.

But it does not work properly.

I did the following when I started the test.

The results are shown below.


Sometimes the results are successful or fail.

Even if it succeeds, Player Data (Title) of each player It was not updated properly.

Below are some of the unsuccessful results of Raw Evnet Json.

{
    "EventName": "player_triggered_action_executed_cloudscript",
    "Source": "CloudScript",
    "FunctionName": "resetPlayerData",
    "CloudScriptExecutionResult": {
        "FunctionName": "resetPlayerData",
        "Revision": 219,
        "FunctionResult": null,
        "FunctionResultTooLarge": null,
        "Logs": [
            {
                "Level": "Info",
                "Message": "플레이어 정보 초기화: 528BF625F6837A4F",
                "Data": null
            },
            {
                "Level": "Error",
                "Message": "PlayFab API request aborted, because API call count limit exceeded",
                "Data": {
                    "api": "/Server/UpdateUserReadOnlyData",
                    "request": {
                        "PlayFabId": "528BF625F6837A4F",
                        "Data": {
                            "ScoreData": "{ \"CasualScore\":1500, \"RankScore\":1500 }",
                            "CustomizeData": "{ \"Empty\" : \"wip\" }"
                        }
                    },
                    "apiCallCount": 3
                }
            }
        ],

...

}

task.png (50.0 KiB)
reuslt.png (42.8 KiB)
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.