question

doronhn avatar image
doronhn asked

consume item without instance id

Hey,

i am stackable item in my player inventory and i want to consume it once.

is it possible to consume it with the itemID and not with the instance?

why instanceID is used here?

thanks

In-Game EconomyPlayer Inventory
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

·
Andy avatar image
Andy answered

InstanceId is required for the ConsumeItem method. InstanceId is the identifier for the item in a player's inventory. ItemId is the identifier for the item in the catalog. By requiring instanceId in this case, we're being consistent about how we treat the different identifiers. You're referring to an instance in a player's inventory, so it makes sense to use instanceId. Yes, we could in theory do a lookup, but we'd pay a performance price.

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

doronhn avatar image doronhn commented ·

thanks.

how do i get the instanceID?

0 Likes 0 ·
Andy avatar image Andy ♦♦ doronhn commented ·

The most common way is through a call to GetUserInventory. It returns the player's inventory with all associated itemInstanceIds.

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.