CODE FAQ: Restricting Movement (was Re: Level Resticted Room)

From: Billy H. Chan (bhchan@po.EECS.Berkeley.EDU)
Date: 07/08/96


On Mon, 8 Jul 1996, Linebacker wrote:
        
> I am wanting to prevent characters over a certain level from entering
> certain rooms and characters under a certain level from entering other
> rooms. I have seen muds with mud schools that allowed only levels 0 - 5
> into the school.
>  
> Has anyone done anything like this? What is the best method for doing this?
> 

Q: I need to prevent people from entering rooms, how should I go about doing
   this?

A: Let's take a peak in LL1.5.1's act.movement.c...

   in do_simple_move, after checking for /* charmed? */ is the best place
   to put checks in.  Here's an example:

  /* Check for UpperGodsRoom */
  if ((ROOM_FLAGGED(ch->in_room, ROOM_UPPERGODROOM) ||
      ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_UPPERGODROOM)) &&
      GET_LEVEL(ch) < LVL_GRGOD) {
        send_to_char("A strange force prevents you from going there.\r\n", ch);
        return 0;
  }
  /* Check for GodRoom */
  if ((ROOM_FLAGGED(ch->in_room, ROOM_GODROOM) ||
      ROOM_FLAGGED(EXIT(ch, dir)->to_room, ROOM_GODROOM)) &&
      GET_LEVEL(ch) < LVL_AMBASSADOR) {
        send_to_char("A strange force prevents you from going there.\r\n", ch);
        return 0;
  }

  So, define your ROOM flags and figure out the levels and you're done.
-- Billy  H. Chan     bhchan@po.eecs.berkeley.edu  bhchan@csua.berkeley.edu
   CogSci/CompSci     http://www.csua.berkeley.edu/~bhchan     ResumeInside



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