On Tue, 9 Apr 1996, Ben Leibig wrote:
> Is there any way i can see how meny of a certen mob(ie Vnum 1348) are in a room
> and in a zone. Is there some way to earch this. I just want a number returned
> being the number of that mob in the zone or room. Any easy ways to do this or
> does it take a bunch of code?
try somethin like
int num_mob_room(int mvnum, int room_num)
{
struct char_data *mob;
int count = 0;
for (mob=world[room_num].people; mob; mob = mob->next_in_room)
if (IS_NPC(mob) && GET_MOB_VNUM(mob) == mvnum)
count++;
return count;
}
send it a mob VNUM and a real room number, i.e. ch->in_room, etc etc
and it returns count
for zone just call that room one for every room in a zone and accum the
return values
int num_mob_zone(int mvnum, int zone)
{
int count = 0;
int i;
for (i=0; i <= top_of_world; i++)
if((real_room(i) > 0) && world[i].zone == zone && world[i].people)
count += num_mob_room(mvnum, i);
return count;
}
thats only one way to do this, you could just scan character_list
and check the room / zone yer mob is in,
and im sure there are others
hope this gives you some idears
jtrhone
aka
vall
RoA
This archive was generated by hypermail 2b30 : 12/18/00 PST