question

Paul Pacheco avatar image
Paul Pacheco asked

Custom data in item stacks in Economy V2

Started migration to Economy V2. I appreciate the new features it has very much.

I am hitting one problem though, in V1, each item in the inventory could have custom data.

I used that so that players could customize the color of items they purchase. It was rather messy on V1 trying to get custom data to play nice with stackable items.

In V2, stackable items are gone and replaced by stacks in the inventory. This is awesome and much more flexible.

But I don't see how to add custom data to my item stacks. Is there such thing available or planned? How would you recommend I handle selling say a helmet where the user can paint it in any color?

In-Game Economy
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

This feature is coming. It was the most painful cut for our fall launch, but it just wasn't ready. Our goal is to have it ready for you later this year.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

drallcom3 avatar image
drallcom3 answered

I'm running into the same problem. There seems to be no way to tell two items with the same catalog ID apart. When I have two Wooden Words, I can't upgrade one of them, because there are no unique IDs.

It seems that everything in the inventory is treated like a currency and all items are like coins.

It should be possible to set a unique stack ID for each item. That would be the old item instance ID. Then you can refer to the item in a custom data JSON in player data. It's just so clunky and you have to go through a cloudscript, because the client would otherwise be able to manipulate the stack ID and duplicate upgraded items.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image
Gosen Gao answered

Economy V2 doesn’t support to add custom data to the Inventory items, please free to post a feature request for it, and you can store the item’s custom data in the Player Data as an alternative.

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.

drallcom3 avatar image drallcom3 commented ·
  • and you can store the item’s custom data in the Player Data as an alternative

No, you can't There's absolutely no possibility to connect player data to a specific item. None. If I have two "Bronze Sword", I can't determine which one is the one upgraded to level 9 or which one is equipped in my left hand.

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao drallcom3 commented ·

You can create different StackIds for same items to make it split.

1 Like 1 ·
1.png (18.1 KiB)
drallcom3 avatar image drallcom3 Gosen Gao commented ·

I know. I tried to make it work that way, but in reality it doesn't.

  1. The client has authority over the stack ID. The player could easily duplicate his lv99 sword.
  2. It doesn't work well with bundles or the shop. They don't allow multiple of the same item in different stacks. You're only allowed one stack (where you can change the amount). Also you can only set the stack ID for the whole bundle/shop purchase, not per item.

It only works theoretically, but not in practice. I'd have to route everything through custom cloudscript and also I wouldn't be able to make use of the convenience of the economy API.

The whole system doesn't seem to be build around actual individual items. Everything behaves more like a currency. That's why I doubt we will get real unique item instances (at least in the forseeable future).

I'm planning on using economy v2 only for currencies and token items. I'll have to build something on my own for proper items with data attached.

I hope I'm wrong, but stacks is not the answer.

1 Like 1 ·
Paul Pacheco avatar image Paul Pacheco commented ·
0 Likes 0 ·
Paul Pacheco avatar image
Paul Pacheco answered

Coming up with a workaround: maybe I can abuse the stack id field to add small bits of data to it. For example:

 "Item": {
        "Id": "Sword",
        "StackId": "slot_1_FFEEAA"
    },

So the stack id has which slot it is, as well as the color of the sword.

How long can the stackid be?

Is there any restriction on the format can it have spaces or json strings?

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.