Building: Shops
Set the 'Store' flag on the shop room.
Set the 'shop.mob' property to the id of the shop keeper mobile.
Set 'shop.count' property to the number of different items it stocks.
Crate an array of all the items you want the shop to sell: from 'shop.0' up to 'shop.<number of items - 1>', Setting each one to the id of an item to sell. For simulator programs, set it to the ID of the top-most program object, e.g. 'holo_mob1', and the shop keeper will magically give out correctly made crystals for it).
Set the 'shop.%i.istock' property to how many of each item to have in stock at a reset or a 'restock' (defaults to infinite).
Set the 'shop.%i.atonce' property to how many of each item you can buy at once (defaults to 10).
Set 'shop.adtext' to be single-line advert for the shop, if you like. This is used by some objects, such as level2_poster_4 which displays a random one.
Probably add template_list_1 as a cloned-object to the shop room ('addauto template_list_1').
Making a shop buy things from players
Set the 'shop.type' property on the shop room to any value from the table below:
shop.type | Things the shop will buy |
food/drink | nothing |
nothing | nothing |
anything | anything (including food/drink) |
junk | anything (apart from food/drink) |
weapon | items with "damage" >= 1 |
medical | item with "heal" >= 1 |
jewelry | item with wornon finger,lapel,neck,wrist and no "heal" |
clothing | item with wornon but not jewelry and not heal |
vehicle | item with the Mount flag |
crystal | item with the IsHoloCrystal flag |
Note - Do not make a shop that is available to mortals that will buy back food or drink.
By default, shops will not buy objects with the Contraband flag. To let them do this, set the Contraband flag on the shop keeper.
Set 'shop.ripoff' to alter the standard prices for this shop by a percentage. If it is 100 then everything will have the usual price, setting it to 150 will make everything 50% more expensive than etc. It defaults to 100.
Set 'shop.offer' to alter the price paid when buying objects from players. It is a percentage like shop.ripoff. It defaults to 90% of recommended retail price. It should be lowered if shop.ripoff is reduced below 90% or so to stop people selling things back to the shop for more than they paid...
Both shop.offer and shop.ripoff can be set on zone objects, and can be inherited via 'fwd' attributes, so you can control expensiveness and generosity of a whole region from the zone object.
Any shopkeepers employed by the MoD (such as level2_tim_1, level2_dave_1, newsoton_amanda_1) should have their treatas set to template_modshopkeeper_1. This ensures they will only sell restricted rank or MoD only items to suitable players.
Dynamic shop contents
If you set a lua.stock_list
trap on a shop, and make that trap return a list of objects, those items will appear in the output of the list command and be purchaseable. You can set the !atonce
property to limit the number of those items you can buy at once, and !stock
to show a stock leve in the list output.
You can create objects using make.create_temporary
if you want to have entirely dynamic items on sale. Don't use make.clone
, because you'll end up with loads of clones hanging around until the next reset. Dynamically created objects like this can't currently be saved (see Bug #4419), but you can set !virtrade
on them and use them for various magic purposes (like selling object repairs or recharges or refills) or ensure that they're items which either never get saved, or are destroyed upon purchase, such as a flag.Cash
item.