question

Tibor Dandi avatar image
Tibor Dandi asked

Updating multiple player's character statistics at once

My goal is updating each connected player's characters stats at end of the match.

I am using player-hosted servers (hoster pc is the server)

The updating works only on server's side but not on clients

I set 2 cloud scripts since i got more stats (it seems 10 arg. is the limit for a single cloud script)

GameMode loops each PlayerController and calls GameInstance_SERVER to update thier stats in unreal engine 4.27.

What/how is the (best) way to do this?

Here is a part of my Revision (I send the players PlayFabId and CharacterId as well):

handlers.test2 = function (args, context) {

 if (args && args.PlayFabId && args.CharacterId && args.DeathsValue && args.GrenadekillsValue && args.HeadshotsValue && args.KillassistsValue 
    
 && args.KillsValue && args.LevelValue  && args.LostValue && args.MeleekillsValue
 ){
     var request = {
         PlayFabId: args.PlayFabId,
         CharacterId: args.CharacterId,
         CharacterStatistics: {
             "Deaths": args.DeathsValue,
             "Grenadekills": args.GrenadekillsValue,
             "Headshots": args.HeadshotsValue,
             "Killassists": args.KillassistsValue,
             "Kills": args.KillsValue,
             "Level": args.LevelValue,
             "Lost": args.LostValue,
             "Meleekills": args.MeleekillsValue,
         }
     };
     return server.UpdateCharacterStatistics(request);
 }
 return {"error": "no stat  id and/or character id"};

};

handlers.test3 = function (args, context) {

 if (args && args.PlayFabId && args.CharacterId && args.PistolkillsValue && args.PlayedtimeValue && args.PointcapturedValue && args.XPValue 
    
 && args.weapon1Stat && args.weapon1StatValue  && args.weapon2Stat && args.weapon2StatValue
    
 ){
    
     var request = {
         PlayFabId: args.PlayFabId,
         CharacterId: args.CharacterId,
         CharacterStatistics: {
             "Pistolkills": args.PistolkillsValue,
             "Playedtime": args.PlayedtimeValue,
             "Pointcaptured": args.PointcapturedValue,
             "XP": args.XPValue,
             [args.weapon1Stat]: args.weapon1StatValue,
             [args.weapon2Stat]: args.weapon2StatValue
         }
     };
     return server.UpdateCharacterStatistics(request);
 }
 return {"error": "no stat  id and/or character id"};

};

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.

Simon Cui avatar image
Simon Cui answered

There is no specific limit on the number of arguments for Cloud Script (Legacy), while it has a limit of arguments size with maximum 30000 bytes. You can find more detailed information through [Game Manager] -> [Your title] -> [Title settings] -> [Cloud Script arguments size]. I combined and tested with all your arguments in single Cloud Script Revision, and it worked well. Please let us know if you have further questions after give a try.

5811-p1.png


p1.png (22.6 KiB)
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.

Tibor Dandi avatar image Tibor Dandi commented ·

5834-nevtelen-1.png

5828-nevtelen-2.png

Well I also combined those args and tried again and its not working through ue4. if the script contains more than 10 args. Also my script size is not that big5835-nevtelen-3.png

0 Likes 0 ·
nevtelen-1.png (455.1 KiB)
nevtelen-3.png (139.9 KiB)
Simon Cui avatar image Simon Cui Tibor Dandi commented ·

I suggest you testing to call ExecuteCloudScript using Postman to see if works. Could you provide the specific error message when execute it in UE4? Also, you can monitor the playstream event and find detailed log information through [Game Manager] -> [Your title] -> [Title overview] -> [PlayStream Monitor].

0 Likes 0 ·
Tibor Dandi avatar image
Tibor Dandi answered

5836-nevtelen-2.png


nevtelen-2.png (481.5 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.