Shared

Shared exports

Random Loot

Generates random loot from a weighted list of items.

  • Prevents duplicates per roll

  • Weighted probabilities determine selection

  • Quantity is random within the specified range

Orchid.randomLoot(items, itemCount)
  • items – array of loot entries, each:

{ 
    itemName,     -- string: name of the item
    {min, max},   -- quantity range
    weight?       -- number: chance weight (default 70), 100 = guaranteed
}
  • itemCount – number: maximum items to generate

Returns: Array of { itemName, count }

Example Usage
local lootTable = {
    {"apple", {1, 5}, 80},
    {"banana", {1, 3}},
    {"diamond", {1, 1}, 100}
}

local items = exports['orchid-bridge']:randomLoot(lootTable, 3)
-- Output: { {"diamond", 1}, {"apple", 3} }

Last updated