question

Muhammad Roshaan Tariq avatar image
Muhammad Roshaan Tariq asked

Rechargable game currency

Hi,

So I have a rechargable game currency called Keys and what I want is to regenerate it using Playfab's automatic procedure in which I want it to regenerate the Key every 1 hour if the Key count drops below 10 in my player's inventory.

I am thinking of doing this using this feature but I have few questions about it:

  1. Will it regenerate automatically or do I have to call this function or run some CRON job?
  2. Like my requirement is 10 keys maximum for my player and I only want it to regenerate when player uses one key and it drops to 9 and then the player has to wait for 1 hour before my player can have 10 keys again, Is it possible using this feature?
  3. When I use my first key and dip below the maximum count, will I have to wait exactly one hour for the next key?
  4. Is this timer unique for each user? Because I don't want different users to get the key at the same time unless they have used a key at the same time. For example, What I really want is that if Player1 has used 1 key at 10:50AM then Player1 should get the Key at exactly 11:50AM And if Player2 uses the Key at 10:30AM then Player2 should get the key at 11:30AM and Player1 should get the key at his own time which is 11:50AM
  5. How this is going to run for player? Do I have to call any method to do so? And if the user goes offline will this still run and generate the keys for my players? Because I want my players to have right amount of keys if they login again after some time.

Before you answer my questions please see the attached screenshot to see my current curreny settings

In-Game EconomyPlayer 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

Seth Du avatar image
Seth Du answered

1. VC will be recharge automatically and gradually within 24 hours, and the quantity is evenly distributed over the period.

2. If you have 10 keys, and you want to recharge it one per hour, then the configuration should be

    • Initial deposit: 10
    • Recharge rate: 24
    • Recharge Maximum: 10 (Yes, your configuration is correct, but I will suggest initial deposit as 10)

    (ps. To calculate the charge rate, simply divide 24 units/24 hours = 1 unit/hour, you can convert it to minute/second)

    3. If the configuration is the same as above, then it is yes. The player should wait for 1 hour exactly.

    4. After the configuration is defined, the recharge rate is defined, which is 1/hour, and the VC starts to recharge in this rate only when it is not in maximum, which means each user recharges the VC in different time if they consume it in different time.

    5. It happens automatically and you don’t have to actively call anything!

    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.

    pixelsage avatar image pixelsage commented ·

    This is the kind of detailed answer I like (: In particular, knowing that the exact recharge time per player depends on when the consume the currency is important! Thanks!

    1 Like 1 ·
    Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

    Hey, thanks for the response @SethDu

    This was very helpful and I like this feature very much already.

    1 Like 1 ·