How do I setup a daily reward that can only be claimed once a day?

0 favourites
  • 7 posts
From the Asset Store
Give your players time based rewards, checks how long player has been away to display time remaining to reward.
  • I'm wanting to setup a daily reward that each player can claim just once a day. How do I program this in so the reward can only be claimed once? I then need it to be reclaimable again the following day.

    After they've claimed one reward, I'd like users to be able to claim once a new day starts (midnight) if possible or if not, then exactly 24 hours after they claimed it.

    Any ideas on how I go about doing this?

  • you can use the construct 3 date plugin to compare the time/date. construct.net/en/make-games/manuals/construct-3/plugin-reference/date

    If a reward is claimed store that state in a variable that is saved (using whatever method of saving you are using) and have that variable reset to unclaimed on game load, or during play, if the time is after 00:00 on the next day.

    Of course this only compares system time which can be exploited. If you are happy with your players requiring an internet connection you can get the date/time from a server online.

  • Thanks a lot - I thought it would be something along the lines of this.

    Would I not also need to track the time/day when the reward is claimed? Otherwise, how would the game know when the next day is?

    How would this all be broken down into events and actions? I'm a bit lost with this.

  • Yes you would store the status of reward collection, and the date on which it was collected. Then if the date is different to the stored date and the reward status is "collected" you would reset it to available.

    Have a look at this example using system date/time.

    1drv.ms/u/s!AkmrWgxeuxlKhJt2SxSUj1a5BIkDsQ

  • Thanks for your help. I've managed to save the state of the variable tracking if the reward has been claimed or not but struggling with the date/time it was claimed. I'm using local storage at the moment and have been trying to save the date/time as a string variable, is this correct or should I be saving as a number? If it's the latter, how do I save the date as a number variable?

  • You don't actually even need to save the state of the variable, you can just do a comparison of the stored value at load to determine what the state of the variable should be. Redownload the example and have a look, I've added in Local Storage events.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks so much for that - got it working now! Really appreciate your help :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)