Jump to content

How to make a certain value of a table increase overtime?


Bikkebakke

Recommended Posts

So yea, I hope this is the right place to ask this:

I'm working on a browser-game and I'd want to add a regen/recovery/recuperation system so that i.e. if you run out of money and can't afford to pay "hospital bill", your hp would regenerate overtime. Or if you already used all the "stamina", it would regenerate so you can go run more "errands" to make some cash.  ;D

 

You see it everywhere but it's the kind of thing that's hard to search help for, other than asking from people that know, of course! So please, enlighten me and I'll be beholden for you forever! (Or at least untill I encounter the next problem.)

Hi

 

Probably most just use CRON jobs. Failing that do it manually in some regularly run code (ie, possibly the code that checks users are stlill logged in when they do anything). Store when the update was last done, and when that is over X ago, update the health and update the time an update was last done.

 

All the best

 

Keith

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.