Re: LONG: Mob skills & Guildmasters

From: Skylar (skylar@ifconfig.intserv.com)
Date: 07/09/96


On Tue, 9 Jul 1996, Ryan A.J. Biggs wrote:

> I am working on a major overhaul MUD based on Circle bpl 11, and I have a 
> few questions.  Firstly, I am lkooking into  making it so that mobs can 
> have skills (ie. A mob that can dodge or cast spells, or steal...without 
> spec_procs for individual commands) and that use this skill definition to 
> determine what level they can teach a skill up to if they are a guildmaster.


First, go into db.c, function parse_mobile(), I think its around line 1020
or so... but I'm not sure how "stock" my stock version of pl11 still is, 
so you'll have to double check... you need to replace this line:

mob_proto[i].player_specials = &dummy_mob;

With this line:

CREATE((mob_proto + i)->player_specials, struct player_special_data, 1);




Next, still in db.c, function read_mobile(), after the line:

mob->player.time.logon = time(0);

add this line:

*mob->player_specials = *mob_proto[i].player_specials;



Next, still in db.c, function free_char(), where is calls:

free(ch->player_specials);  Just add an if (!IS_NPC(ch)) check before that
line, so the special doesnt get free'd .... also, you might want to axe the
annoying "SYSERR: Mob had player_specials allocated!" log message as well.



Your mob prototypes now have slots to hold spells/skills, note: all mobs
of the same type have the same skills, so if you fiddle one cityguard's
dodge, it'll affect them all (I think of this as a feature). You will need
some way to assign skills to mobs, I'd suggest using the espec feature,
its pretty simple to add both for loading and saving... I'm a pretty lazy
coder, so I simply took the !IS_NPC check out of do_skillset and use that
to set the skills, a tiny snip of code in the medit save routine 
(I'm using Oasis OLC) writes any mob skills > 0 into the .mob file as an 
espec.



-Sky



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