[MUD-Dev] Describing the environment
Richard Woolcock
KaVir at dial.pipex.com
Wed Mar 4 00:47:46 CET 1998
Stephen Zepp wrote:
>
> This is a re-post of a previous message, do to the revival of a similar thread.
>
> I've been thinking about this for a few days, after hearing about it here and
> seeing it on Kavir's mud, and I'd like to hear thoughts/suggestions on a generic
> module to describe objects, people, etc.For simplicity's sake, I'm gonna just
[snip]
> Okay, comments?
Well I assume you are prompting me, so here is a rough description of how I do
it:
*MOBS/PLAYERS*
Description is generated according to appearance and age, ie:
[snip]
if ( years < 13 ) switch ( char_app( ch ) )
{
default: looks = "a"; break;
case 0: case 1: looks = "an ugly"; break;
case 3: case 4: looks = "a cute"; break;
case 5: case 6: case 7: case 8: case 9: case 10:
looks = "a beautiful"; break;
}
else if ( years >= 40 ) switch ( char_app( ch ) )
{
[snip to later part of code]
if ( ch->sex == SEX_FEMALE )
{
switch ( years )
{
case 0:
sprintf(buf,"%s newborn baby", looks); break;
case 1:
sprintf(buf,"%s tiny little baby", looks); break;
case 2:
sprintf(buf,"%s little baby", looks); break;
case 3:
sprintf(buf,"%s baby", looks); break;
case 4:
sprintf(buf,"%s toddler", looks); break;
case 5: case 6: case 7: case 8:
sprintf(buf,"%s little girl", looks); break;
case 9: case 10: case 11: case 12:
sprintf(buf,"%s young girl", looks); break;
case 13: case 14: case 15:
sprintf(buf,"%s young teenage girl", looks); break;
case 16: case 17: case 18: case 19:
sprintf(buf,"%s teenage girl", looks); break;
case 20: case 21: case 22: case 23: case 24: case 25:
sprintf(buf,"%s young woman", looks); break;
case 26: case 27: case 28: case 29: case 30:
case 31: case 32: case 33: case 34: case 35:
case 36: case 37: case 38: case 39:
sprintf(buf,"%s woman", looks); break;
case 40: case 41: case 42: case 43: case 44:
case 45: case 46: case 47: case 48: case 49:
sprintf(buf,"%s middle-aged lady", looks); break;
default:
sprintf(buf,"%s elderly lady", looks); break;
}
[snip]
This description is currently generated every time the player connects,
or when a dynamic mob is created. If I code anything to let people
change their appearance stat then I'll probably call the function again
from that. People age at approximately 1 mud year per 6 days real time.
*OBJECTS*
Object descriptions are currently generated according to a number of
values (each character of an alphabetical string), as well as the
condition of the object, ie:
[snip]
switch ( values[0] )
{
default: send_to_char("BUG.\n\r",ch); return;
case 'a':
obj->wear_flags = ITEM_TAKE + ITEM_WEAR_LEGS;
pair_of = TRUE;
switch ( values[1] )
{
default: send_to_char("BUG.\n\r",ch); return;
case 'a': strcpy( buf1, "jeans" ); break;
case 'b': strcpy( buf1, "trousers" ); break;
case 'c': strcpy( buf1, "skirt" ); break;
case 'd': strcpy( buf1, "kilt" ); break;
case 'e': strcpy( buf1, "miniskirt" ); break;
case 'f': strcpy( buf1, "leather trousers" ); break;
}
break;
case 'b':
[snip to later part of code]
switch ( values[8] )
{
default : send_to_char("BUG.\n\r",ch); return;
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k':
if ( ch->size < values[8] )
size_fit = -1;
else if ( ch->size > values[8] )
size_fit = 1;
break;
}
[snip to later part of code]
if ( obj->condition >= 100 )
strcpy( dam_mes, "" );
else if ( obj->condition >= 75 )
{
switch ( obj_dam )
{
default:
strcpy( dam_mes, "torn " ); break;
case DAMAGE_HARD:
strcpy( dam_mes, "slightly dented " ); break;
case DAMAGE_WEAPONS:
strcpy( dam_mes, "slightly notched " ); break;
}
}
else if ( obj->condition >= 25 )
[snip to later part of code]
if ( is_weapon )
{
if ( obj->condition >= 100 )
sprintf( buf, "%s %s %s", an_not_a ? "an" : "a", buf3, buf1 );
else
sprintf( buf, "a %s%s %s", dam_mes, buf3, buf1 );
}
else switch ( obj->wear_loc )
{
sprintf( buf, "a %s%s%s%s %s", dam_mes,
pair_of ? "pair of " : "",
size_fit > 0 ? "tight-fitting " :
size_fit < 0 ? "loose-fitting " : "", buf2, buf1 );
break;
case WEAR_FACE:
sprintf( buf, "a %s%s%s %s", dam_mes,
pair_of ? "pair of " : "", buf2, buf1 );
[snip]
Sorry to quote so much code, but its easier than trying to describe without
examples ;)
Objects are renamed every time they are worn, removed, damaged or repaired.
At the moment the descriptions only vary in terms of size (tight, loose)
and damage, but as soon as I get some free time I'll update it to also
include blood stains (wet and dry), wetness, rust (for metal - I already
have material types so it shouldn't be too hard), dirt and various other
things. The result is that fighting can seriously mess up you clothing -
but then I am trying to get away from pure hack-and-slash anyway, so it
shouldn't be a problem.
As a quick example of what the equipment looks like:
<[Healthy] [Exp:538]> eq
You are using:
[On Body ] a tight-fitting black t-shirt
[On Legs ] a ripped pair of black leather trousers
[On Feet ] a pair of black boots
[On Hands ] a shredded pair of black leather gloves
[Around Body ] a tight-fitting black jacket
[Around Waist ] a torn black leather belt
[Around Wrist ] a silver watch
[Right Hand ] a slightly notched iron shortsword
[Left Hand ] a notched iron knife
[On Face ] a slightly dented pair of black shades
Now I admit the code is not written as well as it could be, but I hope
this will give some insight into a possible solution to Stephen's
suggestion.
KaVir.
More information about the mud-dev-archive
mailing list