----------------------------------------------------------------- SMAUG Set Item Levels 1.0 By Xerves (Released August 22, 1999) Xerves is the admin/owner of Rafermand (mud.rafermand.net port 3002) Website: http://www.rafermand.net Contact: xerves@rafermand.net ----------------------------------------------------------------- Many of us want to set the item levels on our objects so that they will pop at something more desirable (specially for objects that are in shops.) This code will allow you to add support for this while not chaning any of the other objects. Useful, easy, and shouldn't offer to many problems unless you have done a hefty modify on your code (it uses the v5 slot to do its magic). So if you are using your v5 for most of your itemtypes, you might have a problem with this (you could always use another open one if possible). Well, without due, here is the code. ----------------------------------------------------------------- Files Needed: Reset.c ----------------------------------------------------------------- 1. Reset.c Find int generate_itemlevel( AREA_DATA *pArea, OBJ_INDEX_DATA *pObjIndex ) In that function, you need to find these two cases case ITEM_ARMOR: case ITEM_WEAPON: You can either comment these out, or delete them. Once done replace with this. case ITEM_ARMOR: if ( pObjIndex->value[5] > 0 ) olevel = UMIN(pObjIndex->value[5], MAX_LEVEL); else olevel = number_range( min+4, max+1 ); break; case ITEM_WEAPON: if ( pObjIndex->value[5] > 0 ) olevel = UMIN(pObjIndex->value[5], MAX_LEVEL); else olevel = number_range( min+4, max+1 ); break; In reset_area Find if ( mob->pIndexData->pShop ) { int olevel = generate_itemlevel( pArea, pObjIndex ); obj = create_object(pObjIndex, olevel); xSET_BIT(obj->extra_flags, ITEM_INVENTORY); } else obj = create_object(pObjIndex, number_fuzzy(level)); Under it Add if (obj->item_type == ITEM_ARMOR || obj->item_type == ITEM_WEAPON) { if ( obj->value[5] > 0 ) obj->level = URANGE(0, obj->value[5], LEVEL_AVATAR); } -------------------------------------------------------------------------- That is all that is needed. This code only supports levels for weapons and armor. If you need to change this, just look through the code and see how it was done, it is pretty simple to change the others so they don't set based on the soft level. That is all there is to it, next time a builder sets the v5 on a weapon or armor type, it will set to that level next reboot. If you want to make the level go up and down a bit, just need to attach a number_fuzzy function on it. BTW, if you like to have your mob set at the same level every time, just need to do this..... --------------------------- In Db.c Find the function CHAR_DATA *create_mobile( MOB_INDEX_DATA *pMobIndex ) Just below it is this line mob->level = number_fuzzy( pMobIndex->level ); Change it to mob->level = pMobIndex->level; --------------------------- That will do it, hope this helps some. As always, any questions just contact me, the info is at the top of the file.