# Doing HP, Money, Exp in RPG games

## Recommended Posts

Molarmite    122
How do you get all of those things above to increase or decrease depending on where you go? I already got a database with all those created, now I need to make like a hospital where HP goes up, a store where Money goes down, etc. Can anyone help me out with this? I'm making a browser-based RPG using PHP/MySQL. [Edited by - Molarmite on May 8, 2007 9:28:06 PM]

##### Share on other sites
Telastyn    3777
psuedosql:

Run every 'tick' (or depending on the design, run when your browser leaves the hospital and adding a time multiplier to the effect):

if character.locale in (locales with hospitals) and character.hp < character.maxhp then character.hp += hospital.heal_rate;if character.hp > character.maxhp then character.hp = character.maxhp;

Something akin to this I'd imagine at least. Clear? Not clear? Care to explain more of your design and ideas of how to do it, but why those don't work?

##### Share on other sites
Maebius    122
I can't get to these forums at work (where I spend most of my online time), but I've gotten a PHP/MySQL game up and running to teach myself.

There are a number of different ways to handle your question, and they depend a lot of what type of game you are running.

Feel free to shoot me a PM and or an email and I'd be glad to discuss the details or various methods and help you out. Maybe we can even trade ideas for mutual benefit.
-Maebius