question

Akshith avatar image
Akshith asked

Inventory and bundle

While granting a bundle to a user, can I check the Inventory size and grant only some rewards?

For example :-

I am granting a bundle to a user and it will add 6 items to his Inventory. But his Inventory can hold only 3 of them. Is there any way I can grant only 3 items from the bundle?.

one thing I can think of is revoking after granting, Is there any better approach than this?

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

·
Citrus Yan avatar image
Citrus Yan answered

Suppose that you know the contents in that bundle in advance, you can also just grant specific items to the player using the single GrantItemsToUser API instead of Granting that bundle and revoking some of the items after that. And, I am assuming that you’re using CloudScript (legacy) for this, is that correct? In that case, since the call to Admin/GetCatalogItems is not supported because CloudScript only supports calling the server API set, you can store the bundle data in CloudScript beforehand for later retrieval:

var bundleInfo = {
    "Bundle1": {
        "Contents":[
            "TestItem1",
            "TestItem2",
            "TestItem3"
            ],
        "Size": 3
}
…
}

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

Akshith avatar image Akshith commented ·

Yes I am using cloudscript.

What if the bundle contains a drop table? How can I handle that scenario?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Akshith commented ·

You can use EvaluateRandomResultTable to "simulate" the process of generating the result items of a drop table and use that as the items that are supposed to be added to the player's inventory.

0 Likes 0 ·

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.