Jump to content

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


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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.