You are viewing a potentially older version of this package. View all versions.
DuPoTeam-TameLeash-1.5.0 icon

TameLeash

Following tames only fight enemies near you and come back instead of chasing across the map, and keep a configurable distance when idle. Great for the Ashlands.

Date uploaded 2 weeks ago
Version 1.5.0
Download link DuPoTeam-TameLeash-1.5.0.zip
Downloads 49
Dependency string DuPoTeam-TameLeash-1.5.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2333 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.2333

README

TameLeash

Keeps your following tames close in combat.

In vanilla Valheim, a tame that follows you attacks any enemy it notices and chases it as far as it likes. It only goes back to following you once it has no target left. In quiet biomes that's fine. In busy ones like the Ashlands there is always another enemy, so your tames scatter across the map instead of staying with you.

TameLeash gives every tame that follows you a guard radius around you:

  • It only picks enemies that are within the Guard Radius of you (default 20 m).
  • It fights those enemies freely and is never called back mid-fight.
  • It only gives up a target once the target moves beyond the Release Radius (default 28 m), for example an enemy running away. Then it comes back to you.

The two radii are different on purpose. Archers and other ranged enemies often stand right at the edge of the guard radius. With a single radius, a tame would grab them and let go again over and over.

Out of combat, TameLeash also lets you choose how close tames stay. In vanilla, a following tame stops 3 m from you, right under your feet. With TameLeash it stops at the Follow Distance (default 9 m). It still walks first and only starts running once it falls 7 m further behind, just like vanilla.

With Keep Away (on by default), a tame that stays closer than 4 m to you for more than 3 seconds walks away until it is back near the follow distance. This mostly happens when a portal or teleport drops it at your feet. The delay gives you time to mount, pet or feed it. Keep Away never runs during combat.

Tames that are set to stay and wild creatures are not affected.

Configuration

The config is created on first launch at BepInEx/config/dupo.TameLeash.cfg.

Setting Default Description
Follow / Follow Distance 9 Out of combat, a following tame stops this far (m) from you. Vanilla is 3. Range 2–30. Applies immediately, no restart needed.
Follow / Keep Away true Out of combat, a tame that stays too close to you walks away until it is 1 m inside the follow distance. Only works if Follow Distance − 1 is greater than Keep Away Distance.
Follow / Keep Away Distance 4 Closer than this (m) counts as too close. Range 1–20.
Follow / Keep Away Delay 3 Seconds a tame must stay too close before it walks away. Range 0–30.
General / Enabled true Turns the guard radius on or off. The Follow settings are not affected by this setting.
General / Guard Radius 20 A following tame only picks enemies within this distance (m) of you. Range 10–50.
General / Release Radius 28 A tame drops its target once the target is farther than this (m) from you. Range 10–60.
Debug / Debug Log false Every 2 s, logs what each following tame sees and decides. For troubleshooting only.

Tuning tips

  • Tames ignore ranged enemies that are shooting at you: raise Guard Radius (e.g. 25–30).
  • Tames still wander too far: lower Guard Radius and Release Radius.
  • Tames crowd you when idle: raise Follow Distance. Set it to 3 for vanilla behaviour.
  • A tame walks off before you can mount it: raise Keep Away Delay, or turn Keep Away off.

Compatibility

  • FollowDistance (blacks7ar): no longer needed, because TameLeash includes the same feature. If both are installed, TameLeash's Follow Distance wins and a warning is written to the log. You can safely remove FollowDistance.
  • BetterTames: compatible. Options such as Tames Fight Their Own Kind keep working, because TameLeash still uses the game's own enemy check.
  • Any mod that patches BaseAI.FindEnemy or BaseAI.Follow for tamed creatures may conflict.

Multiplayer

Valheim runs a creature's AI on the machine of the player who currently "owns" it, usually whoever is nearest or arrived first. TameLeash only affects creatures whose AI runs on a machine that has the mod installed.

  • Every player should install it for consistent behaviour.
  • It does not need to be installed on a dedicated server.
  • The config is not synced: each player uses their own values.

