The Mud Connector

Author Topic: Vassago quest code bug Rom 2.4b6  (Read 2303 times)

zabaduba

  • New to TMC
  • *
  • Posts: 6
    • View Profile
Vassago quest code bug Rom 2.4b6
« on: June 15, 2018, 11:52 AM »
Over the years as a player on muds running Vassago's quest code, I occasionally ran into a bug where I got the wrong quest mob. For example, instead of choosing target with name "blob" vnum 3701 it'd choose target "blob" with vnum 11015 (with different short description what would not be a legal target). I figured the bug was that the code was searching by *MOB_INDEX_DATA vsearch->player_name and was just returning the first hit. so I created a new function (pasted below) which would confirm that the vnum was correct too.

~~~~~~~~~~~~~~
CHAR_DATA *get_questmob_world(CHAR_DATA * ch, char *argument, int vnum)
{
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *wch;
    int number = number_argument(argument, arg), count = 0;

    for (wch = char_list; wch != NULL; wch = wch->next) {
   if (!IS_NPC(wch) || wch->in_room == NULL || !is_name(arg, wch->name) || vnum != wch->pIndexData->vnum)
       continue;
   if (++count == number)
       return wch;
    }

    return NULL;
}
~~~~~~~~~~~~~~

It helped - doesn't happen as often, but it still happens.

Has anyone come across this bug? Any ideas?

Thanks!

zabaduba

  • New to TMC
  • *
  • Posts: 6
    • View Profile
Re: Vassago quest code bug Rom 2.4b6
« Reply #1 on: June 17, 2018, 11:45 AM »
Figured out the bug.

In Vassago's code it also does a subsequent independent room search using the old function - as a result, even though the correct mob is selected, it'll send the player the information for the wrong one.