question

Rich Joslin avatar image
Rich Joslin asked

GrantItemsToUser leaves custom data behind

When I use GetUserInventory, the items in the result do not include the original custom data that was part of the catalog item. Not sure if it just isn't copied over or is just excluded from the result set.

If it's intended that it's not copied over when the items are granted, then that poses an issue for me since that would mean I would only be able to grant items using Cloud Script (so I can copy the custom data manually), and thus couldn't grant bundles, tables, etc.

Maybe I can make a repair routine that goes in after a grant and loops through and copies over custom data for items without it, but that's not ideal.

10 |1200

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

brendan avatar image
brendan answered

This is because the custom data on the items in the Catalog and that on the item instances serve very different purposes. Custom data at the Catalog level is meant to be the globally-configured values for the item. So, changing them in the Catalog changes them for all players in the game. The custom data on the item instances is for data which is specific to that instance of the item only.

So yes, your concept of using the local value as an override to the global value is exactly what we would recommend.

10 |1200

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

Rich Joslin avatar image
Rich Joslin answered

I guess I'm still torn on whether I want the custom data copied over or not. I can see times where I'd want globally referenced custom data (not copied over - for things like errata and balance updates), and some cases where I would want an item's custom data to change after it's granted. But I have concrete cases for the former and none for the latter, so I'm moving forward. Just food for thought here, I guess.

10 |1200

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

Rich Joslin avatar image
Rich Joslin answered

Okay, to conclude my stream of consciousness here:
I'm going to stick to not copying in the custom data to each item, and instead use each item's custom data as an optional override to the referenced custom data if for some reason it does need to get hardcoded to an item instance.

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.