Re: # of mobs in room and # mobs in zone

From: Skylar (skylar@ifconfig.intserv.com)
Date: 06/25/96


On Tue, 25 Jun 1996, Ben Leibig wrote:

> Has anyone written afunction to determine the number of any given mob in a
> room or in a zone.  If so could you give me a hint on how it was done

No, I'm not sure what the use is... I'll give it a shot though...


> num_mob_room(603, 600);
> would return an int which would be the number of mob 603's in room 600.


int num_mob_room(int mob_num, room_num room)
{
  struct char_data i;
  int r_room, count = 0;

  if ((r_room = real_room(room)) < 0)  /* non existant room */
    return -1;

  for (i = world[r_room].people; i; i = i->next_in_room)
    if (GET_MOB_VNUM(i) == mob_num)
      ++count;
}



Hmm, I think that should do it... its late (early?) though, and I'm doing 
this from my mail-reader, so I can't be 100% sure... try it.


-Sky



This archive was generated by hypermail 2b30 : 12/18/00 PST