question

Evren Buda avatar image
Evren Buda asked

Grant Items To Character Problem

Hello, i could not make grant items part to work. Code is creating a new character for the user but not granting the item. Could you please tell me what did i write wrong:

Note: User already has a "Wand" item in his inventory with same catalog version, even before character creation.

handlers.GrantITemsToCharacter = function(args, context) {

var characterName = "Fire Mage"; var characterType = "Mage";

var result = server.GrantCharacterToUser({CharacterName: characterName, CharacterType: characterType, PlayFabId: currentPlayerId});

var charId = result.CharacterId;

server.GrantITemsToCharacter({PlayFabId: currentPlayerId, CharacterId: charId, CatalogVersion: "Items", ItemIds: ["Wand"]});

}

10 |1200

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

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Please fix a typo, change GrantITemsToCharacter to GrantItemsToCharacter. By the way, if you want to check more error details after you call CloudScript functions, you could use RESTful API testing tools, like Postman. If you want to learn more about it, Please check Postman SDK here.

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.