CharacterDrop Tutorial Add - ASharpPen/Valheim.DropThat GitHub Wiki

Tutorial - Adding drop to CharacterDrop

This will show an example adding Coins as a drop when a Boar is killed.

Creating the drop entry

  • Go to your BepInEx/Config folder.
  • Open the drop_that.character_drop.cfg.
  • Add the following to the end of it.
[Boar.123]
PrefabName = Coins
  • Save the file.

Done!

What have we done though? Well, the first part is the header [Boar.123]. Drop That reads that as "For the Boar loot table, the following settings will modify the entry with ID 123".

Since ID 123 does not exist for Boar, it is added. If we had used 0, we would instead have been changing the RawMeat drop to Coins.

The second part we added is the actual item to drop. PrefabName = Coins. Drop That reads that as "For Boar's drop with ID 123, the Prefab with the internal name Coins" should be used when drop is spawned. We could have added more details, but Drop That will be adding defaults for whatever is missing. We could also have written it as below, and had the same result:

[Boar.123]
PrefabName = Coins
Enable = true
AmountMin = 1
AmountMax = 1
ChanceToDrop = 100
DropOnePerPlayer = false
ScaleByLevel = true
DisableResourceModifierScaling = false

The Details

Drop That reads CharacterDrop files by figuring out what the settings belong to using the headers above. Such as:

[<PrefabName>]
# General template settings here
# ...

[<PrefabName>.<ID>]
# Individual drop settings here
# ...

PrefabName is the name of the creature 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 for a mob can be modified by repeating the [.], using the same name and a different ID.

Eg.

[Boar.0]
...

[Boar.1]
...

Adding Conditions

Lets say we dont want to not just add the Coins drop to all boars, but as a special reward for players. We can restrict the drop by giving it conditions.

So lets change what we previously added to:

[Boar.123]
PrefabName = Coins
AmountMin = 100
AmountMax = 500
AutoStack = true
ConditionMinLevel = 3
ConditionEnvironments = Thunderstorm
ConditionDistanceToCenterMin = 3000

So what have we done?

  • We have scaled up the reward, so that it will now be randomly drop 100-500 coins when the boar is killed, and set them to AutoStack so that they don't drop individually and make our computers sad.
  • We have also made it so that this drop is only possible when the Boar is 2-stars, 3000 meters away from the center of the world and it was killed during a thunderstorm.

Adding options for other mods (Integrations)

Drop That adds extra options for certain mods. Lets say you want to also only want the coins to drop, if this is a creature affected by the fire infusion from the mod Creature Level and Loot Control (CLLC).

In that case, we would add the following after:

[Boar.123.CreatureLevelAndLootControl]
ConditionInfusion = Fire

This condition will then be added to the other ones for [Boar.123]. It will only be active if CLLC is active though.

This is the general way of modded settings. Their additional settings are under [<Prefab>.<ID>.<ModName>], and they are only active if the corresponding mod is loaded.

The Final Result

Just to round up, this is what the combined part of our additions would look like in the file.

[Boar.123]
PrefabName = Coins
AmountMin = 100
AmountMax = 500
AutoStack = true
ConditionMinLevel = 3
ConditionEnvironments = Thunderstorm
ConditionDistanceToCenterMin = 3000

[Boar.123.CreatureLevelAndLootControl]
ConditionInfusion = Fire
⚠️ **GitHub.com Fallback** ⚠️