question

John Peterson avatar image
John Peterson asked

Stackable and Durable item disappears when RemainingUses is set to 0?

Dear PlayFab community,

I have some items defined as Stackable and Durable and our players receive 1 of these items on initial player creation. The number of items will gradually increase and decrease over time.

We potentially have .CustomData set on these items.

I was surprised to learn that the ItemInstance is *removed* when the RemainingUses count reaches 0. I thought, by virtue of being Durable, that it would remain in inventory (and thus persist our .CustomData, regardless of RemainingUses).

Is there a way that I can make an ItemInstance persist/sticky, even if its count reaches 0?

Thanks in advance!

In-Game Economy
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.

Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

Glad you asked this, because I was just about to do the exact same thing.

1 Like 1 ·
John Peterson avatar image John Peterson Brent Batas (Lisk) commented ·

I wound up implementing a "permanent" ItemInstance object that would check a CountOffset value (-1 or 0) in the CustomData. Basically, I would always ensure that there would be at least a real count of 1, but the logical count was 0.

1 Like 1 ·
brendan avatar image
brendan answered

Unfortunately, the notion of an item that has a count of zero isn't compatible with the RemainingUses logic as it currently exists, and a change like this would technically be a breaking change, since it would change the behavior for existing titles (we have a firm policy that we make no breaking changes, unless it's required for security reasons). If you need the item to still be in inventory even when the player no longer has uses, you may want to treat 1 as 0 in the game logic (since clearly, moving it to a VC won't work, as the point is that you want to keep the custom data).

We are planning on doing a pretty major update to the inventory system next year, so this is definitely good feedback for us, as part of evaluating what we'll want to do with that.

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.

John Peterson avatar image John Peterson commented ·

Thanks for confirming, Brendan -- I was afraid of that.

Yeah, if there was the notion of some permanence or stickiness with inventory, even at 0, that'd be useful in our case.

In the meantime, I'll do as you suggest and explore some alternatives.

0 Likes 0 ·
ilyas avatar image
ilyas answered

Any updates on this ?

We have a custom data on stackable Item. And we dont wan't it to disappear when remaining uses is 0.

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.