question

Kim Strasser avatar image
Kim Strasser asked

How can I create a leaderboard rewards ticket?

I want that a player needs to buy with virtual currency a (free) ticket in the catalog before he/she can add a score to a certain leaderboard. The ticket should only be valid on one certain leaderboard and during the current leaderboard version. It is not possible to add a score on Leaderboard_A and Leaderboard_B if the player only has a ticket for Leaderboard_A, in this case he can only add his score to Leaderboard_A. In addition, in a daily, weekly or monthly leaderboard the ticket needs to get invalid immediately after the leaderboard reset. The player needs to buy a new ticket for each new leaderboard version. How can I create such tickets in my catalog? Should the ticket be a consumable or durable item?

I will have multiple leaderboards in my game. How can I find out if a player has already bought the ticket for the leaderboard for which he wants to add his score?

Would it be possible to create three different types of tickets for each leaderboard? For example a bronze ticket, a silver ticket and a gold ticket. The bronze ticket is free and will cost 0 GO, the silver ticket 500 GO and the gold ticket 1000 GO. GO is my virtual currency. The tickets are used to calculate the rewards after the leaderboard reset. With a bronze ticket you can only win 3 rewards, with a silver ticket you can win 6 rewards and with a gold ticket you can win 9 rewards. The rewards also depend on the players leaderboard ranking after the reset of the leaderboard.

Is it possible to display the type(bronze, silver, gold) of each players ticket in my game when the client calls PlayFabClientAPI.GetLeaderboard? I want to display the type of each players ticket next to their score and display name in the leaderboard. How can I do that? Where can I store the type(bronze, silver, gold) of the ticket so that I can get it when I want to display the leaderboard in my game?

Leaderboards and Statistics
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

>> How can I create such tickets in my catalog? Should the ticket be a consumable or durable item?

According to your descriptions, you want the (admission)ticket to disappear after be used or expiration, consumable items will be a suitable choice. It’s recommended to create a corresponding ticket for every leaderboard, for example, Leaderboard_A corresponds to Leaderboard_A ticket, you also need to create daily, monthly, weekly tickets separately.

>> How can I find out if a player has already bought the ticket for the leaderboard for which he wants to add his score?

As the first answer said, if you create a corresponding ticket for every leaderboard, you can distinguish them. Server API GetUserInventory can be used on CloudScript to find out if a player has already bought the corresponding tickets.

>> Would it be possible to create three different types of tickets for each leaderboard?

If you want integrate bronze, silver and gold levels with (admission)tickets, you need to create them separately too. You can add the attributes to the items’ names, like “A_daily_bronze_ticket”, “B_weekly_ silver _ticket”, etc. Then you can handle these tickets with different prices and expiration times.

>> Is it possible to display the type(bronze, silver, gold) of each players ticket in my game when the client calls PlayFabClientAPI.GetLeaderboard? Where can I store the type(bronze, silver, gold) of the ticket so that I can get it when I want to display the leaderboard in my game?

You can store these types in player profiles using server API GetPlayerTags, then via defining ProfileConstraints field to get players’ tags when you call PlayFabClientAPI.GetLeaderboard.

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.

Kim Strasser avatar image Kim Strasser commented ·

When should the player consume the (admission)ticket? Should the ticket be consumed immediately after the purchase and before the player adds the first time a score on the leaderboard or should the ticket be consumed after the reset of the leaderboard?

Can I consume the players ticket in cloud script?

Right now, the player can get and use his ticket like this:

-calling PlayFabClientAPI.PurchaseItem in the client to buy a ticket

-then I call server.GetUserInventory in cloud script to check if the player has already bought a ticket for the leaderboard for which he wants to add his score now

-then I return the name of the players ticket in the PlayFabClientAPI.ExecuteCloudScript result

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Kim Strasser commented ·

>> When should the player consume the (admission)ticket? Should the ticket be consumed immediately after the purchase and before the player adds the first time a score on the leaderboard or should the ticket be consumed after the reset of the leaderboard?

In my design, the ticket should be consumed after the reset of the leaderboard. When players try to update the statistic in the leaderboard, they should “carry” the corresponding ticket (the ticket is in the inventory), the ticket should exist during the complete season. You can use Cloud Script to check if it exists. When the leaderboard is reset, players enter a new season, the ticket should disappear(be consumed) because players should purchase a new (admission)ticket.

>> Can I consume the players ticket in cloud script?

You can use server API ConsumeItem to consume the item on CloudScript.

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.