Hi, im trying to implement a casual game logic Lives like Candy Crush.
The users need 5 points of energy to can start the game. This energy need autoregenerate 5 points each 15 min.
I was check this example here:
https://github.com/PlayFab/PlayFab-Samples/tree/master/Recipes/RegeneratingCurrency
Using the example over JavaScript work well like expect, but i need know what is the way to do that over Blueprint in Unreal Engine, all examples are using Unity or C++.
The documentation no have examples related Blueprints or Unreal.
Now only have the logic to add and remove amounts over my others currency like gems and coins, but for the energy i need make that mention before.
I was make this CloudConfig followig the example in java Script:
handlers.RegenerateEnergy = function(args) { // get the calling player's inventory and VC balances var GetUserInventoryRequest = { "PlayFabId": currentPlayerId }; var GetUserInventoryResult = server.GetUserInventory(GetUserInventoryRequest); var userInventory = GetUserInventoryResult.Inventory; var userVcBalances = GetUserInventoryResult.VirtualCurrency; var userVcRecharge = GetUserInventoryResult.VirtualCurrencyRechargeTimes; // make sure the player has > 0 lives before proceeding. try { if(!CheckLives(userVcBalances)) { throw "No lives remaining. Purchase additional lives or wait: " + userVcRecharge[ENERGY_CURRENCY_CODE].SecondsToRecharge + " seconds."; } } catch(ex) { return JSON.stringify(ex); } }; function CheckLives(vcBalnces) { if(vcBalnces != null && vcBalnces.hasOwnProperty(ENERGY_CURRENCY_CODE) && vcBalnces[ENERGY_CURRENCY_CODE] > 0) { return true; } else { return false; } } function AddVc(vcBalnces, code, qty) { if(vcBalnces != null && vcBalnces.hasOwnProperty(code) && vcBalnces[code] > 0) { vcBalnces[code] += qty; } var AddUserVirtualCurrencyRequest = { "PlayFabId" : currentPlayerId, "VirtualCurrency": code, "Amount": qty }; var AddUserVirtualCurrencyResult = server.AddUserVirtualCurrency(AddUserVirtualCurrencyRequest); } function SubtractVc(vcBalnces, code, qty) { if(vcBalnces != null && vcBalnces.hasOwnProperty(code) && vcBalnces[code] > 0) { vcBalnces[code] -= qty; } var SubtractUserVirtualCurrencyRequest = { "PlayFabId" : currentPlayerId, "VirtualCurrency": code, "Amount": qty }; var SubtractUserVirtualCurrencyResult = server.SubtractUserVirtualCurrency(SubtractUserVirtualCurrencyRequest); }
But now need help to do the rest...
What is the way to call this and make the regeneration?
Thx