ServerTaming
Server-side only: tame and breed Deer and Necks. Players need no mod, so it works with vanilla and crossplay (console) clients.ServerTaming
A BepInEx plugin for Valheim that makes Deer and Necks tameable and breedable.
Server-side only. Install it on the dedicated server only. Players don't install anything, so it works with vanilla clients and with crossplay players on console or Game Pass.
How it works
- Taming: pen the animal and drop its food on the ground inside the pen, within
FeedRadius(8 m). The animals don't walk to the food. A hungry animal eats one item, which keeps it fed forFedMinutes(5). While it's fed and not alerted, its taming time counts down. AfterTamingMinutes(25) it becomes tamed, using the vanilla "tamed" flag. Tamed deer stop running from players, and tamed necks stop attacking them. - Breeding: a tamed animal that's fed and has a tamed partner of the same kind within
PartnerRange(5 m) gains love points. After enough points it becomes pregnant, and afterPregnancyMinutes(10) a tamed adult with the parent's stars appears between the mother and her nearest tamed partner, so it stays inside the pen (the server can't see fences, but both parents are inside them). There are no fawns or custom creatures. Breeding stops onceMaxCreatures(8) animals of that kind are withinPopulationRange(15 m) of the animal. Pregnant animals count once more for the baby they carry, and the limit is checked again at birth, so a whole pen getting pregnant at once can't overshoot it. As a safety net for animals that wander out of the pen, breeding also stops onceMaxTamedNearby(30) tamed animals of that kind are anywhere in the area loaded around players. Only the same kind counts: lox or boars never count toward the deer limit. Each animal can have its own limit, see below. - Feeding from chests: animals can also eat from nearby chests, using the same rules as ServersideQoL TameAssist's
FeedFromContainers(see below). - Boars, wolves, lox and other vanilla animals: see the companion server-side mod BreedingInPen for their breeding limits and keeping their babies inside the pen.
- Messages: players within
MessageRange(30 m) see taming progress at 25/50/75%, plus messages when an animal is tamed or born. - Stars:
MaxTameStarssets the highest star count that can be tamed. The default,-1, means any, including the 3+ star creatures from level mods.
ServersideQoL TameAssist compatibility
When ServersideQoL TameAssist is installed (and UseTameAssistSettings is on, which is the default), deer and necks follow TameAssist's settings instead of ServerTaming's own:
FeedFromContainers,FeedFromContainersRangeandFeedFromContainersLeaveAtLeastdecide which chests the animals eat from, and how much food is always left in them.- Per-chest range from a sign: a chest whose text (set through its ContainerSigns sign) contains the
FeedFromContainersRangeSignPrefix(π by default) followed by a number, for exampleπ10, sets that chest's range. It's capped atFeedFromContainersMaxRange. These are the chest signs that ServersideQoL ContainerSigns adds. TamingTimeMultiplierandFedDurationMultiplierare applied toTamingMinutesandFedMinutes.TamingProgressMessageType, for exampleInWorld, is used for taming progress, with the same "tameness" text as TameAssist.
Unlike TameAssist, which only feeds tamed animals from chests, ServerTaming also feeds wild deer and necks that are being tamed, because they can't walk to food. Set FeedWildFromContainers = false to turn that off.
Without TameAssist, set [Containers] FeedFromContainersRange (0 means off) and LeaveAtLeast in ServerTaming's own config.
Chests that are open are skipped. When food is taken from a chest, only that one item's bytes in the saved inventory are changed, so all the other items stay exactly as they were.
Default foods:
| Animal | Foods |
|---|---|
| Deer | Raspberry, Blueberries, Cloudberry, Carrot, Turnip, Onion, Mushroom, MushroomYellow |
| Neck | FishRaw |
All of these can be changed in BepInEx/config/Tie.ServerTaming.cfg. Each animal has its own section: Enabled, Foods, TamingMinutes, FedMinutes, Breeding, PregnancyMinutes and MaxCreatures (-1, the default, uses [Breeding] MaxCreatures).
Limitations
Without a client mod there's nothing to add the vanilla taming component to each player's game, so:
- there's no petting, Follow/Stay or naming, and tamed animals simply wander (keep them fenced)
- animals don't walk to food, so put the food close to them
- taming and breeding only progress in areas loaded around connected players, the same as vanilla
Admin command
With ServerDevcommands installed, admins can type server tamestatus [radius] in the F5 console. It lists nearby deer and necks with their stars, taming %, fed time, love points and pregnancy.
Installation
Put ServerTaming.dll in BepInEx/plugins/ServerTaming/ on the dedicated server only. Players don't install anything: no client mod is needed or used.
Building
The project targets .NET Framework 4.7.2. It references the game and BepInEx assemblies from a Valheim dedicated server install with BepInEx. By default it looks two folders above the project; you can point it somewhere else:
dotnet build -c Release -p:ValheimDir=/path/to/valheim_server
Technical notes
- Progress storage: progress is kept in server memory. Writing it into objects that players' games control would be lost to their next update. Just before the world saves, it's copied into the objects' saved data, and it's read back after a restart. This is needed because object IDs change on every world load.
- Taming: the server asks the player's game that controls the animal to run the vanilla
RPC_SetTamed. If no player's game controls the animal, the server sets the flag directly. - Eating: the server takes control of the food item, then lowers its stack or removes it.
- Replaced creatures: ServersideQoL CreatureLevelUp replaces 3+ star creatures with a copy under a new ID, to show their stars and size. ServerTaming moves the animal's taming, fed, love and pregnancy state over to the copy, so 3+ star animals don't lose their progress.
- Troubleshooting: set
[General] DebugLog = trueto log every feeding, love point and breeding decision for animals near players. - Births: the server creates the new adult directly, already marked as tamed. The nearest player's game takes control of it and shows a vanilla deer or neck.
