Re: Level Restrictions on equipment (The Easy Way)

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


On Sat, 22 Jun 1996, Linebacker wrote:

> Can someone post a simple guideline I can use to add level restrictions
> to equipment. Maybe tell me the files involved and etc..

For the record, I am personally against level restrictions on gear, unless
the item is so magical it has become sentient.  Its your mud though, so 
here's a quick and easy way to do it, without adding any wasteful extra
fields (does a bread really need to be restricted?), or changing much of 
anything.  It uses the APPLY_LEVEL slot, since thats unused, not likely to
ever be used on a sane mud, and has all the slots we need to accomplish
this task.  Basically, just set that apply on any object you want restricted,
with the modifier as the minimum level of someone who can use it.

Go into handler.c in the function, equip_char()

Below where it checks for anti- good/evil/neutral and returns if you dont
measure up, simply add another check...

for (j=0; j < MAX_OBJ_AFFECT; j++)
  if (obj->affected[j].location == APPLY_LEVEL &&
      obj->affected[j].modifier > GET_LEVEL(ch)) {
    act("$p zaps you and you drop it.", FALSE, ch, obj, 0, TO_CHAR);
    act("$p zaps $n and $e drops it.", FALSE, ch, obj, 0, TO_ROOM);
    obj_to_char(obj, ch);
    return;
  }


Change the messages to suit your needs... and for a little more fun, you
could add some damage to the zap... GET_HIT(ch) -= number(0, 10);


Hope this helps...


	-Sky



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