[MUD-Dev] [CODE] unique items
quzah at hotmail.com
Sun Mar 19 11:07:40 New Zealand Daylight Time 2000
From: J. Coleman <stormknight at alltel.net>
Subject: [MUD-Dev] [CODE] unique items
> Didn't see this in the faq anywhere, and I can't seem to find any good
> implementations of it anywhere, so here goes:
> Does anyone know a good way to handle unique items? I want to have
> players able to make magic items themselves, that are completely custom.
> Magic items in my game will be fairly powerful because of their rarity,
> and the fact that they must be created, and not found. Is there a good
> clean way to keep an "index" file of all magic items that have been
> created this way, and to reference player files to it perhaps? How does
> everyone else do this?
I'll assume you're using a diku variant, as you haven't told us
what you are using. The rest is easy. Since you're probably using
vnums, just set the unique items to -N or something like that.
Store all unique items in a seperate file. Load the file when the
game boots. Save it when you shut down or make any changes to the
items. In the player file, just simply do something like:
Piece of cake. (This assumes you use keyword/value pairs, which
I highly recommend over your typical diku-dump of values.) The
'NumberOfItem' would represent the number in the list. Each item
in the list would be the next highest available -N number. Thus,
the first one would be vnum -1, the second as -2, and so on.
Since they are unique, you just fully construct them/store
them in your unique item file, rather than reconstruct them
from a vnum/template.
That's probably the simplest way to handle it. (Unless you
just add a bit flag for "unique" and fully save/fully load
all data from player files, but then you still have to make
an index of them all ... so my suggestion is better than
that, or so I think.)
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev