RollLoot
Rolls one of the game’s loot presets into a list of stacks.
The presets are the game’s own (inventory_defaultJunk_default, inventory_smallChest_rare, the shops’ …), read from
your copy of the game by the tables export; the roll is the one a chest gets. Nothing for a preset the tables do not
have (HasLootPreset). The list has the shape SetContainerItems takes and GivePlayerItem understands stack by stack.
Syntax
Section titled “Syntax”RollLoot(preset)| Parameter | Type | |
|---|---|---|
preset |
string | the preset’s name |
Returns
Section titled “Returns”table - a list of {class=, amount=, health=}; {} for an unknown preset
Example
Section titled “Example”-- a reward chest with a rich roll on top of its own contentslocal items = GetContainerItems(REWARD) or {}for _, stack in ipairs(RollLoot("inventory_smallChest_rare")) do items[#items + 1] = stack endSetContainerItems(REWARD, items)See also
Section titled “See also”HasLootPreset · SetContainerPreset · SetContainerItems · the Doors and containers group of the index
