question

Tim Koppers avatar image
Tim Koppers asked

Catalog item with more states

Hi,

I was wondering what the best approach will be for the following concept :

- We have a catalog with 5 items

- We want to show those 5 items to the players in a UI (by using GetCatalogItems)

- Each item is 'locked' at first, so it can be bought by the player. A player can unlock the item by doing actions in the game

- When the item is unlocked, then the player can actually buy the item with an iap and it will be in the players inventory.

But right now an item can only have 2 states for the player (in the players inventory vs not in the players inventory).

How can the item have 3 states :

- Locked for the player

- Unlocked for the player

- Bought by the player

What will the best approach be?

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.

Rick Chen avatar image
Rick Chen answered

A workaround is that you can create a locked container which contains the item, and use another item to unlock it. For example, there are 2 items “item_1” and “item_1_key”, and a container “container_1” that contains “item_1”. You could set that the “container_1” to “Locked container” and unlock it with “item_1_key”.

Then the 3 states could be represented as:

  1. Locked for the player: the player has no “item_1_key”
  2. Unlocked for the player: the player has “item_1_key”, but hasn’t bought the “container_1” yet.
  3. Bought by the player: the player has bought the “container_1” and use the “item_1_key” to unlock the container with UnlockContainerItem API.
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.

Tim Koppers avatar image Tim Koppers commented ·

Thanks, this is exactly what I was looking for

0 Likes 0 ·
madmojoman avatar image
madmojoman answered

It depends on how this will be used, but another way you could do it is if it's a small number of items, or a group of items, I would probably setup a Player Data Title data key-value pair that has a simple "TheseItemsLockStates" key (something more descriptive would be best) with a value of "0,0,0,0,0". And you can update this data to set them from 0 to 1 when the items are unlocked (example "1,0,0,1,1" would show the first, fourth, and fifth items unlocked), and verify against that data when setting up the UI to show which are unlocked, and verify against it when purchase is made to verify the player has actually unlocked it properly first, as well.

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.