ID:180534
 

Just because I'm not sure, if every mob in the game has a var called "health", and I want a repeating proc called "Regenerate()" that adds 1-5 points to everyone's "health", what line would I use to pull that off?

src.health?
usr.health?

...what?
On 5/22/01 5:26 pm Foomer wrote:
Just because I'm not sure, if every mob in the game has a var called "health", and I want a repeating proc called "Regenerate()" that adds 1-5 points to everyone's "health", what line would I use to pull that off?

src.health?
usr.health?

...what?

Well, as long as it's an internal proc, it's optional...here's a good snippet.... src.health will work, but health is better imo.... usr.health MAY work (since the usr happens to be the source here), but if you ever force-called Regenerate() (like an area that regens every DELAY/2, for faster healing), you would be healing the area

#define DELAY (a number)

mob
-var
--health = 42
--maxhealth = 100
-New()
--spawn(0)
---while(1)
----sleep(DELAY)
----Regenerate()
-proc
--Regenerate()
---health += rand(1,5)
---if(src.health > maxhealth)
----health = maxhealth