Want to define loot dropped from your monster/object/crop, contents of a reward bag or a chest? Well look no further!WEBSITE[ceterai.github.io] | SUPPORT ME[buymeacoffee.com]
Introduction
The guide assumes you know modding basics (how to unpack files and how to work with JSON).
Loot Table Syntax
Loot tables are defines in bulk in “.treasurepools” JSON files, usually located in the “treasure” folder:
Missions/
apexmission1.treasurepools
…
biome.treasurepools
bugs.treasurepools
…
You can add your own or you can patch an already existing file if you feel like it.
If you don’t know how to patch files, check out the last section of the guide.
The full syntax of a loot table looks something like this:
[
0, // a minimal level at which the following configuration will be active, in this case 0
{
“fill” : [ // contents that will always be present alongside a random pool
{ “item” : “rawfish” }, // “item” lets you specify an ID of and item/object to spawn (x1)
{ “item” : [“rawfish”, 2, {…}] }, // instead of a string, you can pass a list in following format: [<itemName/objectName>, <count>, <parameters>]
{ “item” : [“rawfish”, 2] }, // this also works
{ “pool” : “fishingUpgrade” } // “pool” lets you specify an ID of another loot table instead of an item or an object
],
“pool” : [ // items, objects and loot tables for the game to choose from
{ “weight” : 0.12, “item” : [“money”, 16, {…}] }, // “weight” defines how likely this is to be picked over the other entries, relatively
{ “weight” : 0.97, “item” : “apex1legs” },
{ “weight” : 1.03, “pool” : “fishingUpgrade” }
],
“poolRounds” : [ // defines how many entries to pull from the pool above
[0.7, 0], // syntax is [<weight>, <count>]
[2, 1],
[0.6, 2]
],
“allowDuplication” : true // whether the same “pool” entry can be picked multiple times, default is “false”.
}
],
[
0.5, // this will be chosen on planet danger/at level of 1 and up
{
“fill” : […],
“pool” : […]
}
],
[
3.5, // this will be chosen on planet danger/at level of 4 and up
{
“pool” : […],
“poolRounds” : [[0.7, 0],[0.3, 1]],
“allowDuplication” : true
}
]
],
Weights in “pool“/”poolRounds” don’t have to add up to a 1, but it’s convenient.
There’s a loot table called “empty“. As the name suggests, it returns no items.
This is a single loot table, which is usually a part of a dictionary of loot tables contained within a single “.treasurepools” file, like so:
“fishingUpgrade” : [
[0, {
“pool” : [
{“weight” : 1.0, “item” : “fishingreelstrong”},
{“weight” : 1.0, “item” : “fishingreellong”},
{“weight” : 1.0, “item” : “fishingreelfast”}
]
}]
],
“fishingcommon” : [
[0, {
“fill” : [{“item” : “rawfish”}],
“pool” : [{“weight” : 1.0, “pool” : “fishingUpgrade”}],
“poolRounds” : [[0.7, 0],[0.3, 1]],
“allowDuplication” : true
}]
]
}
Using Loot Tables
- Other Loot Tables
- Monster Drop
- Object Drop
- Chest Loot
- Dungeon Chest Loot
- Crop Harvest Loot
- Reward Bags
- Inside Lua Logic
- Spawn With Commands
To make your loot table part of another loot table, refer to the syntax section of this guide.
Monsters have a “dropPool” parameter to set loot tables and what weapon they drop from:
Use “empty” to specify an empty drop. Minimal setup:
If you want the object to drop other stuff instead of itself, you can either specify “breakDropOptions“/”smashDropOptions” to list possible items, or you can specify “breakDropPool“/”smashDropPool” to refence your loot table:
“smashDropPool” : <loot table ID>,
“breakDropPool” : <loot table ID>
If you want chests that randomly spawn in the world (not in dungeons) to use your loot table, add a “treasure chest” definition to a “.treasurechests” file, then reference it in your biome file.
To set your loot table to be inside of any dungeon container, open the dungeon in Tiled and create the following property for it:
To make it so your crop drops your loot table when harvested (not broken, refer to “Object Drop” for that), alter the last stage’s “harvestPool” with your loot table ID:
{ “duration” : [280, 320] },
{ “duration” : [280, 320] },
{ “alts” : 5, “duration” : [1170, 1230] },
{ “alts” : 5, “resetToStage” : 2, “harvestPool” : <loot table ID> }
],
If you have an item based on the logic of the default reward bag, you can specify its loot by setting “treasure” : { “pool” : “ct_alta_pod_loot” } to your loot table ID:
If you need to spawn your loot table in the middle of the script, use the following SB Lua function:
Full documentation on this function: Starbounder Wiki: Modding: Lua: Root[starbounder.org]
Use the following command to spawn your loot at the cursor (<level> is optional, default is 1):
Full documentation on this function: Starbounder Wiki: Commands: Admin[starbounder.org]
You can’t, unfortunately. I think. You can spawn individual items but not through loot tables.
Same as with trees – not loot tables but individual items:
Conclusion
The guide mentions patching in one section. If you’re not familiar with it, here’s a helpful guide:
https://steamcommunity.com/sharedfiles/filedetails/?id=2124444255
More about loot tables:
https://starbounder.org/Treasure
And that wraps up our share on Starbound: Modding: Loot Tables Guide. If you have any additional insights or tips to contribute, don’t hesitate to drop a comment below. For a more in-depth read, you can refer to the original article here by Ceterai, who deserves all the credit. Happy gaming!