thornewill avatar image
thornewill asked

Execute Inventory Operations - dealing with item limits

Hello, in our title we are using ExecuteInventoryOperations call to add multiple items to player's inventory (call is done through Azure function). However we found out that adding more than 10 items with unique stackID for each is impossible because of the Playfab limits. We want to do this quite often (for example adding 20+ items like this will be quite regular operation), so I would like to ask what are possible workarounds for this issue?

Of course I can call the method multiple times, but not sure if this is a good idea due to possible timeout issues. Also I was thinking about doing this call through queued azure function (which could be also problematic because missing return value of queued functions). Can you provide maybe some guidance regarding this? Thanks!

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

Xiao Zha avatar image
Xiao Zha answered

The 10 is the operation limit not the item limit. As you can see in PlayFab Inventory APIs - PlayFab | Microsoft Learn, the operation list in the ExecuteInventoryOperations API can have up to 10 operations. And the limit on the types of items that can be modified/added in a single request is 250. May I know if the StackId is specified by the player? Are different StackIds for different kind items or different StackIds for the same item? Could you please share the specific scenario you want to achieve?

In addition, if you want each kind item has a unique stackId and the stackId is not specified by players, as a workaround, you may specify the DefaultStackId property for each kind item when you create and publish the item. Then you can put different items in a bundle, then grant the bundle to players. In this case, you don’t have to specify the StackId when you call ExecuteInventoryOperations API; and once the bundle granted to player, the StackId of items in player’s inventory will be the DefaultStackId you set in the Catalog Item.

10 |1200

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

thornewill avatar image thornewill commented ·

Thank you for the answer. Scenario I want to achieve is this:

I want to grant 20 shields to the player, where each shield instance has it's own durability (which is represented as a property in the DisplayProperties for each item instance). In order to be able to achieve this behaviour I need to create a unique stackID for each created item - at least this is what I got from the docs - please correct me if I'm wrong.

StackID should be created in own code in the way that it should be really unique for each item instance - so to answer your question, it will be different StackIDs for the same item.

So if I want to achieve this behaviour, I have to simply create 20 AddOperations, each one for the same item, but each with unique stackId. By doing this I easily surpass the 10 item operations limit.

Can you please confirm that what I'm trying to do is correct approach? Or should it be done differently? I don't see how specifying DefaultStackId helps me with my situation. Thanks in advance!

1 Like 1 · avatar image thornewill commented ·

This is the correct API and approach for this scenario. We've discussed ways to increase this limit in the future, but we don't have concrete plans yet. For now, you just need to make 2 sequential calls.

2 Likes 2 ·

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.