merc-l.permanent
snippets · 4.9 KB · 2010-03-30
merc-l mailing-list archive: permanent items.
Download « Back to the snippets list
From avoid@fyionline.comWed Nov 22 15:06:39 1995
Received: by greatdane.webnexus.com; (5.65/1.1.8.2/24Jan95-1133PM)
id AA11344; Sat, 14 Oct 1995 08:50:57 -0700
Received: from erzulie.fyionline.com by greatdane.webnexus.com; (5.65/1.1.8.2/24Jan95-1133PM)
id AA03068; Sat, 14 Oct 1995 08:50:55 -0700
Received: (from avoid@localhost) by erzulie.fyionline.com (8.6.12/8.6.12) id LAA08803; Sat, 14 Oct 1995 11:49:49 -0400
Posted-Date: Sat, 14 Oct 1995 11:49:49 -0400
Date: Sat, 14 Oct 1995 11:49:49 -0400 (EDT)
From: Reble <avoid@fyionline.com>
X-Sender: avoid@erzulie
To: Merc List <merc-l@webnexus.com>
Subject: Perm Spelled Items (code)
Message-Id: <Pine.LNX.3.91.951014113353.8761A-100000@erzulie>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-merc-l@greatdane.webnexus.com
Precedence: bulk
On Friday Oct 13, Kilbia Genta wrote:
> I've seen them in other code bases - things that give you
> permanent invisibility or sustain (one was a perma sanctuary) when you
> held/wore/wielded them.
>
> Would this kind of stuff be defined in the 'affecting fields'
> section of an object definition? And if so, what is the syntax, since
> it's not one of the more common affect flags?
Kilbia,
I had the same need about 4 months ago. Permed items make such good quest
prizes etc.... You could even make a +10 +10 sub issue sword that nobody
would like twice at a newbie having.
Anyways, I've enclosed some code for you to look over:
------------[ Actual 'perm' code ]-------------
void do_perm( CHAR_DATA *ch, char *argument )
{
char item[MAX_INPUT_LENGTH], affect[MAX_INPUT_LENGTH], mod[MAX_INPUT_LENGTH];
OBJ_DATA *obj;
AFFECT_DATA *aff;
argument = one_argument( argument, item );
argument = one_argument( argument, affect );
argument = one_argument( argument, mod );
if (item[0] == '\0' || affect[0] == '\0')
{
send_to_char( "Perm <item> <affect> [modifier]\n\r", ch );
return;
}
if( ( obj = get_obj_carry( ch, item )) == NULL )
{
send_to_char( "You don't have that item.\n\r", ch );
return;
}
aff = malloc( sizeof( *aff ) );
aff->level = ch->level;
aff->duration = -1;
aff->bitvector = 0;
aff->type = aff->location = get_item_apply_val (affect);
if (mod [0] != '\0')
aff->modifier = atoi (mod);
else
aff->modifier = ch-> level;
affect_to_obj( obj, aff );
return;
}
-----------[ End 'perm' code ]----------
I see you have an interest in a perm'd Sanc item, you'll have to add that
code to affect_modify() in handler.c if it isn't there now.
-----[ Begin... handler.c affect_modify() addition ]-----------
case APPLY_SANCTUARY:
{
af.type = skill_lookup( "sanctuary" );
if( fAdd )
{
if( is_affected( ch, af.type ) )
{
send_to_char( "You are already in sanctuary.\n\r", ch );
break;
}
af.level = mod;
af.duration = -1;
af.location = APPLY_NONE;
af.modifier = 0;
af.bitvector = AFF_SANCTUARY;
affect_to_char( ch, &af );
send_to_char( "You are surrounded by a white aura.\n\r", ch );
act( "$n is surrounded by a white aura.", ch, NULL, NULL, TO_ROOM );
break;
}
else
{
affect_strip( ch, af.type );
send_to_char( "The white aura around your body vanishes.\n\r", ch );
act( "The white aura around $n's body vanishes.", ch,
NULL, NULL, TO_ROOM);
break;
}
}
------[ End... handler.c addition ]-----------
The only other thing I think you need to do is:
A). Setup the command/skill to suit.
B). Add the apply types to merc.h for any new perm'd object flags.
C). Compile, and have fun...
I hope that gets you going.... The players love it.
-Reble avoid@erzulie.fyionline.com
P.S. If you want to see it work, come visit the Astral Void at:
----> erzulie.fyionline.com 9999
I'll grant you the skill so you can fiddle with it. =8)'
=============================================================================
/ ______ _______ ____ _____ ___ __ _ ______ ____ ____ _____ /
\ | ____|__ __| _ \ / ____\ / _ \| \ / | ____| / __ \| _ \ / ____\ \
/ | |__ | | | |_| | | | |_| | |\/| | |___ | | | | |_| | | /
/ | ___| | | | ___/| | __| _ | | | | ____| | | | | __/| | ___ \
\ | | | | | | | |___| | | | | | | | |____ | |__| | |\ \| |___| | /
/ |_| |_| |_| o \_____/|_| |_|_| |_|______|o \____/|_| \_|\_____/ \
\ /
============================================================================
------------------------------------------------------------------------------
ftp://ftp.game.org/pub/mud FTP.GAME.ORG http://www.game.org/ftpsite/
------------------------------------------------------------------------------
This archive came from FTP.GAME.ORG, the ultimate source for MUD resources.
------------------------------------------------------------------------------