How it works (for modders)

  • A prefix on BaseAI.FindEnemy applies only to tamed MonsterAI creatures that are following someone. It does the same search as the game (closest enemy that the tame can sense and that is not asleep), but only among enemies within the guard radius of the followed player.
  • A postfix on MonsterAI.UpdateTarget clears the current target once it is beyond the release radius. UpdateAI then falls back to Follow().
  • A prefix on BaseAI.Follow applies only to tamed creatures. It runs the game's own logic, but the stop distance comes from the config. The run threshold is the stop distance + 7 m, which matches vanilla's 3 m stop / 10 m run. Keep Away lives in the same prefix. It walks the tame to a point 1 m inside the follow distance, on the line from you to the tame. If no path is found, it waits for another delay before trying again.

CHANGELOG

Changelog

1.8.0

  • New Pass Through Tames, on by default: players walk through tamed creatures instead of bumping into them, so tames no longer block doors, corridors or bridges, and a tame teleported onto you doesn't push you around.
  • Tames still collide with enemies, walls and each other, and you can still hit, pet, feed and ride them.
  • Choose All tames (default), only the ones Following you, or Off (vanilla), in the new Collision section of the config.
  • Debug Log now also reports how many player/tame collider pairs pass through ([COLLISION] lines).

1.7.0

  • New Nameplates: the name and health bar of the tames following you stay visible up to Show Distance (30 m), instead of vanilla's 10 m and only while you look at them. A sleeping tame, such as one downed with BetterTames, shows [zZz] next to its name. The label and its color are configurable.
  • New Assist (experimental): when you hit an enemy, the tames following you attack it, even if they were fighting another one. They keep at it for Assist Duration (10 s) after your last hit.
  • New Multiplayer hand-over (experimental): a following tame is handed over to the game of the player it follows. It then uses that player's settings, and Assist works for it. Ridden tames are never handed over.
  • Keep Away: the Follow Distance / Keep Away Distance rule is now explained in the README and config, and a warning is logged at startup when Keep Away can't work.
  • README: what happens in multiplayer when a player doesn't have TameLeash, and BetterTames recommended as an optional companion.
  • Debug Log now also reports Assist targets and hand-overs.

1.6.0

  • New Defense feature, on by default: all tamed creatures (following or not) take less damage as the world progresses. Vanilla tames never get tougher, so from the Plains onwards they die almost instantly.
  • Each of Moder, Yagluth, The Queen and Fader defeated adds a quarter of Max Reduction (default 50%): −12.5%, −25%, −37.5%, −50%. Base Reduction (default 0%) applies before Moder.
  • The reduction applies to every damage type, on top of the creature's own resistances. In multiplayer, use the same Defense values on every machine.
  • Debug Log now also logs every hit a tame takes, before and after the reduction ([DEFENSE] lines).

1.5.0

  • New Keep Away option, on by default. Out of combat, a tame that stays closer than Keep Away Distance (4 m) to you for Keep Away Delay (3 s) walks back out to near the follow distance. This fixes tames staying glued to you after portals and teleports. The delay leaves time to mount, pet or feed them.
  • Keep Away never runs during combat, while riding, or for tames set to stay.
  • Debug Log now also reports follow decisions (stop/walk/run/keep away) and, at startup, which mods patch BaseAI.Follow and BaseAI.FindEnemy.

1.4.0

  • New Follow Distance option (default 9 m): out of combat, following tames stop this far from you instead of vanilla's 3 m.
  • This option replaces the FollowDistance mod. A warning is logged if both are installed.
  • Follow Distance applies immediately, with no restart needed.

1.3.0

  • First public release.
  • Following tames only pick enemies within Guard Radius of the player they follow.
  • They give up a target only once it is beyond Release Radius.
  • Optional Debug Log to troubleshoot tame behaviour.