Skip to content

CreateVendor

Makes a vendor - an NPC actor nobody can hurt, selling a shop.

One call for CreateActor (the same soul, place, name, clothing and world; no weapons - a vendor stands unarmed), SetActorInvulnerable and SetActorShop. The use key on it opens the shop on the game’s own trade screen (SetShopScreen keeps the panel). Move it, pose it and destroy it like any actor (MoveActor, SetActorAnim, DestroyEntity); SetActorShop changes what it sells.

CreateVendor(shop, soul, x, y, z, yaw [, name, clothing, world])
Parameter Type
shop number the shop it sells
soul string | number | nil a soul’s name, id or GUID; nil = the server’s pool
x number metres
y number metres
z number metres (below 0 = on the ground)
yaw number degrees (0 without)
name string the label over its head; nil = none (optional)
clothing string a clothing preset GUID; nil = the server default (optional)
world number the virtual world; nil = the shared one (optional)

number - the vendor’s entity id; nil when the shop does not exist or the actor could not be made

local smithy = CreateShop("Smithy", 0.4, 800)
SetShopItem(smithy, "shortswordBroad", 90, 3)
SetShopBuyCategories(smithy, {"MeleeWeapon", "Armor"}) -- buys blades and armour alone
local smith = CreateVendor(smithy, nil, 1290.5, 1101.2, -1, 90, "Smith")
SetActorAnim(smith, "smith") -- at the anvil between customers

CreateShop · SetActorShop · CreateActor · SetShopScreen · OnPlayerShopDeal · the Shops and vendors group of the index