Skip to content

Adding items & traders

Items live in bs_inventory/config/config_items.lua, in Items.Definitions. On start they are synced into bs_item_definitions, so you only edit the file.

my_tin = { label = 'Tinned Peaches', category = 'food', weight = 0.4, w = 1, h = 1, stack = 5,
usable = true, value = 14, data = { hunger = 25, thirst = 5 } },
  • w / h is the grid size, stack the max per slot, value the catalogue value traders are balanced around.
  • data depends on the category: heal, hunger, thirst for consumables, weapon = 'WEAPON_X' for weapons, handled = true when another resource consumes it.
  • Icons come from bs_ui/html/js/icons.js. No icon means a generic one, it still works.
  • Want it translated? The label can get a key in bs_inventory/locales/<lang>.lua, see Languages.

Restart bs_inventory when it’s quiet (people’s inventories reload). More detail on the Inventory page and for code in Items & inventory.

To test it, give it to yourself from F10 > ITEMS, or from code:

exports.bs_inventory:GiveItem(src, 'my_tin', 3)

Recipes sit in the same file. A recipe with factionBase = true only crafts inside your faction’s flag radius.

Traders are in bs_traders/config/config_traders.lua, Traders.Traders. Each one is placed relative to a safe zone:

trader_sandy = {
label = 'Camp Trader', role = 'trader', clothing = true,
zone = 'sandy_camp', offset = vector3(-6.0, 4.0, 0.0), heading = 30.0,
model = 'a_m_m_farmer_01', scenario = 'WORLD_HUMAN_STAND_IMPATIENT',
buys = { { item = 'scrap_metal', price = 3 } },
sells = { { item = 'my_tin', price = 20, stock = 30 } },
},
  • buys is what the trader pays players, sells what players can buy, stock limits it.
  • The shipped file keeps sells at about 1.4 to 1.5x the item value and buys under it. Stick to that or the economy breaks fast.
  • role = 'quest' with missions = { ... } makes a job giver, missions are in Traders.Missions.
  • Global.traderPriceMultiplier in F1 scales all buy prices.

Restart bs_traders to apply. If you changed a safe zone the map page on the website is drawn by hand from these files, so it won’t follow on its own.