Re: LONG: Mob skills & Guildmasters

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


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

> > 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);
> 
> I take it that this is making a new mob in the format of player files.  
> THe problem I have with this is how much will it slow down the MUD, 
> having all mobs with the player_specials taking up memory.

Actually, its making room for the prototype of each mob to have slots to
save the player_specials ... i.e. the skills and spells.  As for slowdown,
I really couldnt tell you, because the mud I'm using this on is still 
under development and only has a few hundred protos, so I dont know what 
it would be like on a large scale, though I doubt a few huntred ints per 
proto would be that big of a memory sucker...

> 
> > 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;
> 
> Hate to sound like a newbie, but what does all this do?  (I wanna know 
> what it does, helps me program better)

This points the actual mob's skill info to the prototype's skill level 
(which we just allocated in the previous paragraph). Thats why later, we 
make sure we don't free it, because then all of the mobs of the same 
type would have a pointer to some vacant area of memory which should 
hold the skill/spell data of the particular mob (type).

> Don't worry, all mobs of the same type I want to have the skill.  I like 
> the idea of the medit save and stuff....I am not sure which editor I will 
> use in mine, as I was weened on Sammy's.  :)

It probably doesnt matter, all you'll need to worry about is checking 
the prototype's skills and writing them out in some way you can retreive 
them (at boot time)... something like: for (i=0, i<=MAX_SPELLS;++i) if (
GET_SKILL(mob, i) > 0) [your save routine here] will work perfectly, 
under any type of olc I've seen...

-Sky



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