question

charlie avatar image
charlie asked

Is There a Description of ItemInstanceId?

I haven't found a technical definition of ItemInstanceId. Is there one?

Calls to purchase/grant return one, and calls to consumption require one to be sent.

This seems technical and good to understand deeply!

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

·
pfnathan avatar image
pfnathan answered

An "ItemInstanceID" is referring to Unique instance identifier of the item to be modified.

https://api.playfab.com/documentation/server/method/ModifyItemUses

also discussions on the forums:

https://community.playfab.com/questions/3758/character-inventory-item-added-instanceid-vs-itemi.html

4 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.

charlie avatar image charlie commented ·

Thanks! I've got a few technical concerns when working with stackable/consumable items.

For instance, if I keep purchasing a stackable/consumable item, will the ItemInstanceId that returns always be the same for each purchase of that item? It *seems* to. What if the player consumes all of that item she has, thus removing the entry from inventory, and then purchases more. Will the ItemInstanceId be the same one from before?

Finally, what if she purchases from a new catalog but the item is the same item id. Does that get the same ItemInstanceId?

0 Likes 0 ·
brendan avatar image brendan charlie commented ·

While the Item Instance ID will usually be the same, you should not rely upon that, as it is not guaranteed.

For catalogs, there isn't really the concept of a "different" catalog in PlayFab. You have Catalog Versions, not Catalog IDs. Swapping to a new version simply means that you're replacing the live catalog with another version of it - all the Item IDs still refer to the same Item IDs.

0 Likes 0 ·
charlie avatar image charlie commented ·

Thanks. I'll give you a specific scenario that worries me a bit (in the same catalog version).

When I call to GetUserInventory, the return is a list of ItemInstance. Each ItemInstance has two important fields for my concern: ItemInstanceId and RemainingUses.

A player may have an "itemX" with 3 remaining uses and a shared ItemInstanceId of "A". This implies that "A" is consistent for all 3 uses.

If the player purchases or is granted more itemX, the returned ItemInstanceId may not be "A" this time, but "B". This is my experience.

So now I have 3 that loaded with an instance id of "A" and 1 that has a new id "B". I'm hoping I can just use "B" during this play session for all of them. Eh?

0 Likes 0 ·
brendan avatar image brendan charlie commented ·

Ah, I see. Yes, if an item is a stackable, and the player has a non-zero stack, that stack will always be used.

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.