abshop.htm
abshop.htm · 12.5 KB
From the archive ab.zip
Download the archive « Back to the archive contents
<html>
<head>
<title>Dizzy Mud Area Coding Guide - #SHOPS Section</title>
</head>
<body BGCOLOR="#FFFFFF">
<h3 ALIGN="center">#SHOPS Section</h3>
<small>
This page describes how to code shops within an area file.
</small>
<!-- BEGIN Navigator -->
<HR NOSHADE>
<table WIDTH="100%">
<tr>
<td ALIGN="left">
<small>
<< Back to
<a HREF="abreset.htm">
#RESETS Section
</a>
</small>
</td>
<td ALIGN="right">
<small>Forward to <a HREF="abspec.htm">#SPECIALS Section</a> >></small>
</td>
</tr>
</table>
<HR NOSHADE>
<!-- END Navigator -->
The <b>#SHOPS</b> section of an area file specifies which mobs are shopkeepers,
what they sell, and other information.
<p>
The <b>#SHOPS</b> section consists of the <b>#SHOPS</b> header, one or more
shop definition lines and the #SHOPS ender line 0 (zero) as shown here:
<table BORDER=2 WIDTH="100%" CELLPADDING=20>
<tr>
<td>
#SHOPS<br>
<a HREF="#shopline">shop definition line</a><br>
0<br>
</td>
</tr>
</table>
<p>
The function and structure of the shop definition lines will be explained
below. It's very simple! But first, some things of note about shops:
<ul>
<li>
Pet shops are not controlled by the <b>#SHOPS</b> section. Look at
the description of PET_SHOP in the <a HREF="abrflag.htm">Room Flag Table</a>
for details.
</li>
<li>
With the exception of the pet shops mentioned above, shops in Dizzy MUD
are not associated with particular rooms, but with particular mobs.
The <b>#SHOPS</b> section declares a mob to be a shopkeeper, and from
then on, wherever that mob is located there is a shop.
</li>
</ul>
<hr NOSHADE>
<h4>How to Set Up Shop</h4>
As in real life, opening a shop is not a trivial task and involves
substantial preparation. Only the final part of setting up a shopkeeper
for business is done in the <b>#SHOPS</b> section. Most of the detail
work takes place in preceding sections, as follows:
<dl>
<dt><b>#MOBILES</b></dt>
<dd>
You can't start a shop without a shopkeeper. A shopkeeper starts out
as an ordinary mobile that must be coded in the #MOBILES section.
Here are some important points to note:
<ul>
<li>
Because the shop's location (and the player's ability to LIST, BUY
and SELL) could potentially move around with the shopkeeper, you are
usually well advised to code the shopkeeper as ACT_SENTINEL to keep
him from moving around. In some rare cases, you may decide to create
a wandering merchant instead, but be aware of the problems that
will arise if two shopkeeper happen to end up in the same room:
</li>
<li>
A player can LIST, BUY and SELL in a room where there is a shopkeeper.
If there is more than one shopkeeper in the room, the player's commands
will interact only with the last shopkeeper to enter the room, thus
effectively shutting down shopkeepers previously located there.
This is generally not what you want, so don't code a lot of shopkeepers,
don't let them run around if you do, and never plan on more than one
shopkeeper in a room. If you want to code an oriental basaar, you
will need to spread it out over several stalls.
</li>
<li>
A shop stays in business only as long as its shopkeeper is alive.
Many players would kill a shopkeeper for his money or merchandise.
To curb such violence, you must make the shopkeeper impossible to
attack. The mechanism for this is encoding the shopkeeper mob with
immunity flags to SUMMON, CHARM, WEAPON and MAGIC. To prevent accidents
with zealous Imms, add NOPURGE. To keep them from wandering against
their will, add NOPUSH.
</li>
</ul>
</dd>
<p>
<dt><b>#OBJECTS</b></dt>
<dd>
Like all other objects, objects which you want in the shop's stock must
be coded. You code them the same as any other objects, except possibly
with a little more attention to their price.
</dd>
<p>
<dt><b>#ROOMS</b></dt>
<dd>
<ul>
<li>
You generally want the shopkeeper to have a <b>room</b> to ply his trade in.
</li>
<li>
If you want the shop to do business, you should give the room a name
that has the word 'shop' in it or some similar obvious clue as to
its function.
</li>
<li>
For those who do LOOK, yet don't know how to do business with a shop,
such rooms usually have signs or something similar in their extra descriptions
to alert potential buyers to the presence of the shop.
</li>
<li>
If you want to provide maximum security for your shop, you may want to add
SAFE and/or LAW to the shop room's flags.
</li>
</ul>
</dd>
<p>
<dt><b>#RESETS</b></dt>
<dd>
Two shop-relevant functions are accomplished in the <b>#RESETS</b>
section:
<ul>
<li>
<b>Resetting the shopkeeper mob into his shop room</b><br>
The <b>#SHOPS</b> section designates as shopkeeper not an individual
mob but one individual mob vnumber. If you reset more than one mob
with the same vnumber and make that mob a shopkeeper, they will all
be. This is probably not what you want, so make shopkeeper mobs
unique by resetting them only once. Build only one <b>M</b> line
for the mob, and set the global and local limits to <b>1</b>.
</li>
<p>
<li>
<b>Resetting all of the shop's stock items into the shopkeeper's inventory</b><br>
You must code one <b>G</b> (GIVE) line for each different item you want the
shopkeeper to sell. Give him each item only once; if it is sold, it will
be replenished in unlimited quantities.
</li>
</ul>
</dd>
</dl>
<p>
<hr NOSHADE>
Once our homework is done in all the preceding sections, we can finally put our
shopkeepers into operation. This requires one line in the <b>#SHOPS</b> section
as follows:
<p>
<table BORDER=1>
<a NAME="shopline"><caption><b>Shop Item Line</b></caption></a>
<tr>
<td><a HREF="#mobvnum">Mob<br>vnum</a></td>
<td><a HREF="#itemtype">Item<br>type<br>1</a></td>
<td>Item<br>type<br>2</td>
<td>Item<br>type<br>3</td>
<td>Item<br>type<br>4</td>
<td>Item<br>type<br>5</td>
<td><a HREF="#salemarkup">Sale<br>markup</a></td>
<td><a HREF="#buybackrate">Buy<br>back<br>rate</a></td>
<td><a HREF="#firstopenhour">First<br>open<br>hour</a></td>
<td><a HREF="#firstopenhour">Last<br>open<br>hour</a></td>
<td><b>* </b>Comment: name of shopkeeper mob</td>
</tr>
</table>
<p>
Here's what the fields mean:
<p>
<dl>
<dt><b><a NAME="mobvnum">Mob vnum</a></b></dt>
<dd>The vnum of the shopkeeper mob</dd>
<p>
<dt><b><a NAME="itemtype">Item type</a></b></dt>
<dd>
The types of items the shop is authorized to buy (from players). These items
may be different from the items the shop sells, but exercise some realistic
good sense. A baker should not buy weapons, for example. For the encoding
of the valid item types, see the <a HREF="abshopit.htm">Shop Item Type Table</a>.
<p>
A shop can not buy more than 5 different types of items. This is
the limit imposed by the fixed number of 5 slots for item types in
this line.
<p>
A shop need not buy exactly 5 item types. Code as many item types
as you are willing for the shop to accept, and <b>0</b> for the
remainder out of the 5 total.
<p>
A shop need not buy <em>any</em> items. Code a <b>0</b> in all 5 item type
fields and the shop will reject anything offered.
<p>
There is a <a NAME="questshop">new shop item type</a>
in Dizzy which is not shown in the
<a HREF="abshopit.htm">Shop Item Type Table</a> because it's not really
an item type. Coding <b>999</b> in the <b>first</b> shop item type slot
for a shop indicates that the shopkeeper will sell (and buy) quest items,
i.e. items which are sold and bought only for <b>Quest Points</b>.
The (program internal) name of this flag is <code>ITEM_QUESTSHOP</code>.
The only objects eligible for this kind of trade are those having an
object flag of <code>ITEM_QUESTSELL</code>. See the
<a HREF="abobj.htm">#OBJECTS Section</a> and the
<a HREF="aboflag.htm">Object Flag Table</a> for details.<br>
A so-called Quest Shopkeeper will buy and sell <b>only for quest points</b>,
and will buy only quest items. If you code the 999 in the first field, this
makes the shopkeeper a Quest Shopkeeper; the other 4 slots will be ignored
but should be coded as <b>0</b> for clarity and future compatibility.<br>
Quest Shopkepers do not HAGGLE, i.e. they <b>sell</b> only according to the
object's <b>value</b> and <b>buy</b> for the object's value times its
condition as a percentage, with both numbers modified as normal by the
Sale Markup and Buyback Rate.
Current DizzyMUD policy prescribes a Sale Markup of 100 and a Buyback Rate
of 35.
</dd>
<p>
<dt><b><a NAME="salemarkup">Sale markup</a></b></dt>
<dd>
The percentage of the object's nominal value (as coded into the <b>value</b>
field of the object) at which the shop will sell the item.
Code <b>130</b> if you want the shop to make a 30 percent profit.
A general guideline is that the sale markup should not be less than 125
percent.
<p>
Note that the HAGGLE skill may allow some players to get better
prices than those you establish here.
<p>
Do not code a percent sign! And never code a value less than 100!
</dd>
<p>
<dt><b><a NAME="buybackrate">Buyback rate</a></b></dt>
<dd>
The percentage of the object's nominal value at which the shop will
buy such an item if a player SELLs it to the shop. A general guideline
is that the buyback value should not be more than 75 percent.
<p>
Note that the HAGGLE skill may allow some players to get better
prices than those you establish here.
<p>
Do not code a percent sign! And never code a value greater than 100!
</dd>
<p>
<dt><b><a NAME="firstopenhour">First Open hour</a></b></dt>
<dt><b>Last Open hour</b></dt>
<dd>
The first and last hour of the Theran day at which the shop is open.
The shop will open at the beginning of the <b>first open hour</b>
and close after the end of the <b>last open hour</b>. Legal values
for both fields are numbers from <b>0</b> (midnight) to <b>23</b>
(the last hour before midnight). For a shop to be open all the time,
code <b>0</b> and <b>23</b>.
</dd>
</dl>
<p>
<b>Do not forget</b> the final <b>0</b> (zero) at the end of the #SHOPS
section!
<p>
<hr NOSHADE WIDTH="75%">
If you do not have a #SPECIALS or #MOBPROGS section in your area file, your area
file is finished at this point. If so, <b>do not forget the #$</b> at the end of
your file to terminate your area file. The <b>#$</b> must come on a line by itself
and be followed by at least one or more empty lines. Leaving off this file
termination or getting it wrong cause the MUD to crash at load time without even
issuing an error message!
<hr NOSHADE WIDTH="75%">
<p>
<table BORDER=2 WIDTH="100%" CELLPADDING=20>
<tr>
<td>
<a NAME="example">SHOPS example</a><br>
(excerpted from the actual area file of midgaard)
<pre>
<b>
#SHOPS
3000 2 3 4 10 0 105 15 0 23 * the wizard
3001 0 0 0 0 0 110 100 0 23 * the baker
3002 1 8 13 15 19 150 40 0 23 * the grocer
3004 9 0 0 0 0 100 50 0 23 * the armorer
0
</b>
</pre>
</td>
</tr>
</table>
<!-- BEGIN Navigator -->
<HR NOSHADE>
<table WIDTH="100%">
<tr>
<td ALIGN="left">
<small>
<< Back to
<a HREF="abreset.htm">
#RESETS Section
</a>
</small>
</td>
<td ALIGN="right">
<small>Forward to <a HREF="abspec.htm">#SPECIALS Section<!/a > >></small>
</td>
</tr>
</table>
<HR NOSHADE>
<!-- END Navigator -->
<table WIDTH="100%">
<tr>
<td>
</td>
<td ALIGN=right>
<small>This page was last updated <font COLOR="#FF0000">February 19, 1998</font>.</small>
</td>
</tr>
</table>
</body>
</html>