Re: Equipment Wearing Limits

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 03/13/98


> >> Has anyone played around with have equipment level limits?  Like have the
> >> equipment be a certain level so that character has to be the same level or
> >> above to use it?
>

        I think this was about the first thing I ever wrote, because it
requires almost no knowledge of the internals of a mud, and verey little
coding skills besides accessing a member of a structure and a greater-than
comparison.  I'm feeling in a pissy mood, but here's a version of the top
of my head.

> solve this was add another part to the object structure. This will KILL
> your obj files, unless you wish to write a converter. The worst part is
> probably coding OLC for it, but just follow examples...it shouldn't be too

        No, this will not kill your obj files. That would suck. We'll do
it a really simple way.

edit obj_flags_data structure in structs.h
add  "int minlevel;"

edit utils.c, anywhere add
#define GET_OBJ_MINLEVEL(obj)   ((obj)->obj_flags.minlevel)

edit act.item.c and at the very top of can_take_obj() add

  if (GET_MAXLEVEL(ch) < GET_OBJ_MINLEVEL(obj)) {
    act("$p is too mighty for you!",FALSE, 0,ch,obj,0,TO_CHAR);
    return 0;
  }

in perform_wear in ..act.item.c i think as well, just in case they manage
to pick it up somehow (like in a bag or steal or something that we're not
getting..) add

  if (GET_MAXLEVEL(ch) < GET_OBJ_MINLEVEL(obj)) {
    act("$p is too mighty for you!",FALSE, 0,ch,obj,0,TO_CHAR);
    return;  /* almost 100% sure that perform_wear is a void funct..*/
  }


then, in db.c where you're loading it from a file (load_obj?parse_obj?)
it has to be initalized, so add a line like.let me look.
        parse_object, add the following line:
  obj_proto[i].obj_flags.minlevel=0;

then further on down in the same function, where you see the for loop
which parses the E/X/C cases, within that switch statement add
    case 'L':
      get_line(obj_f, line);
      sscanf(line, "%d ", t);
      obj_proto[i].obj_flags.minlevel = t[0];
      break;

for grins, in objsave.c, within the curiously named function
Obj_from_store_to, add the line
GET_OBJ_MINLEVEL(obj)= object.minlevel;

and of course, in Obj_to_store_from (who writes this stuff?) add the
converse statement,

object.minlevel=GET_OBJ_MINLEVEL(obj).

        I'm not in a good enough mood to do the oedit addons, mostly
because its mainly just printing strings.  Same for the stat and identify
functions. Its rough, but if you search the archives you'll find about 3
fully written up versions of this min-level code.  Sorry about the bad
mood but i'm hungry and all I have access to is probably diet mr. pibb.
Paid 1300 for car repairs and now i'm broke till next payday.

                Bleh.

                                                PjD

Also in the news...

        Due to keyboard malfunction, getting a new hard-drive, camera, and
some other stuff, no work has been done on the path editor since monday.
Oh, and final fantasy 7 helped too.  Gosh its a neat game. Anyway, it
should be done by next week sometime, and I'll send it out to a few people
who requested it for testing, and hopefully a week or 2 after that I'll
release a real version.


     +------------------------------------------------------------+
     | 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