Hello, im creating a RPG game where I can create and delete characters from each users ..
character adding works fine ..
But I have a problem with deleting characters .. Because I have to delete it with the characterId ..
How can I access my character Id when I create a character ?
And is the function for deleting right ? Because im pretty new at CloudScripting and have no idea ..
handlers.removeChar = function(args, context) { var removeCharRequest = { PlayFabID: currentPlayerId, CharacterId: args.characterName, SaveCharacterInventory: args.DeleteCharacterFromUser, }; var result = server.DeleteCharacterFromUser(removeCharRequest); return true; }
private void DeleteCharacterFromUser(SavedGame savedGame) { var request = new ExecuteCloudScriptRequest() { FunctionName = "removeChar", FunctionParameter = new { CharacterId = savedGame.MyCharacterName, deleteInventory = true } }; PlayFabClientAPI.ExecuteCloudScript(request, removeCharacterSuccess, removeCharacterError); }
handlers.grantChar = function(args, context) { var grantCharRequest = { PlayFabID: currentPlayerId, CharacterName: args.characterName, CharacterType: args.catalogId }; var result = server.GrantCharacterToUser(grantCharRequest); return true; }
private void AddCharacterToPlayer(string charName) { var request = new ExecuteCloudScriptRequest() { FunctionName = "grantChar", FunctionParameter = new {characterName = charName, catalogId = classes[classIndex] } }; PlayFabClientAPI.ExecuteCloudScript(request, addCharacterSuccess, addCharacterError); }