Quests Code

From: Alex Mann (alex4501@hotmail.com)
Date: 04/04/01


Hi

I am in the process of adding a highly modified version of the automated
quest system which is stored on ceramic mouse.

The one problem which i am getting is in teh following code:

void generate_quest(struct char_data *ch, struct char_data *questman)
{
    struct char_data *victim = NULL;
    struct char_data *vsearch = NULL, *tch = NULL;
    struct obj_data *questitem;
    int level_diff, r_num, mcounter, i, found;

    for (mcounter = 0; mcounter < 99; mcounter ++)
    {

        r_num = number(1, top_of_mobt - 1);
         if ( (vsearch = read_mobile(r_num, REAL)) != NULL)
         {
            level_diff = GET_LEVEL(vsearch) - GET_LEVEL(ch);

/* Level differences to search for. Moongate has 350
   levels, so you will want to tweak these greater or
   less than statements for yourself. - Vassago */

            if(GET_LEVEL(ch) < LVL_IMMORT)
/* imm testing */


    if (level_diff > 10 || level_diff < -5 ||
                 !MOB_FLAGGED(vsearch, MOB_QUEST))
              {
              char_to_room(vsearch, real_room(1204));
              extract_char(vsearch);
              vsearch = NULL;
              }
         if(vsearch != NULL)
             break;
         }

    }
    if(GET_LEVEL(ch) < LVL_IMMORT)  /* imm 100% */
    if(chance(50) && vsearch != NULL) /* chance that a quest will be
generated
*/
    {
     char_to_room(vsearch, real_room(1204));
     extract_char(vsearch);
     vsearch = NULL;
    }
    if(vsearch != NULL)
{

     found = 0;
     for(i = 0; i < top_of_world; i++)
     {
      for(tch = world[i].people;tch;tch = tch->next_in_room)
      {
       if(GET_MOB_VNUM(tch) == GET_MOB_VNUM(vsearch))
       {
        victim = tch;
        found = 1;
        break;
       }
      }
      if(found)
       {
     char_to_room(vsearch, real_room(1204));
     extract_char(vsearch);
     vsearch = NULL;
        break;
       }
     }
}
    if (victim == NULL)
    {
  sprintf(buf, "I'm sorry, but I don't have any quests for you at this
time.");
  act(buf, FALSE, questman, 0, 0, TO_ROOM);
  sprintf(buf, "Try again later.");
  act(buf, FALSE, questman, 0, 0, TO_ROOM);
  GET_NEXTQUEST(ch) = 5;
  return;
    }

Somewhere in this block of code is something which is causeing no quest to
be generated. Basicly i want to remove this so that if you request a quest,
you get given one.

My next step after identifiying this will be to strip the code, and start
issuing quests based on the players level. But that is for later. So if
someone could have a look through the code and point out which bit they
think is that is causing it to not generate a quest everytime i would be
gratefull.

Thanks
Alex

naryanworld.orisis.net 4445
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/05/01 PST