TameProtection

版本 v1.0.0·更新於 2026-09-19

Wild creatures and tamed creatures ignore each other, so mobs stop hunting your tames and your tames stop picking fights.

模組介紹 作者原文

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.

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。 多人連線時,主機與所有用戶端需要安裝一致的模組。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

denikson-BepInExPack_Valheim

檔案與校驗

檔案名稱
TameProtection-1.0.0.zip
檔案大小
64.1 KiB