Re: CIRCLE 3.0 ABRIDGED WORLD BUILDER'S GUIDE - PRELIM

From: Jeff (jfink@csugrad.cs.vt.edu)
Date: 04/05/94


vamp@csulib.edu writes:
> 
> On Mon, 4 Apr 1994, Jeff Teker Fink wrote:
> 
> > Rather than editing the mob and obj file formats we have added a series of
> > optional flags that can be placed at the end of each object/mobile.  For 
> > mobiles, we give them skills just by adding some of these optional lines.
> > For instance,
> > 
> > S 45 100
> > 
> > would give the mobile skill #45 (bash? can't remember) at 100 percent.  I've
> 
> Hmm.. how hard was this to code, and how did you go about implementing 
> it?  It sounds more than a bit useful, and I might like to do somethign 
> similar.

Well, here's how I went about it:  First, I modified the routines in db.c
to check for the flags and to malloc a set of skill values.  Then I went into
the spells and changed all the SPELLO() macros.  It was important to specify
certain spells as MOB_COMBAT so that mobs wouldn't cast them on themselves
while waiting in an empty room (wouldn't want them killing themselves).  I
also added "cast_backstab" and like function declarations for all of the skills.
Next, I wrote the "cast_backstab" and like functions.  Basically, they take
the mob as the caster, and the function then decides what that mob does.  For
instance, the "cast_steal" looks through the room for a PC victim (looking 
for sleeping ones first) chooses a victim, and then calls do_steal() to
perform the action.  Similar procedures were written for bash, kick, etc.
Then I wrote a function in mobact (I really rewrote the whole file, but its
not neccessary if you only want skills/spells on mobiles) that tallies up the
skills this mob can use (under the given circumstances i.e. fighting/not 
fighting) and then randomly picks one skill to use.  After picking the skill,
I call the cast function for that spell (which is made really easy if you add
in all the new cast_ functions in the SPELLO list, since it's an array and
works just like the command pointers.... no switch statement neccessary)
and deduct mana from the mob.

However, you'll probably want to check to make sure the mob is standing
before casting, and design some heirarchy for what the mobs do and in what
order.

How easy is it?  Well, the base code was really pretty easy if you're familiar
with Diku code... it was a bit time consuming making sure that all of the new
cast_ functions were working right.  You'll probably have to modify every 
skill that only lets thieves or fighters do them (like do_bash() makes sure
you're a warrior... I don't think it checks to make sure you are a PC) and
you need to get rid of restrictions so that the mobs can perform them under
any circumstances (removing our shield restriction for bash, as well as
weapon weight restrictions for other skills).  Also:  If you have a parry
skill, don't give it to a mob unless it can swing while parrying... or have
a buddy NPC helping him out... we had some mobs that would parry and parry
but would never swing back... the spellcasters ended up toasting them and
not being scratched!  Also, the cast_ functions never check for NOMAGIC rooms
(Are these imped on Circle?  I can't remember)

> > We've got the USEITEM flag... but it gets abused... people dropping cursed
> > armor for mobs to pick up and use...
> 
> Heh heh, you must have been expecting that one before you implemented it 
> though....  Like dropping small swords for mobs to wield instead of doing 
> their massave hand damage, they only get small sword damage.

Actually, ours are smart on weapons... we let the mobs calculate average damage
of their current weapon (or barehand if they have none) and compare it to the
new weapon... if the new weapon is inferior, they just carry it around.  They
just end up with a 100 armor class... ;-)  (which I suppose wouldn't be too
hard to fix)

-Jeff



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