Re: Loop Problem

From: ;P (siv@CYBERENET.NET)
Date: 03/07/98


>  extern sh_int find_target_room(struct char_data * ch, char
> *rawroomstr);

erm..you really don't need to use this since you already know the virtual
number of the room that you want to load the mob into..

as daniel pointed out, you continually move the same mob to the
room..however, it won't load up multiples of the same mob like he
suggested, it'll just move it to the room a bunch of times..regardless,
it's not what you wanted to do..here's how i'd write the function..

void begin_invasion(int mob_vnum, int invade_city)
{
  int real_rm, i, invasion_size = number(25, 50);
  struct char_data *mob;

  switch (invade_city) {
    case '1':
      real_rm = real_room(2001);
      break;
    defalut:
      real_rm = real_rm(1000);
  }

  for (i = 0; i < invasion_size; i++) {
    mob = read_mobile(mob_vnum, VIRTUAL);
    char_to_room(mob, real_rm);
  }
}

then just pass the mob vnum that you want to have invade, and the
code for the city..it might be even easier if you pass the real room
number of the city..in fact there probably isn't even a need for a
separate function for this since its just a three line for loop..shrug..

siv


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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