Valheim
Install with App

Details

Latest version
1.0.0
Last Updated
First Uploaded
Downloads
142
Likes
0
Size
17KB
Dependants
ADDatHost Valheim hosting
30% off

SelectiveKeepOnDeath

This mod was inspired by Toxo's KeepInventoryOnDeath. However, I personally felt like being able to die with ores/metals on you and being returned to base with them upon respawn felt wrong, so I created this mod that allows you to configure what gets kept on death, and what gets left in a tombstone. Additionally, to compensate for keeping items on death, skill drain prevention can be turned off. This makes it so there can be a trade-off for keeping items, where skill drain will apply on every death. Works with an existing character and existing save.

By default, you:

keep everything except items that can't go through portals (ores, metals, etc), so you still have to make the trip back for them.

still have the default window for no skill drain. If you would like to keep this on but would like to have a shorter window where skills cannot drain (or longer), you can configure this too

In a nutshell:

  • Selective Keep - Keep or drop items by category, or by individual item name
  • Gear Stays On - Kept armor and weapons stay equipped when you respawn (sheathed weapons come back sheathed in your inventory)
  • No Empty Tombstones - If nothing drops, no tombstone is created
  • Skill Drain Control - Turn the "No skill drain" protection off, or change how long it lasts
  • Live Config - Edit the config file while playing; changes apply immediately

Features

SelectiveKeepOnDeath changes what happens to your items when you die. Food buffs are still cleared and skill loss still applies as normal (unless you change the Skill Drain settings). By default, only item loss is changed, where you keep all items except ones that cannot go through a portal.

Keep Rules

Every item in your inventory is checked against these rules, in order. The first rule that matches decides:

  1. AlwaysDropItems - listed items always go to the tombstone
  2. AlwaysKeepItems - listed items are always kept
  3. Non-teleportable items - dropped, unless KeepNonTeleportable is on
  4. Category - kept or dropped based on its category setting

Categories

Setting Items
KeepWeapons Weapons, bows, shields, torches, axes and pickaxes
KeepArmor Helmets, chest, legs and capes
KeepUtilityAndTrinkets Belts and other utility items, trinkets
KeepTools Hammer, hoe, cultivator and other tools
KeepAmmo Arrows, bolts and other ammo
KeepConsumables Food, meads and potions
KeepMaterials Wood, stone, leather and other crafting materials
KeepTrophies Trophies
KeepMisc Fish and anything else

Skill Drain

After a death, Valheim protects you from losing skills on your next death for a while (the "No skill drain" buff).

  • Turn the protection off so every death drains skills
  • Change how long it lasts
  • Leave it alone and it works exactly like vanilla

Installation

Recommended: Install via Gale

Manual: Install BepInEx for Valheim, then place the DLL in BepInEx/plugins folder.

Multiplayer

  • Client-side: Each player who wants to keep items needs the mod installed
  • Per-player config: Each player's own config file decides what they keep
  • The server does not need the mod

Quick Start Guide

Keep everything except non-portalable items (default)

  1. Install the mod
  2. Die
  3. Your gear, tools, food and materials are still on you, still equipped. Ores and metals are in your tombstone (no tombstone will drop if you have nothing to drop)

Keep absolutely everything

  1. Set KeepNonTeleportable to true
  2. No tombstone is created when you die

Drop your materials, keep your gear

  1. Set KeepMaterials to false
  2. Wood, stone, leather etc. go to the tombstone; weapons, armor and tools stay with you

Keep a specific item no matter what

  1. Add its item name to AlwaysKeepItems, e.g. Copper,Tin
  2. Item names are the internal (prefab) names, the same ones used by the spawn console command

Configuration

Edit BepInEx/config/kafka.selectivekeepondeath.cfg, or use your mod manager's config editor. Changes apply instantly with no restart needed.

Key Settings:

  • Section 1 - General: Turn the mod on or off
  • Section 2 - Rules: KeepNonTeleportable
  • Section 3 - Categories: One on/off setting per item category (see Categories)
  • Section 4 - Item Lists: AlwaysKeepItems, AlwaysDropItems (comma-separated item names)
  • Section 5 - Skill Drain: NoSkillDrainEnabled, NoSkillDrainDuration (seconds, -1 = vanilla)

⚠️ Important: AlwaysDropItems overrides everything else, including AlwaysKeepItems.


Compatibility

Incompatible:

  • I don't know honestly this is the first mod I've ever made. I would recommend you don't have other mods that affect how items are kept on death enabled, though.

Troubleshooting

Mod not doing anything?

  • Check that Enabled is true in the config
  • Check LogOutput.log for SelectiveKeepOnDeath ... loaded!

Item went to the tombstone when it shouldn't have?

  • Check whether it can go through portals, non-teleportable items drop unless KeepNonTeleportable is on
  • Check AlwaysDropItems, it overrides every other rule

Config changes not applying?

  • Make sure you saved the file. LogOutput.log shows Config reloaded. when the change is picked up

Author: kafka

Inspired by Toxo's KeepInventoryOnDeath.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.