question

Joe Uphaus avatar image
Joe Uphaus asked

GrantItemsToCharacter gives VC to Player not Character?

Hello all -

I have a rule off of the player_added_title event that triggers cloudscript to automatically create a character then attempt to grant them a starting bundle.

The above is working but I have found that while the non Virtual Currency items go into the character's inventory, the Virtual Currency that I have in the bundle is shown on the Player but not the Character.

The character will see the starting amount defined in the Virtual Currency tab but not the additional VC from the bundle. Is this how it is supposed to work? I am just tinkering currently to understand how to best set things up and can work around it but just curious if I am approaching this incorrectly.

Thanks!

Below is my sample cloud script

//triggered using title_player_added
handlers.newPlayerSetup = function (args, context) {
    //automatically create new character for player.
    //for character name use the playfabId with an appended _0.
    
    var configuredCharacterName = currentPlayerId + "_0";
    
    var grantCharacter = server.GrantCharacterToUser({
        PlayFabId: currentPlayerId,
        CharacterType: "Normal",
        CharacterName: configuredCharacterName
    });
        
    var charId = grantCharacter.CharacterId;
    
    
    //give starting bundle to new character.
    server.GrantItemsToCharacter({
        PlayFabId: currentPlayerId,
        CharacterId: charId,
        ItemIds: ["start_bundle"]
    });
    
}
Player DataPlayer InventoryCharacters
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

·
Seth Du avatar image
Seth Du answered

Thanks for the feedback. I will report this issue to the team.

1 comment
10 |1200

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

Joe Uphaus avatar image Joe Uphaus commented ·

Thanks for the response - for now I am just utilizing the currency initial deposit but I can imagine this being an issue for rewarding bundles to characters in the future.

0 Likes 0 ·

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.