|
Frollo (Added Jul 20, 1998): Quest Shops |
|
Contributed by greerga on Wednesday August 12, @11:19PM,
from the Specials dept.
. Click the link below to read it or download it.
From: Frollo <mudaholic@aol.com>
Subject: Quest Shop -- selling items for Quest points
If anyone is interested, this is my quest master guy...
he doesn''t host quests or anything, but he''s like a quest-
shop guy...etc etc etc, you get the point. if you use this
you will want to change the quest_items[] to the virtual #s
of the quest items you want to use...also, you''ll have to make
the mob, define the procs, add this into act_movement.c :
...
if (!IS_AFFECTED(ch, AFF_SNEAK))
act("$n has arrived.", TRUE, ch, 0, 0, TO_ROOM);
if (ch->desc != NULL)
look_at_room(ch, 0);
+command_interpreter(ch,"arrive");
if (IS_SET(ROOM_FLAGS(ch->in_room), ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT
) {
log_death_trap(ch);
...
and down at the bottom of the file, add an empty ACMD(do_arrive)
and define do_arrive in interpreter.c ...the reason for this is
because i can''t find any other way to make mobs do stuff when
you arrive :) but hey, it works, right?
enjoy!
oh yeah, you''ll have to add in an int questpoints somewhere
in structs and define the GET_QUESTP in utils.h ...shouldn''t
be too hard
int quest_items[] = {3, 50, 51, 52};
// ^ NUMBER OF ITEMS
SPECIAL(quest_shop)
{
struct obj_data *obj;
struct char_data *mob = (struct char_data *) me;
int qp, r_num, x;
ACMD(do_vstat);
if (CMD_IS("list")) {
sprintf(buf, " ## Item Quest Points\r
\n"
"---------------------------------------------------------------\r\n")
;
for (x = 1; x <= quest_items[0]; x++) {
obj = read_object(quest_items[x], VIRTUAL);
if (obj == NULL)
continue;
sprintf(buf2, "%s", (obj)->short_description);
CAP(buf2);
sprintf(buf, "%s%3d) %-45s%12d\r\n", buf, x, buf2, GET_OBJ_COST(obj));
}
send_to_char(buf, ch);
return 1;
} else if (CMD_IS("buy")) {
one_argument(argument, arg);
if (!(qp = atoi(arg))) {
send_to_char("&n&cThe Quest Master says, ''Please specify which item you would l
ike to purchase using \"BUY #\".''&n\r\n", ch);
return 1;
}
if (qp < 0) {
send_to_char("&n&cThe Quest Master says, ''A negative number?!?''&n\r\n", ch);
return 1;
}
if (qp > quest_items[0]) {
send_to_char("&n&cThe Quest Master says, ''Sorry, my inventory isn''t quite that
high yet.''&n\r\n", ch);
return 1;
}
obj = read_object(quest_items[qp], VIRTUAL);
if (GET_QUESTP(ch) < GET_OBJ_COST(obj)) {
sprintf(buf, "&n&cThe Quest Master says, ''%s costs %d quest points...which I se
e you can''t afford!''&n\r\n",
(obj)->short_description, GET_OBJ_COST(obj));
CAP(buf);
send_to_char(buf, ch);
return 1;
}
GET_QUESTP(ch) -= GET_OBJ_COST(obj);
sprintf(buf, "&n&cThe Quest Master says, ''I''ll take %d quest points for %s, %s.
''&n\r\n",
GET_OBJ_COST(obj), (obj)->short_description, GET_NAME(ch));
send_to_room(buf, ch->in_room);
obj_to_char(obj, ch);
return 1;
} else if (CMD_IS("info")) {
one_argument(argument, arg);
if (!(qp = atoi(arg))) {
send_to_char("&n&cThe Quest Master says, ''Please specify which item you would l
ike information on using \"INFO #\".''&n\r\n", ch);
return 1;
}
if (qp < 0) {
send_to_char("&n&cThe Quest Master says, ''A negative number?!?''&n\r\n", ch);
return 1;
}
if (qp > quest_items[0]) {
send_to_char("&n&cThe Quest Master says, ''Sorry, my inventory isn''t quite that
high yet.''&n\r\n", ch);
return 1;
}
if ((r_num = real_object(quest_items[qp])) < 0) {
send_to_char("&n&cThe Quest Master says, ''Uh-oh...I seem to have made an error!
Please report me immediatly and you WILL be rewarded.\r\n&n", ch);
return 1;
}
obj = read_object(r_num, REAL);
do_stat_object(ch, obj);
extract_obj(obj);
return 1;
} else if (CMD_IS("arrive")) {
if (GET_QUESTP(ch) <= 0)
do_say(mob,"You are aware that I only deal in quest points..?",0,0);
else {
command_interpreter(mob, "smile");
do_say(mob,"Welcome, welcome! Please type LIST to view my wares, INFO to get",0
,0);
do_say(mob,"information on an item, and BUY to exchange your quest points for",
0,0);
do_say(mob,"unique quest items!&n",0,0);
}
return 0;
} else
return 0;
}
<< Leonardo Herrera: Push Code (for players) | Reply | Threaded >> |
|
Features
| |
This is the new CircleMUD News site. It is based off the Slashdot 0.2 Perl code and will resemble Slashdot.org site for awhile. |
|