ok, here is my code for assigning mobs as quest mobs.
I created a new flag MOB_QUEST that will be on just while the quest is runing.
in any case, my problem is finding a better way to ditribute quest points to the
person/group that solved the quest. I'm currently giving the points away manually
to the winners as the person/group leader requests and I was thinking if anyone
has a better suggestion about giving quest points away to groups.
the code itself:
defined in interpreter.c as (where all the other commands are at):
{ "qset" , POS_DEAD , do_qset , LVL_GOD, 0},
choose a file to put this function in and also
redeclare ACMD(do_qcomm) there (external function)
ACMD(do_qset)
{
struct char_data *mob;
struct obj_data *obj; /* Under construction */
mob_vnum number;
mob_rnum r_num;
two_arguments(argument, buf, buf2);
if (!*buf || !*buf2 || !isdigit(*buf2))
{
send_to_char("Usage: qset < obj | mob > <vnum>\r\n", ch);
return;
}
if ((number = atoi(buf2)) < 0)
{
send_to_char("A NEGATIVE number??\r\n", ch);
return;
}
if (is_abbrev(buf, "mob"))
{
if ((r_num = real_mobile(number)) < 0)
{
send_to_char("There is no monster with that number.\r\n", ch);
return;
}
mob = get_char_num(r_num);
if (mob==NULL)
{
send_to_char("This mob didn't load!!!\r\n", ch);
return;
}
SET_BIT(MOB_FLAGS(mob), MOB_QUEST);
sprintf(buf, "Mob quest is set on: %s, %d\r\n", mob->player.name, r_num);
send_to_char(buf, ch);
do_qcomm(ch, "New quest, more details will follow.", 0, SCMD_QSAY);
} else if (is_abbrev(buf, "obj"))
{
if ((r_num = real_object(number)) < 0)
{
send_to_char("There is no object with that number.\r\n", ch);
return;
}
send_to_char("Still coding the object quest.\r\n", ch);
/*SET_BIT(GET_OBJ_EXTRA(obj), ITEM_QUEST);*/
} else
send_to_char("That'll have to be either 'obj' or 'mob'.\r\n", ch);
}
and in the end, in fight.c just need to enter a check to see if the mob has
the Quest flag on:
in: void die(struct char_data * ch, struct char_data * killer)
if (!IS_NPC(ch))
REMOVE_BIT(PLR_FLAGS(ch), PLR_KILLER | PLR_THIEF);
+ else
+ {
+ /* if this mob was part of a quest */
+ if (MOB_FLAGGED(ch, MOB_QUEST))
+ {
+ REMOVE_BIT(MOB_FLAGS(ch), MOB_QUEST);
+ if (!IS_NPC(killer))
+ {
+ sprintf(buf, "%s killed the quest mob: %s.", GET_NAME(killer), GET_NAME(ch));
+ mudlog(buf, NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE);
+ }
+ }
+ }
raw_kill(ch, killer);
}
Hope it's not too long. :)
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT