


Monsters don't stop just because you left.
In vanilla Valheim, monster AI freezes the moment you move too far away — enemy factions stop fighting each other, tamed wolves stand idle while your base burns, and the world around you silently pauses the instant you step through a portal.
AiFree removes that limitation.
Vanilla Valheim monsters abandon their current target after 30 seconds of not sensing it.
AiFree prevents this: as long as the target is alive, the monster never gives up.
When the target dies, the AI clears normally — no zombie behavior, no infinite aggro loops.
When you portal to another area, Valheim unloads the old zone — stopping all AI completely.
AiFree pins the zone of any actively-fighting monster in memory, keeping it simulated even when you're on the other side of the world.
Located in BepInEx/config/captain.aifree.cfg
| Key | Default | Description |
|---|---|---|
SenseTimeout |
0 |
Seconds before a monster gives up on a living target. 0 = never. Original game value: 30 |
KeepZonesLoaded |
true |
Keep combat zones loaded when the player is far away. Covers portal travel in singleplayer. |
MonsterAI patch — UpdateTarget() Prefix
Resets m_timeSinceSensedTargetCreature to 0 before the 30-second check fires, as long as the target character is alive. Uses AccessTools.Field for private field access.
ZNetScene patch — RemoveObjects() Prefix
Before the engine destroys out-of-range GameObjects, adds any actively-fighting monster's ZDO (and its target's ZDO) to the currentNearObjects list. This earmarks them as "near" — preventing destruction and keeping the AI update loop running.
Author: Captain
GitHub: https://github.com/KorCaptain