Oops. I posted the following message and didn't send it to the list, but
the person who wrote the orig. message.
I wanted everyone to get this, so here it is again, but to the list.
John Evans <evansj@hi-line.net> -- http://www.hi-line.net/~evansj/
Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke
---------- Forwarded message ----------
Date: Fri, 2 Jan 1998 13:33:23 -0700 (MST)
From: John Evans <evansj@hi-line.net>
To: Lauge Stendahl Johansen <lsd@ruc.dk>
Subject: Re: [NEWBIE] Other potion effect.
On Fri, 2 Jan 1998, Lauge Stendahl Johansen wrote:
> I want to create a potion of youth, which wil make you a year ynger when
> quaffed, but I'm not shure where to put the code. I don't want to create
> an other spell, because I dont want to have spells that are not spells,
> and I dont need the intepreter to search through the spell list when the
> potion is used.
I would create a special procedure, and have it catch the "quaff"
command, instead of making a spell. Something like:
SPECIAL(potion_of_youth)
{
struct obj_data *potion;
char *temp_arg;
if (!CMD_IS("quaff") || IS_NPC(ch))
return FALSE;
if (!*argument) {
send_to_char("What do you want to quaff?\r\n", ch);
return TRUE;
}
temp_arg = argument; /* We do this to preserve the argument */
skip_spaces(&temp_arg);
potion = GET_EQ(ch, WEAR_HOLD);
if (!potion || !isname(temp_arg, potion->name)) {
if (!(potion = get_obj_in_list_vis(ch, temp_arg, ch->carrying))) {
sprintf(buf2, "You don't seem to have %s %s.\r\n",
AN(temp_arg), temp_arg);
send_to_char(buf2, ch);
return TRUE;
}
}
/* At this point, we have the potion found. */
/* If it's NOT the one that has the spec_proc attached, then we let the
normal do_use() code handle it. */
if (potion != me)
return FALSE;
/* Now we know that we have found our potion of youth
and we are about to quaff it. */
/* reduce age */
vict->player.time.birth += (2 * SECS_PER_MUD_YEAR); /* 2 years younger */
/* Tell everyone about it */
act("You become more youthful as you quaff $p!",
FALSE, ch, potion, 0, TO_CHAR);
act("$n becomes more youthful as $e quaffs $p!",
TRUE, ch, potion, 0, TO_ROOM);
/* extract potion */
if (potion = GET_EQ(ch, WEAR_HOLD))
obj_to_char(unequip_char(ch, WEAR_HOLD), ch);
obj_from_char(potion);
extract_obj(potion);
}
The above is all mailer code, so I won't vouch for its stability or
usefulness. If you do use this, please give me a little credit for it.
Say, in lib/text/credits ?
Good luck,
John Evans <evansj@hi-line.net> -- http://www.hi-line.net/~evansj/
Any sufficiently advanced technology is indistinguishable from magic.
--Arthur C. Clarke
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST