question

Muhammad Roshaan Tariq avatar image
Muhammad Roshaan Tariq asked

How to call advance drop tables?

Hi,

I was following this document for understanding Catalogs, Items, Bundles and drop tables. Everything was fine in the document until I found this section where there is no help provided regarding API calling and Unity code.

So, my main concern is which function I will use to use this feature and to call this 11-Item drop bundle?

Thanks!

apisunity3dsdks
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

Sarah Zhang avatar image
Sarah Zhang answered

>> I was following this document for understanding Catalogs, Items, Bundles and drop tables. Everything was fine in the document until I found this section where there is no help provided regarding API calling and Unity code.

Game developers only can access drop tables programmatically using these two PlayFab Server API methods: GetRandomResultTables, EvaluateRandomResultTable. Only when you develop a game server on Unity, you need to call these two functions via PlayFab Unity SDK. Otherwise please call them on the Custom Game Server or CloudScript. This section Using drop tables shows how tocall these two API via PlayFab C# SDK on a C# server. If you want to build a Unity server, you can navigate to [Unity]->[Window]->[PlayFab]->[Editor Extensions], choose [Settings]->[API] tab, check [ENABLE SERVER API], then you can call server API on Unity. If you only use Unity to develop client applications, please don’t check [ENABLE SERVER API].

>> So, my main concern is which function I will use to use this feature and to call this 11-Item drop bundle?

If you want to use bundles in a drop table, please refer to the above content. If you want to grant or let players purchase a bundle directly, you can handle the bundle like an item. A bundle also has an item Id, it can be used in API about items. You can refer to the above content to use server or admin API GrantItemsToUser to grant items or bundles to users, or use client API PurchaseItem, let users purchase it.

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

Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

@Sarah Zhang


>> If you want to use bundles in a drop table, please refer to the above content. If you want to grant or let players purchase a bundle directly, you can handle the bundle like an item. A bundle also has an item Id, it can be used in API about items. You can refer to the above content to use server or admin API GrantItemsToUser to grant items or bundles to users, or use client API PurchaseItem, let users purchase it.

I want to achieve the randomness as told in the tutorial I followed. For that which API should I use GrantItemsToUser or PurchaseItem?

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Muhammad Roshaan Tariq commented ·

Yes, GrantItemsToUser can be used to grant bundles, PurchaseItem can be used to purchase bundles. And the key point of implementing the randomness is adding drop tables in the bundle, please follow the tutorial normally, especially this part Adding a bundle. Then call the API to grant or sell the bundle which you set.

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq Sarah Zhang commented ·

@Sarah Zhang Alright, got it. I have already created the bundle containing multiple drop tables just like the tutorial and now I will try the mentioned APIs and see if it works for me. Thanks!

0 Likes 0 ·