Skip to content

CreateShop

Makes a shop - a title, whether it buys, its purse.

Empty until SetShopItem fills it. sellFactor is the fraction of an item’s catalogue price the shop pays when a player sells (0.5 = half its worth; 0, the default, = it buys nothing and the screen has no Sell tab). money is the purse in Groschen it pays out of (nil or a negative number = bottomless); what the players buy fills it. Put it on an actor with SetActorShop or open it with OpenShop.

CreateShop(title [, sellFactor, money])
Parameter Type
title string the screen’s title
sellFactor number 0 .. 1 (0: buys nothing) (optional)
money number the purse in Groschen; nil = bottomless (optional)

number - the shop’s id; nil when it could not be made

local store = CreateShop("General store", 0.5, 500)
SetShopItem(store, "torch_weapon", 5) -- unlimited torches at 5 Groschen
SetShopItem(store, "arrow_normal", 0.5, 200) -- two hundred arrows at half a Groschen
SetShopItem(store, "shortswordBroad", 90, 3)

SetShopItem · SetActorShop · OpenShop · DestroyShop · the Shops and vendors group of the index