Re: [CODE] guilds

From: ;P (siv@CYBERENET.NET)
Date: 11/22/97


> Ok, I'm trying to make a check to see if a player is in a guild. This is the
> best thing I can think of for defining rooms for guilds.  Ok, first off,
> make a roomflag for IS_GUILD.  Then, when a character tries to do anything
> guild related (ie level, practice, etc) it first checks for the room flag,
> if its there it continues, if not, it gives error message.  Now here's where
> I am kinda confused.  I want the code to check that the room is assigned to
> their certain class and that the guildmaster is in the room.  I'm having
> tons o trouble with this and any help would be greatly appreciated.

well..stock behavior is to have anyone of any class be able to practice
while in the same room as any guildmaster...if you want to set up
specific rooms for specific classes, you'll have to make some kind of
list that will specify which classes can use which rooms..i would do:

struct guild_info {
  sh_int guild_room;  // vnum of the room
  sh_int class;       // class
  void whatever_other_stuff_you_need;
};

then make an array of these..

struct guild_info guilds[] = {
  { 3021, CLASS_CLERIC, "poo" },
  { 5470, CLASS_WARRIOR, "foo" }
  { -1, -1, "\r\n" }
};

then in the guildmaster special, just do a check:

  for (i = 0; guilds[i].class != -1; i++) {
    if ((GET_CLASS(ch) == guilds[i].class) && // right class?
       (world[ch->in_room].number == guilds[i].guild_room)) // right room?
      found = TRUE;

  if (!found) {
    send_to_char("you can't do that here.\r\n", ch);
    return;
  }

  do_guild_related_stuff_here..

i just wrote this off of the top of my head, without doing any checks,
but i think that should do what you're asking for..

another way to do it would be to make it so that only people of that
specific class can get into their guild..like we did with the magical
guildhall of midgaard, and the teleporting wizard :)

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/08/00 PST