Re: Max # in game

From: Alex (fletchra@qsilver.queensu.ca)
Date: 05/27/03


> What would be more interesting is a system that saved of the number of a
> certain item actually loaded, both in game and in rent. That way a true
> maximum of the item could be achieved. I wonder if anyone has created
> such a system and would be willing to share a little info about how they
> went about that.
We did that on VieMud.  The trick that we used is that we added an extra
field to the object itself which is its _hard_ limit.  So, we essentially
have a double limit.

We "rejigged" the zone file limit to be merely a limit in that room, so if
that object is already in that room, it doesn't load again.  However,
before that's even checked, we check the hard limit on the object itself
to see if the limit on that object's been reached.

This is done by doing a scan of the rent files on bootup, counting up all
of the various objects (that count is kept in another field in the memory
image of the object, but not on disk anywhere), and then incrementing that
counter each time we load a new one.  If the object doesn't have the
specific limiting flag, it's assumed to be unlimited, elsewise, that limit
is checked each time the object is called with a 'load' command from a
zone file.

We did something vaguely similar with mobiles -- the limit in the zone
file is a room limit, and we added a 'zone limit' command to limit the
absolute number of mobiles of that vnum that can load in a zone.

So, if you want to load a maximum of 8 guards in zone 25, with a maximum
of 4 in room A, 3 in room B, and 3 in room C, your zone could look
something vaguely like:

N 0 guard 8        * limit us to 8 guards in the zone total
M 0 guard 4 roomA  * 4 get loaded into roomA to ensure that room always has 4
M 0 guard 4 roomA
M 0 guard 4 roomA
M 0 guard 4 roomA
M 0 guard 3 roomB  * we alternate between B and C now with the rest of them
M 0 guard 3 roomC  * so that we only start with 6 in the world at bootup

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



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