Re: [CODE] NPC Races/classes

From: Admin of The Keep (
Date: 09/29/96

On Sat, 28 Sep 1996, Steve Reeves wrote:

> Anyway, the first thing I did to the code was maul it up a bit and add two
> new classes.  As I was going thru one of the *.h files [structs.h, I think]
> to add a few things, I noticed a few lines that dealt with NPC classes, but
> nothing was implemented.  I'm wondering if anyone can give me some advice on
> how to implement NPC classes?  Ideally, the NPC Class flag would be
> optional.  [ie, if there is nothing about it in the mob file, it
> automatically defaults to a certain class.  This means I won't have to
> convert all the mob files already there.]  Seeing as I'm a new coder, I have
> no idea how to go about this.  [It took me a few hours to get the bugs outta
> the new classes I added.  heh.. and the bugs were pretty simple things, like
> a misplaced bracket.]

Optional things can be easy to add in CircleMUD.  In the standard format
mobiles, things are organized so that they use sscanf() in db.c.  Sscanf
returns the number of things it matched to your included criteria.  If you
modify the criteria, you can later check if there is additional things on
your line.  Not having looked at Circle's db.c code in such a long time
prevents me from being too specific, but it's not difficult to figure out
if you just look at the code.

If there is not that last parameter on the line you sscanf() then set
class to 0, where you have 0 being your standard class.

The next thing you'll want to do is have classes mean something for your
mobiles.  Including changing how stats work for mobiles.  My idea is that
the NPC class, like a PC's class, states the priority of stats.  The stats
in the NPC's file is subtracted by 15 (approx. average) and the difference
is added to the rolled stats (so Jupiter would get a roll+3 if his
strength was 18).

NPC races, which I have implemented on my Circle, could also do priority,
so a Barbarian Warrior would generally roll higher strength than anything
else.  So it would investigate the priority of the NPC's race and class
and roll in the best priority...

For instance: a race gives 5 priority to strength, a NPC class gives 2
priority to strength (higher priority is better).  Adveraging that you get
about 3 priority.  Since we have 6 stats strength would most lilely be the
second through fourth in the priority.  If both give constitution 6 then
the average would be 6 and constitution would most likely be the best.

This accounts for race, class, and unqiueness of NPCs.


| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

This archive was generated by hypermail 2b30 : 12/18/00 PST