Hello Coders, Builders and all other persons.

I installed Vasago QUEST snippet, but there is one nasty bug, what I couldn't fix. When player get quest then almost all quest mobiles genereated in same area. I tried to fix 'generate quest' and random mobile loading but then almost all time questmaster cannot find mobile. My question is: How I can add random_mobile for quests and all times questmaster found random mobile from my MUD. I hate when questmaster says : "I'm sorry, but I don't have any quests for you at this time.".


And if anyone want to see MY generate_quest:

void generate_quest(CHAR_DATA *ch, CHAR_DATA *questman)
{
   CHAR_DATA *victim;
   ROOM_INDEX_DATA *room;
   OBJ_DATA *questitem;
   char buf [MAX_STRING_LENGTH];

   /*  Randomly selects a mob from the world mob list. If you don't
       want a mob to be selected, make sure it is immune to summon.
       Or, you could add a new mob flag called ACT_NOQUEST. The mob
       is selected for both mob and obj quests, even tho in the obj
       quest the mob is not used. This is done to assure the level
       of difficulty for the area isn't too great for the player. */

   for (victim = char_list; victim != NULL; victim = victim->next)
   {
       if (!IS_NPC(victim)) continue;

       if (quest_level_diff(ch->level, victim->level) == TRUE
           && !IS_SET(victim->imm_flags, IMM_SUMMON)
           && victim->pIndexData != NULL
           && victim->pIndexData->pShop == NULL
           && !IS_SET(victim->act, ACT_PET)
           && !IS_SET(victim->affected_by, AFF_CHARM)
           && chance(15)) break;
   }

   if ( victim == NULL  )
   {
do_say(questman, "I'm sorry, but I don't have any quests for you at this time.");
       do_say(questman, "Try again later.");
       ch->nextquest = 2;
       ch->nextquest = 2;
       return;
   }

   if ( ( room = find_location( ch, victim->name ) ) == NULL )
   {
sprintf(buf, "I'm sorry, but I don't have any quests for you at this time.");
       do_say(questman, buf);
       sprintf(buf, "Try again later.");
       do_say(questman, buf);
       ch->nextquest = 2;
       return;
   }

   /*  40% chance it will send the player on a 'recover item' quest. */

   if (chance(40))
   {
       int objvnum = 0;

       switch(number_range(0,6))
       {
           case 0:
           objvnum = QUEST_OBJQUEST1;
           break;

           case 1:
           objvnum = QUEST_OBJQUEST2;
           break;

           case 2:
           objvnum = QUEST_OBJQUEST3;
           break;

           case 3:
           objvnum = QUEST_OBJQUEST4;
           break;

           case 4:
           objvnum = QUEST_OBJQUEST5;
           break;

           case 5:
           objvnum = QUEST_OBJQUEST6;
           break;

           case 6:
           objvnum = QUEST_OBJQUEST7;
           break;
       }

       questitem = create_object( get_obj_index(objvnum), ch->level );
       obj_to_room(questitem, room);
       ch->questobj = questitem->pIndexData->vnum;

sprintf(buf, "Vile pilferers have stolen %s from the royal treasury!", questitem->short_descr);
       do_say(questman, buf);
do_say(questman, "My court wizardess, with her magic orb, has pinpointed its location.");

/* I changed my area names so that they have just the name of the area and none of the level stuff. You may want to comment these next two
          lines. - Vassago */

sprintf(buf, "Look in the general area of %s for %s!",room->area->name,
        room->name);
       do_say(questman, buf);
       return;
   }

   /* Quest to kill a mob */

   else
   {
   switch(number_range(0,1))
   {
       case 0:
sprintf(buf, "An enemy of mine, %s, is making vile threats against the crown.",victim->short_descr);
       do_say(questman, buf);
       sprintf(buf, "This threat must be eliminated!");
       do_say(questman, buf);
       break;

       case 1:
sprintf(buf, "Rune's most heinous criminal, %s, has escaped from the dungeon!",victim->short_descr);
       do_say(questman, buf);
sprintf(buf, "Since the escape, %s has murdered %d civillians!",victim->short_descr, number_range(2,20));
       do_say(questman, buf);
do_say(questman,"The penalty for this crime is death, and you are to deliver the sentence!");
       break;
   }

   if (room->name != NULL)
   {
sprintf(buf, "Seek %s out somewhere in the vicinity of %s!",victim->short_descr,room->name);
       do_say(questman, buf);

/* I changed my area names so that they have just the name of the area and none of the level stuff. You may want to comment these next two
          lines. - Vassago */

sprintf(buf, "That location is in the general area of %s.",room->area->name);
       do_say(questman, buf);
   }
   ch->questmob = victim->pIndexData->vnum;
   }
   return;
}

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

bool quest_level_diff(int clevel, int mlevel)
{

    if (clevel < 22  && mlevel < 27)                                      
return TRUE;
else if (clevel > 22  && clevel < 27  && mlevel < 42)                  return 
TRUE;
else if (clevel > 26 && clevel < 37 && mlevel > 34 && mlevel < 39) return TRUE; else if (clevel > 22 && clevel < 29 && mlevel > 34 && mlevel < 57) return TRUE; else if (clevel > 28 && clevel < 57 && mlevel > 51 && mlevel < 101) return TRUE;
else if (clevel > 57 && mlevel > 90)                                      
return TRUE;
else                                                                    return 
FALSE;


}

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail


Reply via email to