TameProtection
Wild creatures and tamed creatures ignore each other, so mobs stop hunting your tames and your tames stop picking fights.
About this mod Author’s original text
TameProtection
Wild creatures and tamed creatures no longer treat each other as enemies.
AI disclosure. This mod was written with AI assistance (Claude) — the Harmony patch,
configuration, build tooling and documentation. It was reviewed and tested against a live
Valheim 1.0.15 dedicated server. Listed under the AI Generated category.
This restores the ProtectTamedFromEnemies behaviour from Wendigo's CreatureCarry
1.3.0, which Eradorn's CustomCreatureCarry fork deliberately left out ("There are no
egg-hatching, OdinMounts, ChebsNecromancy or general tame-protection changes").
The effect is mutual: enemies will not target your tames, and your tames will not
start fights with enemies. Wild-vs-wild and tame-vs-tame hostility is untouched, so
normal combat and your own attacks on tames work exactly as in vanilla.
Install
Install on the server and on every client.
The patch runs client-side - BaseAI.UpdateAI is gated on IsOwner, so hostility checks
happen on whichever peer owns the creature, which on a dedicated server is the nearby
player's client. Every player therefore needs it; a player without it still sees their own
creatures hunt tames.
The server copy makes the configuration authoritative. Without it, nothing is synced and
each player silently keeps their own local settings - which matters here, because clients
own different creatures, so mismatched settings protect tames or not depending on who is
standing nearest.
- r2modman Mod Manager: search for TameProtection by N3bby and install.
- Manual: copy plugins/TameProtection/ into BepInEx/plugins.
- Dedicated server: copy the same folder into the server's BepInEx plugins directory.
There is no version handshake. A client without the mod simply does not get the
protection; nothing breaks.
Configuration
BepInEx/config/com.n3bby.tameprotection.cfg
| Setting | Default | Synced | Meaning |
| --- | --- | --- | --- |
| ProtectTamedFromEnemies | true | yes | Master switch. |
| ProtectedPrefabs | empty | yes | Comma-separated prefab names (e.g. Asksvin,Lox). Empty protects every tamed creature. |
| LockConfiguration | true | yes | While connected, only server admins may change synced settings. |
| DebugLogging | false | no | Logs every suppressed hostility check. Noisy; testing only. |
Synced settings are owned by the server and pushed to clients on connect. Admins can
change them live from an in-game configuration manager. Clients joining a server without
the mod keep their own local values.
How it works
A single Harmony postfix on BaseAI.IsEnemy(Character, Character). The instance
overload compiles to return BaseAI.IsEnemy(this.m_character, other), so patching the
static method covers every caller. When exactly one of the two characters is tamed, the
result is forced to false.
Built against Valheim 1.0.15 / BepInExPack 5.4.2350.
Credits
The ProtectTamedFromEnemies behaviour originates in
Wendigo's CreatureCarry 1.3.0.
That package shipped without a license file or source-repository URL, so no upstream code
was reused here: this plugin is an independent implementation written against the
decompiled BaseAI.IsEnemy signature in Valheim 1.0.15. Credit for the original idea and
for identifying the right hook belongs to Wendigo.
Eradorn's CustomCreatureCarry
is a 1.0 fork of CreatureCarry that keeps the carrying and deliberately omits the
tame-protection feature. This plugin exists to fill that gap and is meant to sit
alongside it, not replace it.
See the AI disclosure at the top of this page.
Install & use Install: BepInEx plugin
- The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
- Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
- Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
- Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.
Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file. In multiplayer, the host and every client need the same mods installed.
Install these first, or the mod will not work: