Re: [CODE] Minimum level for objects

From: Fizal (amustapa@YAHOO.COM)
Date: 09/26/98


Hmm... not really sure if anyone has already helped you with this
thing or not. Seems like several people are asking for this, but I
didn't see any reply... yet! :P Maybe because I'm still lagging
behind, with at least 2 1/2-weeks worth of Circle mails to check out.
Hehehe....

Okay, I don't have the code of hand, but here's something that I add in
into the mud that I'm to come up with....

A) Add in another variable in the obj_data structure in structs.h.
   Can put it anywhere... I actually replaced the obj_rent into it.
        sh_int  min_level;  /* Or int if that's what you prefer */

B) Add in another macro in utils.h, something like:
        #define GET_OBJ_LEV(obj)   ((obj)->obj_flags.min_level)
   Uhmm... better double check. Not really sure...

C) In db.c, read in another int/sh_int together with the obj's weight,
cost, and rent. It's in the parse_obj() somewhere...
   And put the value read, t[3], into the min_level:
        obj_proto[i].obj_flags.min_level = t[3];
   Again.. double check with rent/cost/weight.

D) In act.other.c (I think) under wear_position() (or something) check
if the obj's min_level is higher than the char. It's supposed to
return (-1) if failed. Something like:
        if (GET_OBJ_LEV(obj) > GET_LEV(ch)) {
          sprintf(buf, "You need to be at least level %d to use $p",
                  GET_OBJ_LEV(obj));
          act(buf, FALSE, ch, obj, 0, TO_CHAR);
          return (-1);
        }
   You can place this, after making sure that the char can wear the
equipment first.

E) Then, add in additional 0's or whatever levels you want to set for
each obj in the files, after the value for obj_rent. Like me, I change
the obj_rent so that it'll be 1% of it's cost, and use the value for
the obj_rent as the min_level.

F) For info, just add in the obj's min_level for identify spell in
spells.c and do_stat_obj() in act.wizard.c for easy viewing.

Hmm... think I got the whole idea here. Any comments anyone?

BTW, g'luck! :)


Afizal Mustapa
Petaling Jaya, Malaysia




==


Regards,
Afizal Mustapa
(amustapa@yahoo.com)
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


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