NX Dumpster Diving
Loot & Items
How the weighted loot table works and how to add your own items.
How loot works
When a player finishes searching a dumpster:
- There's an
emptyChance(default 30%) that they find nothing. - Otherwise the loot table is rolled between
rolls.minandrolls.maxtimes (default 1 or 2). - Each roll picks one item based on its
chanceweight and gives a random amount between itsminandmax.
The loot table
Config.Loot = {
-- Junk
{ item = 'crushed_can', chance = 30, min = 1, max = 4 },
{ item = 'empty_chips', chance = 25, min = 1, max = 3 },
{ item = 'trash_bag', chance = 20, min = 1, max = 2 },
{ item = 'moldy_bread', chance = 18, min = 1, max = 2 },
{ item = 'rotten_burger', chance = 15, min = 1, max = 1 },
{ item = 'dirty_panties', chance = 8, min = 1, max = 1 },
-- Valuables
{ item = 'stud_earring', chance = 6, min = 1, max = 2 },
{ item = 'gold_hoops', chance = 4, min = 1, max = 1 },
{ item = 'ak_pendant', chance = 3, min = 1, max = 1 },
{ item = 'gold_watch', chance = 3, min = 1, max = 1 },
{ item = 'hex_watch', chance = 2, min = 1, max = 1 },
{ item = 'gold_ingot', chance = 1, min = 1, max = 1 },
{ item = 'gold_bar', chance = 1, min = 1, max = 1 },
{ item = 'diamond', chance = 1, min = 1, max = 1 },
}itemstringchancenumber30 is 30 times more likely than one with 1.min / maxnumberUnderstanding weights
An item's chance per roll is its weight divided by the total of all weights. With the defaults the weights add up to 137, so a diamond (weight 1) has a 1 in 137 chance per roll, and a crushed can (weight 30) has a 30 in 137 chance.
| Item | Weight | Per roll | Per search |
|---|---|---|---|
| Crushed Can (crushed_can) | 30 | 21.9% | 1 in 5 |
| Empty Chip Bag (empty_chips) | 25 | 18.2% | 1 in 6 |
| Bag of Trash (trash_bag) | 20 | 14.6% | 1 in 7 |
| Moldy Bread (moldy_bread) | 18 | 13.1% | 1 in 8 |
| Rotten Burger (rotten_burger) | 15 | 10.9% | 1 in 9 |
| Dirty Panties (dirty_panties) | 8 | 5.8% | 1 in 17 |
| Stud Earring (stud_earring) | 6 | 4.4% | 1 in 22 |
| Gold Hoop Earrings (gold_hoops) | 4 | 2.9% | 1 in 33 |
| AK Pendant (ak_pendant) | 3 | 2.2% | 1 in 44 |
| Gold Watch (gold_watch) | 3 | 2.2% | 1 in 44 |
| Hex Watch (hex_watch) | 2 | 1.5% | 1 in 66 |
| Gold Ingot (gold_ingot) | 1 | 0.7% | 1 in 131 |
| Gold Bar (gold_bar) | 1 | 0.7% | 1 in 131 |
| Diamond (diamond) | 1 | 0.7% | 1 in 131 |
"Per search" takes the empty chance and the 1–2 rolls into account. With the defaults, about 15% of searches find at least one valuable.
Balancing tips
- To make one item rarer, lower its weight. The others become slightly more common.
- To make everything rarer, raise
emptyChanceor lowerrolls.max. - Check the pawn prices afterwards so rare items are worth the effort.
Adding your own items
Create the item in ox_inventory
ox_inventory/data/items.lua['old_phone'] = { label = 'Old Phone', weight = 200, stack = true, close = true, description = 'A cracked phone. Might still be worth something.', },Add an image called
old_phone.pngtoox_inventory/web/images/.Add it to the loot table
config.lua{ item = 'old_phone', chance = 5, min = 1, max = 1 },Give it a price (optional)
If the junk buyer should take it, add it to the prices:
config.luaConfig.Pawn = { prices = { -- ... old_phone = 120, }, }Restart the server
Restart so ox_inventory picks up the new item.
You can put any item in the loot table, including items from other scripts. They don't need to be sellable at the junk buyer.