On Mon, 6 May 1996, Hades wrote: > > > > I would like to add level limits to items, as I get very tired of watching > > newbies run around with my suposed 'high-level' weapons and armor. My > > question is: has anyone done this and does it require a pfile wipe or > > plrobj file deletion? Disregarding the arguments about this and answering your question, we do this in a simpler way than the first solution posted. In our method you don't have to add another variable to the entire object structure, rather just add a few flags. In structs.h and constants.c, define your new ITEM flags. We call them LVL10, LVL20., LVL30, etc. Then in handler.c you will find a piece of code called invalid_class. This is the function that checks to see if a character can't use an item because it is not usable by his/her class. At the end of these checks, just add your new checks for the equipment like below. Granted it uses up some flags, but in exchange, adding a limit is as simple as adding another bit to the item in the object file. int invalid_class(struct char_data *ch, struct obj_data *obj) { if ((IS_OBJ_STAT(obj, ITEM_ANTI_MAGIC_USER) && IS_MAGIC_USER(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_CLERIC) && IS_CLERIC(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_WARRIOR) && IS_WARRIOR(ch)) || (IS_OBJ_STAT(obj, ITEM_ANTI_THIEF) && IS_THIEF(ch)) || (IS_OBJ_STAT(obj, ITEM_LVL10) && (GET_LEVEL(ch) <= 9)) || (IS_OBJ_STAT(obj, ITEM_LVL20) && (GET_LEVEL(ch) <= 19)) || (IS_OBJ_STAT(obj, ITEM_LVL30) && (GET_LEVEL(ch) <= 29)) || (IS_OBJ_STAT(obj, ITEM_LVL40) && (GET_LEVEL(ch) <= 39)) || (IS_OBJ_STAT(obj, ITEM_LVL50) && (GET_LEVEL(ch) <= 49))) return 1; /* else*/ return 0; } We have 60 mortal levels, so the 5 flags are enough for us. Also, we have another way to add more flags if we run out. We do it for PRF_FLAGS by adding a new set called PRF2_FLAGS. Works out nicely since we added new communication channels and you can now be !MUSIC, !IMMNET, etc. I know lots of people were looking for ways to add more flags and this is a simple way. It didn't even require a p-file wipe. When you sdsstat a player, they now have another field under "PRF" that says "PRF2: None" or whatever. I will dig around for all the pieces of code today and post it later if you guysd want it. Hope that helps, -Brian
This archive was generated by hypermail 2b30 : 12/18/00 PST