question

Pat avatar image
Pat asked

character creation

I am trying to create a character creation screen. I see that I am suppose to be using the GrantCharacterToUser call but I keep getting an ItemNotOwned error.

Characters
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

·
brendan avatar image
brendan answered

Yes, the Client version of GrantCharacterToUser requires that the player have an item in his inventory that has the CanBecomeCharacter flag set. This is so that titles can control character creation on player accounts (and so, prevent cheating). You can sell these "character token" items in stores, grant them to players as part of game actions, etc.

One alternative would be to use the Server version of GrantCharacterToUser in Cloud Script, as that version does not require that the player have a "character token" inventory item.

5 comments
10 |1200

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

myibmaccount avatar image myibmaccount commented ·

Do you have any sample code that uses the Unity SDK in order to perform actions that will associate a character with a players account as described above? Or maybe a tutorial that describes this process? thx!

1 Like 1 ·
brendan avatar image brendan ♦♦ myibmaccount commented ·

Sorry, we don't have sample code that specifically shows this. The process, if you want to control it from the client side, is:

  • Create an item in your game catalog which has the "is a token for character creation" option set - make it consumable, with a usage count of 1
  • Sell the item to the player for virtual currency (PurchaseItem) or real money (receipt validation or the StartPurchase flow)
  • Call GrantCharacterToUser from the client, which consumes the item and adds the character to the player account
1 Like 1 ·
myibmaccount avatar image myibmaccount brendan ♦♦ commented ·

Thanks, Brendan this makes sense. However, for some reason even though the item is in my catalog, I am having trouble adding it to the player's inventory via PurchaseItem I get the following error:

{
 "code": 400,
 "status": "BadRequest",
 "error": "ItemNotFound",
 "errorCode": 1047,
 "errorMessage": "Item not found",
 "CallBackTimeMS": 328
}
0 Likes 0 ·
Show more comments

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]