Re: [CODE] [CIRCLE] Regeneration

From: Welcor (
Date: 01/09/02

Look below for details.
----- Original Message -----
From: "The Arrow" <arrow@PILEBORG.ORG>
> On Wed, 9 Jan 2002, Morten Bojsen-Hansen wrote:
> > I am creating a new type of item apply that adds faster regeneration of
> > hits, mana and move.
> > However, the char only regenerates every MUD hour now, and I
> > want to change it to regenerate more often (like every 2 seconds) but much
> > less of course.
> >
> > To my question:
> > Where do I lower the regeneration time?
What you're looking for is the dg_events package, and the corresponding dg_regen
patch, both found on the ftp site. The regen patch supplied actually doesn't change
the amount of hitpoints you gain, it just evens the gain out a bit. This means
to add the kind of effect you're talking about is quite easy, since all you would
need to change (once you got the patch in) is a small check in hit/mana/move_gain()
to add to/subtract from the gain.

> To answer a completely different question (one that has not been asked):
> My mud have a new field in the room file that tells the mud to give
> characters standing in thos rooms more hit/move/mana points at certain
> times. These times are PULSE_VILENCE, PULSE_MOBILE, and at every tick
> (the timing is controled by flags). What I did was to call a special
> function from the heartbeat() function (in comm.c), that then handles
> these "regeneration" rooms.

In this case I'm afraid it would be too much to check the whole object list

> To come back to the topic, what I would do in this case, is to call a
> function in heartbeat() that goes through the character list every X pulse.
> This function then checks if the characters are affected by this spell
> (or whatever), and then adds some hit/mana/move points.
The problem here is that going through the character list means you also
check on a whole lot of people who actually are at full health. All the
mobs who aren't in a fight comes to mind. The dg_regen patch works by making
a queue of events to be called at specified times. This is a lot less
processor consuming, since you only call the regen function when needed, and
only need to check out what to do _this_ pulse, if anything.

> Remember: never increase the amount above the characters max!
> (use GET_HIT(ch) = MIN(GET_MAX_HIT(ch), GET_HIT(ch) + amount)).

The dg_regen patch handles this part. No need to worry about it.


btw - I'm not the author of dg scripts, even if it may sound like it.
I just think the implementation is one of the coolest ideas this side
of "The Great Western".

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT