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"};
};