question

Larry Dietz avatar image
Larry Dietz asked

Removing items from inventory question

The GrantItemsToUser allows me to add multiple items to a users inventory in a single call.

Is there an equivalent call to consume multiple items?

Trying to keep from pounding the PlayFab server, I am caching inventory changes locally, and updating the server periodically.

Adding is working just fine, but for items to be removed from inventory, it appears to force me to pound the server if there are multiple items to remove.

Any suggestions on how to accomplish what I am trying to do?

Thanks,

-Larry

Player 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.

1 Answer

·
Andy avatar image
Andy answered

I depends on what you're trying to do. We have RevokeInventoryItems. We also have ModifyItemUses which allows you to remove any number of a stack. But those might not be what you want for Consumables. There we only have ConsumeItem. It can consume as many uses as you'd like, but it does have to be called at least once per distinct item id.

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.

Larry Dietz avatar image Larry Dietz commented ·

That is what I am using now. It's just that if the player uses several different items before the game syncs with the server, then during that sync, it might end up with the cloudscript calling ConsumeItem several times repeatedly, to sync the inventory back up, which will be pounding the server even harder than if I just consumed them in real time. Was trying to get the system to not make so many cloudscript calls during play. Initially it made a call to cloudscript every time an item was obtained or used, and I thought that syncing them all up at once would be more efficient. I saw the ability to add multiple items in a single call, and assumed that a matching method to reduce inventory would be there also.

Guess thats what I get for assuming :)

-Larry

0 Likes 0 ·
Andy avatar image Andy ♦♦ Larry Dietz commented ·

Unfortunately, yes, but that's really good feedback. I'll talk to the commerce feature owner and see if it's something we can include in the upcoming commerce system updates.

0 Likes 0 ·
Larry Dietz avatar image Larry Dietz Andy ♦♦ commented ·

Sounds good. I do believe that it would be a good feature to have.

0 Likes 0 ·
Show more comments

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.