Configuration

Gift box keys and reward fields for GiftBox.

ItemFile
starter_box / gang_kitgiftbox.png

Icon: Item images.

Config files

configs/config.lua is loaded as a server script only. Loot tables stay off the client. Every key under Config.GiftBoxes is registered with bridge.framework.registerItemUse at start. Add a matching inventory item for each key. Reward item names (water, phone, sandwich, …) must already exist in your inventory.

always = true always grants that entry. Entries with weight (any number > 0) are pooled into ox_lib's lib.selector and one extra is rolled per open. Weights are relative: 50 is two and a half times as likely as 20. Same idea as LootTables. If an entry has neither always nor weight, it is skipped.

Config.GiftBoxes = {
    ['starter_box'] = {
        items = {
            { item = 'water', count = 2, metadata = { description = 'Everyone who ever drank this has died.' }, always = true },
            { item = 'phone', count = 1, always = true },
            { item = 'sandwich', count = 1, weight = 20 },
            { item = 'bandage', count = 3, weight = 50 },
        },
        account = { accountType = 'bank', amount = 500, always = true },
    },
    ['gang_kit'] = {
        items = {
            { item = 'weapon_pistol', count = 1, metadata = { serie = 'Scratched', serial = 'Scratched' }, always = true },
        },
    },
}
FieldDefaultPurpose
items[].item—Inventory item to grant
items[].count—Amount
items[].metadataoptionalPassed to bridge.inventory.addItem
items[].alwaysoptionaltrue always grants
items[].weightoptionalRelative selector weight (> 0)
account.accountType'bank'cash, bank, or money
account.amount—Money granted (must be >= 1)
account.alwaysoptionaltrue always grants money
account.weightoptionalPuts the money reward in the same weighted pool as items

Shipped keys: starter_box, gang_kit. Add your own keys and matching items.

On this page