question

joeypc6 avatar image
joeypc6 asked

Repeat Every period of time

I want My Game To Give Every Player Amount of items every X Time (2 Types)

- When They Login Today Next Day They Get 64 Wood Or Currency

- When They Don't Login They Get Daily Gift

(The Reset Time Will Be 0:00)

Player Dataapisgame managerPlayStream
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

·
pfnathan avatar image
pfnathan answered

Use of Scheduled tasks and segmentation can accomplish your need.

You could make a "lapsed Players" segment that has a login time above a certain amount. There can be a cloud trigger to do an action or run a cloud script every time they enter that segment.Also, scheduled tasks could run every day for an active players segment to give an item to everybody in that segment. However, it's probably better to have every player run a cloud script every time they log in, which checks the duration since their last login, rather than a daily scheduled task.

Please take a look at forum question about similar topic as well.

https://community.playfab.com/questions/78/205460028-Cloudscript-for-daily-reward.html

and here for the daily reward that uses regenerating currency.

https://community.playfab.com/idea/14304/add-ability-to-reset-virtual-currency-timer.html

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.

brendan avatar image brendan commented ·

Yes, I'll second that and add a bit more context. Bear in mind that Scheduled Tasks don't run at infinite speed. So the more players you're processing, the longer it's going to take. That can mean a significant lag between the first and the last, if you have a large player base. Also, taking actions for players that aren't coming back anymore isn't particularly useful. Taking the action when the player logs in will make sure that the gift is always there when they sign in, if enough time has passed.

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.