Hi, and thanks for BetrTame! It's working well for us: it sets up 71 creatures, and greydwarf and deer taming work. We hit one compatibility problem, and we have one note.
Setup
- Dedicated Linux server, Valheim 1.0.20 (network version 41), BepInExPack 5.4.2351
- Mods on server and clients: BetrTame 0.1.4, Jotunn 2.30.2, ValheimPlus (Grantapher fork) 0.10.2.0, OdinHorse 1.9.1, shrooms 1.5.0
- Clients: one native Linux client, one Windows 10 client
- BetrTame config changes: Taming time = 0.25, Growing up time = 0.25, wild stars Enabled = false, knocked out Enabled = false. Everything else is default, including Command every tame = true.
Bug: players can jump but not walk while a tamed deer follows
After we tamed a deer and set it to follow, both players could still jump but could no longer walk. The client's BepInEx log showed about 50 errors per second (over 4,700 in total), all the same (see the log excerpt below).
Cause: OdinHorse puts a prefix on BaseAI.Follow that does (__instance as MonsterAI).GetFollowTarget() for every tamed creature. BetrTame's Animals.Think calls BaseAI.Follow for AnimalAI tames like deer, so the cast gives null and the prefix throws. The throw happens inside MonoUpdaters.FixedUpdate, which cuts off the rest of that physics update, so player movement stops working.
Strictly speaking this is OdinHorse's bug. But only BetrTame calls Follow on an AnimalAI, so other BetrTame users with OdinHorse will hit it too. A note in the README, or a guard on your side, could save people some confusion.
Our workaround: a small plugin that loads after OdinHorse and skips OdinHorse's prefix unless the AI is a MonsterAI with a follow target:
[BepInPlugin("metaphaze.OdinHorseFollowFix", "OdinHorseFollowFix", "1.0.0")]
[BepInDependency("Raelaziel.OdinHorse")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
var target = AccessTools.Method("OdinHorse.OdinHorse+Tamed_Follow_patch:Prefix");
if (target == null) return;
new Harmony("metaphaze.OdinHorseFollowFix").Patch(target,
prefix: new HarmonyMethod(AccessTools.Method(typeof(Plugin), nameof(Guard))));
}
// __2 = OdinHorse's "ref BaseAI __instance" (its prefix is static, so bind by position)
private static bool Guard(ref BaseAI __2, ref bool __result)
{
var monster = __2 as MonsterAI;
if (monster != null && monster.GetFollowTarget() != null) return true;
__result = true; // tell Harmony to run the original BaseAI.Follow
return false;
}
}
Note: speed multipliers stack with ValheimPlus
The config description says "Taming time" and "Growing up time" also apply to the game's own tames (boar, wolf, lox, ...). ValheimPlus has its own [Tameable] tameTimeMultiplier and [Procreation] maturityDurationMultiplier, so with both turned on the speed-ups multiply. To avoid that, we set the ValheimPlus ones to 0 and let BetrTame handle them. A short README note about this could help other ValheimPlus users.
Thanks again for the mod!
P.S. A possible fix on BetrTame's side: in Animals.Think, move AnimalAI followers with MoveTo() yourself instead of calling BaseAI.Follow (or wrap that call in try/catch), so other mods' Follow patches can't break it.