question

Talha Muhammad avatar image
Talha Muhammad asked

Help Needed In sorting out the Flow of rewards.

Hi, I need some guidance regarding implementing a system in Unity.

I have several characters (like in crossy road) in my game which user can buy using real money OR using Jewels.

In the normal Gameplay Player encounters a prisoner which player has to free. When the player frees that prisoner, The prisoner rewards the player with some Jewels. (like in the old metal slug game)

The player can only free the prisoner if the player has Keys. The player can buy keys using Real money.

If the player has keys and the player encounters a prisoner the player can free the prisoner and the prisoner can grant him some jewels.

How can I implement this system using a collection of containers, VC, Bundles and items?

Right now I have put

Characters = Items

Jewels = VC

and

Keys = Items

GrantJewlsOnFreedom = Container.

but I want only 5 to 10 GrantJewlsOnFreedom containers per day. Is that possible? How can I make this system work.


If this system works then the player has the option to purchase any character, But Can I grant the player character randomly somehow Like in crossy road? We can use drop tables to randomize the rewards but same character can be rewarded again and again. How to prevent it?

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

·
Rick Chen avatar image
Rick Chen answered

Your current setup looks good. Could you please describe what genre is your game? If it is STG (like metal slug) or other real-time game, it is not recommended to call any APIs during the game, since there could be delays when calling APIs. According to your setup, the system could be implemented as:

>> The player can buy keys using Real money.

You could follow these documents to setup Real Money purchase in your game: Getting started with PlayFab, Unity IAP, and Android and Non-receipt payment processing

>> If the player has keys and the player encounters a prisoner the player can free the prisoner and the prisoner can grant him some jewels.

If it is a real-time game where millisecond matters, I suggest caching the prisoners player has encountered until the end of the game, then use GrantItemsToUser on your game server or CloudScript to grant the container for each prisoner the player has encountered. Then you could use the UnlockContainerItem API to unlock that container, and you could set the contain to lock with item “Key”, so that it will consume a “Key” when the container is unlocked.

>> but I want only 5 to 10 GrantJewlsOnFreedom containers per day. Is that possible? How can I make this system work.

You could store the number of containers granted to players in their statistic. And use the resettable statistics and leaderboards to reset this statistic everyday. You can get the statistic using GetPlayerStatistics and check if this statistic has reached the limit before granting the container to the players.

>> Can I grant the player character randomly somehow Like in crossy road?

The drop table has no such feature that exclude some items for a player in the result. To achieve this, you need to get the player’s inventory first and see what character item is already there. Then get a full list of character items from your catalog, and exclude the items that is already in player’s inventory. Finally, you could use some method of random to pick one character item from the list of characters that player does not possess.

1 comment
10 |1200

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

Talha Muhammad avatar image Talha Muhammad commented ·

So sorry, I forgot to mention the genre of my game. Its a simple arcade style Puzzle game like (angry birds)

Thankyou so much for the detailed reply. Statistics Cleared the brain fog I was having.

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.