Here's yer step by step instructions on building a shop.
- Use medit to create the shopkeep mob.
- Set the shopkeep flag.
- Set the stationary flag unless you want it to run around.
- Set some money on it. The command is: money type amount, where type is currently either dwarven or elven and amount is in terms of copper. So 100000 is 10 gold. Think of the digits as GGSSCC. For example, if you set money dwarven 123456 you'll have a shopkeep with 12 gold, 34 silver, and 56 copper, all of dwarven minting.
- Set the modifiers for the types of money. The command is: mod type percentage, where type is as above and percentage is how much the shopkeep will discount that type of money. For example, if you set mod elven 90 and sell something worth 100 copper, you'll get 90 copper for it. If you buy that item back, you'll pay 110 copper.
- Find or build a room to reset it in. The first reset in the room should be the shopkeep.
- Build objects to put in the shop, if desired.
- Add resets for the objects to the room where the shopkeep resets, after the shopkeep reset. The command is: reset add objectshop object_vnum quantity_to_stock shopkeep_vnum. You can shorten the "objectshop" keyword to "oshop".
For example, if you want a shopkeep that is vnum 2 to sell 10 of an object called dummy object, the reset is: reset add oshop 1 10 2, where 1 is dummy object's vnum, 10 is the quantity, and 2 is the shopkeep's vnum. When you reset the room and type list, you'll see 10 of dummy object in the shop inventory.
That's it for what you must do.
Note that the shop objects don't load into the room. In fact, they don't load at all when the reset happens. When somebody buys the object, the object loads from the data.
Pointer: Remember to reset the room before you check that your objects got listed.
Discussion of possibilities:
If the mob runs out of the room and the area resets, the room will load a new shopkeep with an inventory as per the resets, and the other shopkeep will still exists with the modified inventory. However, we're working on making it so that when the area resets, all the shopkeeps associated with the room will reset their base inventory. I would like it to also be such that I could have various things happen, depending on how I enter resets in the room. If the shopkeep is one per room, one total in the world (ie unique) then the code should see if there is one, no matter where it is, and only update that one. If I want to make it wander, it shouldn't matter. If I make it wander and make it one per room, 3 in the world, I could have a max of 3 wandering merchants, all selling stuff, all updating at the right time. And I wouldn't mind if shop inventories lasted across resets, with some items dropping off, but not all items.