YouDied-InstantTame icon

InstantTame

Valheim 1.0 ready. Hotkey instantly tames creatures in a set radius. 9 tames normal tameables, 0 force-tames (and untames) monsters like Draugr and Greydwarves.

Last updated a day ago
Total downloads 173
Total rating 0 
Categories Mods Tools Client-side AI Generated Deep North Update
Dependency string YouDied-InstantTame-1.2.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2350 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured with the correct entry point for mods and preferred defaults for the community.

Preferred version: 5.4.2350

README

InstantTame

Instantly tame creatures within a configurable radius using a hotkey. Updated for Valheim 1.0 (Unity 6).

Two keys, two behaviors:

  • TameKey (default 9): tame-only, for creatures that are naturally tameable (Boar, Wolf, Lox, etc). Never untames anything, so your pets are always safe from this key.
  • ForceTameKey (default 0): tame/untame toggle, for creatures that are NOT naturally tameable (Draugr, Skeletons, Greydwarves, Trolls, and anything else running MonsterAI). Press once to force-tame a wild one in range, press again to untame a force-tamed one in range. Normal tameables are completely ignored by this key in both directions.

GUID: YouDied.InstantTame

Requirements

  • Valheim 1.0
  • BepInExPack_Valheim 5.4.2350 or newer (the 1.0-compatible build)

Default Config

Setting Default Description
TameKey 9 (Alpha9, main row) Tame-only hotkey for normally-tameable species
ForceTameKey 0 (Alpha0, main row) Tame/untame toggle hotkey for non-tameable species
TameRadius 10 (1-50) Search radius in meters, shared by both keys
TameAllInRadius false Act on every eligible creature in range vs. just the nearest one
ForceTameCommandable true Force-tamed creatures get a Tameable component added so they can be given follow/stay commands. If false, they just stop being hostile with no command support
TamedSpawnersMakeTameChildren true Creatures freshly spawned next to a tamed spawner (e.g. a tamed Gjall's ticks) are tamed automatically instead of spawning hostile
SpawnerNames $enemy_gjall Comma-separated Character.m_name values of the tamed spawners to watch

Config is adjustable via BepInEx Configuration Manager, no restart required.

How it works

Both keys scan a sphere around the player via Physics.OverlapSphere, filtering out the player and dead creatures.

TameKey (9) targets only creatures that already have a Tameable component and are not already tamed, and invokes its private Tame() method via reflection. This is the exact vanilla flow: MonsterAI.MakeTame(), m_tamedEffect VFX, and the "$hud_tamedone" message. Full parity with natural taming. There is no untame behavior on this key at all.

ForceTameKey (0) targets only creatures without a native Tameable component (tracked internally by ZDOID once force-tamed, since a Tameable may get injected). Behaves as a toggle:

  • If an untamed eligible monster is in range, it force-tames the nearest one (or all, if TameAllInRadius). If the creature runs MonsterAI (true for Draugr, Skeletons, Greydwarves, Trolls, etc.), it calls the public MonsterAI.MakeTame() directly, which sets the tamed flag, clears alert state, and drops current targets. Hostility toward the player is gated on Character.IsTamed() checks in MonsterAI.UpdateTarget(), not a faction system, so no faction reassignment is needed. If ForceTameCommandable is on, a Tameable component is added afterward with m_commandable = true so follow/stay works. Creatures with no MonsterAI (e.g. AnimalAI-driven passive animals) fall back to Character.SetTamed(true) directly. Best effort only, no commands, no VFX.
  • If no untamed eligible monster is in range but a force-tamed one is, it untames the nearest one instead: reverses SetTamed, removes any injected Tameable, and clears the follow target.
  • Untaming only ever applies to creatures this mod itself force-tamed. It will never touch a creature that's naturally tameable, regardless of tamed state.

Both keys are blocked while chat, console, or inventory has focus.

Tamed spawners (Gjall ticks)

In vanilla, a tamed Gjall still spawns untamed ticks, so it ends up fighting its own spawn. Every 0.5 seconds the mod looks for characters that are still wild, spawned within the last 6 seconds, and are within 30 m of a tamed creature whose name is in SpawnerNames, and tames them the same way the ForceTameKey does (they are also added to the force-tame set, so key 0 can untame them).

This is a proximity heuristic, not a hook into the spawn code. A wild creature that happens to spawn right next to a tamed Gjall inside that window would also be tamed. Ticks that were already hostile before the Gjall was tamed are not touched. Press 0 near them to force-tame them.

Build

The project uses direct HintPath references only (no NuGet). Everything resolves from your local Valheim install:

  • valheim_Data\Managed\ for assembly_valheim.dll, the UnityEngine modules, and Valheim's own netstandard.dll
  • BepInEx\core\ for BepInEx.dll and 0Harmony.dll

VALHEIM_INSTALL defaults to C:\Program Files (x86)\Steam\steamapps\common\Valheim. Override it with an environment variable or edit the .csproj if your install lives elsewhere.

Project settings that matter for Valheim 1.0:

  • Targets net472 (needs the .NET Framework 4.7.2 targeting pack installed)
  • FrameworkPathOverride points at the 4.7.2 reference assemblies
  • netstandard is referenced from Valheim's Managed folder (v2.1.0.0) to avoid a version conflict with the Unity assemblies
  • ImplicitUsings disabled, and Vector3 / Object are fully qualified as UnityEngine.Vector3 / UnityEngine.Object in the source to avoid ambiguity with System.Numerics and System.Object

Build from a terminal in the project folder:

dotnet restore InstantTame.csproj
dotnet build InstantTame.csproj -c Release

The DLL is copied to BepInEx\plugins\InstantTame\ automatically if that folder exists. If Visual Studio reports a stale project.assets.json target error after changing frameworks, delete bin\, obj\ and .vs\, then run the restore command above.

Troubleshooting

The plugin logs to BepInEx\LogOutput.log:

  • Harmony patches applied successfully. on load confirms the Player.Update patch attached.
  • [Diag] lines (every ~3 seconds while in-world) report the focus-guard and key state, and fire lines appear when a hotkey is detected. These are diagnostic only and can be removed from Player_Update_Patch.Postfix once you no longer need them.
  • NormalTame failed / ForceUntame failed warnings include the exception message if a tame call throws.

Known gaps

  • Runtime-added Tameable on force-tamed creatures has zeroed fields (m_tamingTime, m_fedDuration, m_tamedEffect, etc.) since it wasn't set up on the prefab. TamingUpdate() no-ops once IsTamed() is true, so this is safe, but force-tamed monsters get no tame VFX or name tag beyond the on-screen message.
  • Non-MonsterAI creature fallback (Character.SetTamed(true) alone, no component) has no command support and may not persist cleanly across a relog, since Tameable normally owns some of that ZDO state. Untaming one flips the flag but has no extra cleanup.
  • Force-tame tracking is per session (an in-memory ZDOID set), so after a restart the toggle can't untame monsters force-tamed in a previous session.