Players live's generation using real time


#1

Hello

I have question to you all.
There is a way, that example: Every 10 minutes (real time) player will get 1 extra live in my game even if game is closed on android?

When player open game again, game will calculate time to lives
Example:
Game was closed for 60 min, each 10 min player will get 1 extra live. When player start game again after 60 min, he will receive 6 extra live

There is possible to do something similar in Gdevelop?


#2

Look into Storage actions. Save the current date time when the game is exited. Retrieve it upon start up and compare it with the current date time.


#3

Here’s a rough idea of how you’d begin doing that -

That’s my system and while it’s not 100% perfect, it does work (as much as I need it to hahah). The main thing it’s missing is the logic related to changing months and the varying days in each month, so that would be something you’ll have to figure out because I have no clue lol. (I basically just have a bandaid fix in my game so that when the logout month doesn’t equal the login month, my timers instantly go to zero, so it potentially just lets my players get quicker spawns once a month).

But in your case, I believe you could just take the “timepassed” number and divide it by however many seconds equal a new life, or something to that degree


#4

That what i need

This is what i added. Need test it now

@Edit

Holy i got value -30k+ :smiley: but i found my mess up " “Read value’s for Day,Hour,Minute” all goes to “LogOutDay”