-
Notifications
You must be signed in to change notification settings - Fork 4
Getting Started
We will start off with the main one, loot tables. Valheim have multiple different ways of configuring what is dropped and how that works. For the most part, these are split into CharacterDrop and DropTable, where CharacterDrop is mainly used for creatures, and DropTable for non-creatures (eg., trees, chests) with a few exceptions such as birds. There are more ways, such as for pickable objects like when harvesting, but Drop That does not support modifying those.
The two loot tables work distinctly different. When a CharacterDrop loot table begins to drop, usually due to a creature dying, a check is made for each individual entry in the table if it should drop or not and how much. That means, each drop happens completely independently of any other drops in the table.
For instance, when a boar dies.
- Its drop table has three entries for prefabs "RawMeat", "LeatherScraps", "TrophyBoar"
- Each of the three entries roll for chance.
- RawMeat: 100% to drop 1 out of 1
- LeatherScraps: 100% to drop 1 out of 1
- TropyBoar: 15% chance to drop 1 out of 1.
- For each successfull roll, additional configuration such as level scaling can then modify the dropped amount and such.
When a DropTable loot table drops, it has three parts.
- First it rolls for many (if any) times it should drop from its entries.
- Second it uses a "weighted random" pick from its entries.
- Third the picked entry calculates the drop. Typically the amount for the pick is rolled here.
That means, the DropTable is not just going through its possible drops one by one like the CharacterDrop. Instead, it treats its drops as a tombola where the weight of an entry is how many times the entry is put in. When the drop table rolls picks, it determines how many times it picks from that tombola. This also means that the chance of a particular entry being picked is affected by how many other entries are in the table and their weight. But also that an entry can get picked even with weight 0 if nothing else is available.
For instance when a birch half-log is destroyed:
- The drop table rolls for 10 out of 10 picks.
- The drop table picks 10 times from its two entries "Wood" and "FineWood", each with weight 1, giving them the same chance to be picked.
- For each pick, the entry rolls the amount (1 being the only option for these).
- The result being 0-10 Wood drops and 0-10 FineWood, with the average outcome being 5 of each.
Note that some DropTables are configured with "DropOnlyOnce". When that option is true, every time an entry is picked, it is removed from the available entries for the next roll. This is used for things like treasure chests, where there may be a high weight for common drops like coins, but where the option is enabled to ensure some variety so that it doesn't end up as only coins.
Before continuing, lets make sure things are set up.
You will need the Drop That installed, use your modmanager of choice or if manual, add the DropThat.dll to your bepinex plugin folder.
Start the game. This will generate the basic configuration files.
Of particular note is the drop_that.cfg (the General Config). Two empty files called drop_that.character_drop.cfg and drop_that.drop_table.cfg will also be added. The first is for general control of the mod and the others are for adding your custom loot table changes.
The mod reloads these files every time a world is entered. There is also some console commands for reloading loot table configurations in an active world, but be aware these are intended for quicker testing and may cause issues.
To continue, you first need to figure out which loot table you are modifying. That is, what is the entity that has drops, and what does it use? This part can sometimes be tricky, especially for DropTable's.
You can come back to this later, the following tutorials will be making examples using a Boar (CharacterDrop) and a Fir tree half log (DropTable).
If you want to explore yourself, the simplest way is to either have Drop That generate what it believes is currently in the game, and search through that list for what seems like the right table. The files can be generated by using a toggle in the General Config and entering a world in the game. Alternatively, see Data - CharacterDrop default drops and Data - DropTable defaults for prefabs.
See General Config for toggling the datamining and debug options of Drop That.
- Go to your
BepInEx/Configfolder. - Open the
drop_that.character_drop.cfg. - Add the following to the end of it.
[Boar.123]
PrefabName = Coins- Go to your
BepInEx/Configfolder. - Open the
drop_that.drop_table.cfg. - Add the following to the end of it.
[FirTree.123]
PrefabName = RawMeatDrop That can do more than simply changing the drops. It is intended for adding conditions and additional specifications for the dropped prefab. A bunch of additional rules can be added to a drop, to make it drop only under specific conditions. Eg., a specific creature, spawned in the swamp, during a storm, while on fire and killed by the sword of a player.
[Boar.100]
PrefabName = IronScrap
AmountMin = 10
AmountMax = 10
ConditionBiomes = Swamp,
ConditionEnvironments = Thunderstorm
ConditionKilledWithStatus = Burning
ConditionKilledBySkillType = Swords
ConditionKilledByEntityType = Player
Drop That figures out what settings belong to which loot table using the section headers above and the file name. Such as:
[<PrefabName>]
# General settings here
# ...
[<PrefabName>.<ID>]
# Individual drop settings here
# ...PrefabName is the name of the object to modify, and the ID is a value from 0 and up, which indicates where to place the drop in the loot table. If an ID matches an existing one, it will override, if it doesn't exist, it will be created. Drop That automatically gives ID's when loading up as its not part of Valheim itself, so be aware these can change by other mods or if the devs change the vanilla tables. They can also get missed entirely, if a mod adds them after Drop That has loaded the table. The ID's are assigned sequentially from 0, so if vanilla had 3 drops, they will be ID 0, 1, and 2. And if some mod then adds 2 more drops, those will be ID 3 and 4.
Multiple drops can be modified by repeating the [.], using the same name and a different ID.
Eg.
[Boar.0]
...
[Boar.1]
...- CharacterDrop - Adding drops
- CharacterDrop - Modifying drops
- CharacterDrop - Disabling drops
- DropTable - Adding drops
- DropTable - Modifying drops
- DropTable - Disabling drops
- CharacterDrop - Named Lists
- DropTable - Named Lists