question

omar avatar image
omar asked

Why it's not possible to have consumables with 0 uses left

We need items that are unlocked and if unlocked then the player can buy them.

What we are trying to do is to treat as unlocked item the ones that you have on your inventory, and use UsesLeft to add/remove when the player buys/consume.

The problem is that the item disappears if the UsesLeft reaches 0 (making it locked again).

What would be the alternative to achieve the expected behavior ? and why it's not possible to have consumables with 0 UsesLeft ?

Cheers.

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

It sounds like you're attempting to overload the UsesRemaining for two different uses, then. The UsesRemaining is specifically how many of the item in question is in the player inventory, whether for consumable goods or stackables. Once it reaches zero, the item is removed, since otherwise you have an item taking up a "slot" in the player inventory which effectively doesn't exist in the player inventory.

What I would recommend is tracking on the "permission to buy" part of your game logic in the player's User Read-Only or Internal Data, or else with a statistic.

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.

omar avatar image omar commented ·

Can you give me an statistic example ? afaik they are used for leaderboards and we have too many leaderboards right now (also, they can't be deleted).

0 Likes 0 ·
brendan avatar image brendan omar commented ·

Correct - we'll be adding the ability to delete a stat from a game in a future update. For now, we recommend using a test Title ID until you're getting close to launch, at which point the stats should be pretty well defined and locked down.

In general, using data would be better, since you could put all the permissions into a JSON object and store it as a single key/value. An example of using stats for this would be to set a statistic as a bitfield, where each bit represents a permission to buy. Though bear in mind that unless you disable the leaderboard query from the client entirely, that would be query-able by the client.

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.