On Mon, 6 May 1996, Jim 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?
Yes, I've done it, and its a peice of cake, and No it does NOT require a
player file wipe. It might require a player obj-file deletion, but since
I reboot my mud so ofter for coding I didnt notice :)
Basically what you want to do is add a variable (or two) of integer type
somewhere to every piece of armor. This variable will define upon what
level the character can wear or wield the equipment (or otherwise) so
checks against this variable should go in perform_wear (which covers
wielding, too). You will probably also want a standard, or default value
for the variable so that you dont have to edit every single object in the
game.
The way I did this was as follows:
I added a new spec to an object, called an R spec. This R spec had two
fields, a level restriction and a rent restriction. In db.c when the
object is loaded from the rent files, the variables where R spec values
would be held are initialised to zero so if there is no R spec existing
the object has level and rent restrictions of 0. That way you dont have
to fiddle every object :)
R
(level restriction) (rent restriction)
Level restiction is the level you can wear, wield, get, drop or give it.
Rent restriction is the level you need to rent it.
All you have to do is hack the spec that reads in the A fields, copy and
change it to R, and make it store them in new integer variables. I put
these integer variables in obj.obj_flags as level_restrict (int) and
rent_restrict. This means recompiling structs.h and hence the entire
mud, but if you're not afraid to do that... *grin*. Once you've stored
the variables, all you need is to put a check against them in
perform_wear (act.obj.c) and the player's level, and you're away. Also
put a check for getting in do_get (act.obj.c), dropping (act.obj.c),
giving (act.obj.c). Also put the renting check in Crash_is_unrentable
(objsave.c).
It might also be a good idea to whack a check in do_use (act.obj.c) so
you can put restrictions on scrolls and such. That way a potion which is
restricted (by level or rent ? you decide) to level 5 and above, a level
4 trying to quaf it might see the message.. 'but you cant figure out how !!',
which is a bit of a laugh. Besides then you can put highpower scrolls on
mobs and know some newbie isnt going to flog a few off a high level for
some fast exp. :)
(ps. i'm not answering the second question :)
>
> Jim
>
Christopher Voutsis
Email: s337239@student.uq.edu.au
Check out ArtemisMUD at artemis.earth.monash.edu.au 8000.
It's getting better every day. :)