P_T_G-MobChaseControl icon

MobChaseControl

Server-side control over how far and how long mobs chase you. Bosses excluded.

By P_T_G
Last updated 14 hours ago
Total downloads 12
Total rating 0 
Categories Mods Server-side Client-side AI Generated
Dependency string P_T_G-MobChaseControl-1.2.0
Dependants 0 other packages depend on this package

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

MobChaseControl

Legt global fest, wie weit und wie lange Mobs dich verfolgen. Bosse bleiben außen vor.


Deutsch

Auf meinem eigenen Server hat mich irgendwann gestört, dass Mobs entweder nach ein paar Metern aufgeben oder einen halb über die Karte verfolgen, je nachdem was gerade gespawnt ist. Es gibt Mods, die Kreaturenwerte einzeln umschreiben, aber ich wollte zwei Regler für alles - und die vom Server aus setzen, ohne dass jeder Mitspieler seine Config anfassen muss.

Einstellungen

Option Bedeutung
MaxChaseDistance Meter, ab denen ein Mob sein Ziel verliert. -1 lässt den Vanilla-Wert der jeweiligen Kreatur stehen, 0 heißt unbegrenzt. Standard 60.
GiveUpTime Sekunden ohne Wahrnehmung des Ziels bis zum Aufgeben. Vanilla sind 30. -1 lässt es unverändert.
ViewRangeMultiplier Multiplikator auf die Sichtweite aller Mobs. 1 = Vanilla.
HearRangeMultiplier Multiplikator auf die Hörweite.
ExcludeBosses Standard an. Bosse behalten ihr normales Verhalten.
ExcludeTamed Gezähmte Tiere bleiben außen vor, damit dein Wolf weiter hinterherläuft.
ExcludedPrefabs Kommagetrennte Liste einzelner Kreaturen, die unangetastet bleiben, z.B. Greydwarf,Neck,Boar

Änderungen greifen sofort, auch bei bereits gespawnten Mobs. Kein Neustart nötig.

Server und Clients

Das sorgt regelmäßig für Verwirrung, deshalb vorweg: die Mob-KI rechnet in Valheim der Client, dem die Kreatur gerade gehört, nicht der Server. Die DLL muss deshalb bei jedem Spieler liegen, sonst verhalten sich Mobs unterschiedlich, je nachdem wer in der Nähe ist.

Die Werte kommen trotzdem aus einer Hand. Der Server schickt seine Konfiguration an alle Verbundenen, lokale Dateien der Spieler werden ignoriert und die Felder im ConfigurationManager sind gesperrt. Du pflegst nur die Datei auf dem Server.

Wer in der adminlist.txt steht, darf die Werte im ConfigurationManager im laufenden Spiel ändern. Die Änderung geht an den Server, der prüft nochmal selbst, wer da sendet, speichert es in seiner Config und verteilt es an alle. Abgelehnte Versuche landen im Log.

Im Einzelspieler oder als Host gilt die eigene Datei wie gewohnt.

Installation

BepInEx vorausgesetzt:

  1. MobChaseControl.dll nach BepInEx\plugins\
  2. Einmal starten, dann liegt BepInEx\config\flo.mobchasecontrol.cfg bereit
  3. Werte anpassen

Auf dem Server dasselbe. Und dran denken: die Mitspieler brauchen die DLL auch.

Kompatibilität

Hängt sich an MonsterAI.Awake und per Transpiler an MonsterAI.UpdateTarget. Arbeitet pro Prefab statt über eine feste Kreaturenliste, Mobs aus Content-Mods sind also automatisch dabei.

Die Mod merkt sich, welche Werte sie zuletzt bei einer Kreatur gesetzt hat. Hat danach eine andere Mod an derselben Kreatur gedreht, lässt sie die in Ruhe statt sie beim nächsten Refresh zu überschreiben. Konflikte mit Mods, die Sicht- oder Hörweite einzelner Viecher anpassen, sollten damit erledigt sein.

Läuft bei mir auf einem Dedicated Server mit über 50 Mods parallel.

Bekannte Grenzen

  • Baut ein Spielpatch die Verfolgungslogik größer um, findet der Transpiler sein Muster nicht mehr. Dann steht eine Zeile im Log und die Aufgabezeit bleibt bei 30 Sekunden, der Rest arbeitet weiter.
  • Kreaturen, die andere Mods gezielt manipulieren, bleiben absichtlich unangetastet.

Bug gefunden? Kommentare, am besten mit dem passenden Ausschnitt aus dem LogOutput.log.


English

On my own server I got tired of mobs either giving up after a few steps or following me halfway across the map, depending on what happened to spawn. There are mods that rewrite creature stats one by one, but I wanted two sliders covering everything - set from the server, without asking everyone to edit their own config.

Settings

Option What it does
MaxChaseDistance Distance in meters at which a mob drops its target. -1 keeps each creature's vanilla value, 0 means unlimited. Default 60.
GiveUpTime Seconds without sensing the target before giving up. Vanilla is 30. -1 leaves it alone.
ViewRangeMultiplier Multiplier on sight range for all mobs. 1 is vanilla.
HearRangeMultiplier Multiplier on hearing range.
ExcludeBosses On by default. Bosses keep their normal behaviour.
ExcludeTamed Tamed animals are skipped so your wolf still follows you.
ExcludedPrefabs Comma separated list of creatures to spare, e.g. Greydwarf,Neck,Boar

Changes apply immediately, including to mobs that are already spawned. No restart needed.

Server and clients

This trips people up regularly, so up front: in Valheim the creature AI runs on whichever client currently owns the creature, not on the server. The DLL has to be installed for every player, otherwise mobs behave differently depending on who is nearby.

The values still come from one place. The server sends its configuration to everyone connected, players' local files are ignored and the fields in ConfigurationManager are locked. You only maintain the server file.

Anyone listed in adminlist.txt can change values through ConfigurationManager while playing. The change goes to the server, which verifies for itself who is sending, stores it in its own config and distributes it to everyone. Rejected attempts show up in the log.

Solo or hosting locally, your own file applies as usual.

Installation

Requires BepInEx:

  1. Drop MobChaseControl.dll into BepInEx\plugins\
  2. Launch once, BepInEx\config\flo.mobchasecontrol.cfg appears
  3. Adjust

Same on the server. And remember your players need the DLL too.

Compatibility

Hooks MonsterAI.Awake and uses a transpiler on MonsterAI.UpdateTarget. Works per prefab instead of a hardcoded creature list, so mobs from content mods are covered automatically.

It remembers the values it last wrote to a creature. If another mod changes that same creature afterwards, this one backs off rather than overwriting it on the next refresh. That should settle conflicts with mods adjusting sight or hearing on specific creatures.

Running on my dedicated server alongside 50+ other mods.

Known limits

  • If a game patch rewrites the chase logic, the transpiler won't find its pattern anymore. You'll get a line in the log and the give-up time stays at 30 seconds, everything else keeps working.
  • Creatures that other mods deliberately modify are left alone on purpose.

Found a bug? Comments, ideally with the relevant part of your LogOutput.log.