question

Kevin Shimizu avatar image
Kevin Shimizu asked

How to use multiple character token types?

Hi, I was able to successfully setup granting characters for users using PlayFabClientAPI.GrantCharacterToUser() by deducting a character unlock token from their inventory. However, for my project I would like to have multiple unlock token types, one for each class of character. For instance, let's say I have two classes, "Tank" and "Healer" and want to have unlock tokens for each. If you have an unlock token for the Tank class, then you will not be able to use it to unlock a Healer. I think I have an idea of how I can do this, but wanted to check here to make sure it is the optimal solution.

I assume I will first check if the user has a "TankToken" with GetUserInventory, then if they have the token in inventory, I would call PlayFabServerAPI.GrantCharacterToUser to grant the character to the user account, then I would deduct the TankToken from their inventory with RevokeInventoryItem. I know there is more to this, but I am just paraphrasing to keep things concise.

I will still have a Universal Unlock Token I will grant players when they first start the game so they can unlock a character in any class. This token will have "Is a token for character creation" = true. I also assume that the other class specific tokens should have this set to false since I will be deducting the tokens with RevokeInventoryItem. I guess one way of looking at it is these class specific tokens are like keys that instead of unlocking chests, they unlock a character in that class.


Let me know if I am on the right path.

Thanks,

Kevin

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.

Kevin Shimizu avatar image Kevin Shimizu commented ·

After doing some more testing, I believe I was using the tokens incorrectly. Correct me if I am wrong, but I think I should have a token for each character, rather than a token for each class. Possibly with another item that will grant the specific character token when the player chooses the character they wish to unlock.

0 Likes 0 ·
Seth Du avatar image
Seth Du answered

Yes, in the common scenario, you may need to define several token Items for each class. Each item will be a “class”.

10 |1200

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

Kevin Shimizu avatar image
Kevin Shimizu answered

Got it working. Thanks!

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.