Hey, I'm making a script that will create account info for new players. It first creates two characters for the new player and then gets the ID's of the newly created characters. After that, it adds some data to each character like levels and XP. When it is ran, there are too many API calls. Is there any way I can reduce that?
handlers.newPlayerData = function () { var survivorCharacterResponse var hunterCharaterResponse function givePlayerCharacter(callback){ var survivorsetdata = { "PlayFabId": currentPlayerId, "CharacterName": "Survivor1", "CharacterType": "Survivor" }; var huntersetdata = { "PlayFabId": currentPlayerId, "CharacterName": "Hunter1", "CharacterType": "Hunter" }; survivorCharacterResponse = server.GrantCharacterToUser(survivorsetdata); hunterCharaterResponse = server.GrantCharacterToUser(huntersetdata); callback(survivorCharacterResponse,hunterCharaterResponse); }; function setBasicStats(survivorCharacterResponse,hunterCharaterResponse){ var playerSurvivorCharacterID = survivorCharacterResponse["CharacterId"]; var playerHunterCharacterID = hunterCharaterResponse["CharacterId"]; JSON.stringify(playerSurvivorCharacterID); JSON.stringify(playerHunterCharacterID); var survivorBasicStats = { "CharacterId": playerSurvivorCharacterID, "PlayFabId": currentPlayerId, "Data": { "Level": "0", "XP": "0" }, "Permission": "Public" }; var hunterBasicStats = { "CharacterId": playerHunterCharacterID, "PlayFabId": currentPlayerId, "Data": { "Level": "0", "XP": "0", "Kills": "0" }, "Permission": "Public" }; server.UpdateCharacterData(survivorBasicStats); server.UpdateCharacterData(hunterBasicStats); }; givePlayerCharacter(setBasicStats); };