You are viewing a potentially older version of this package. View all versions.
LJS-AiFree-1.0.0 icon

AiFree

Monsters never abandon their targets when you move away. Enemy factions keep fighting each other, tamed creatures keep defending your base — even after you portal to the other side of the world.

Date uploaded 16 hours ago
Version 1.0.0
Download link LJS-AiFree-1.0.0.zip
Downloads 24
Dependency string LJS-AiFree-1.0.0

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

AiFree

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.


What It Does

AI Timeout Removal

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.

  • Two enemy factions mid-battle? They keep fighting.
  • A troll chasing a deer into the woods? It follows through.
  • Your tamed wolf cornered by greylings? It keeps defending.

When the target dies, the AI clears normally — no zombie behavior, no infinite aggro loops.

Zone Loading (Portal Coverage)

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.

  • Portal away mid-raid: the raid plays out for real.
  • Leave your tamed creatures at home: they'll actually fight back.
  • Come back to find the aftermath, not a freeze-frame.

Configuration

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.

Compatibility

  • BepInEx 5.4.x required
  • No known conflicts with other AI mods
  • Works in singleplayer and dedicated servers
  • Safe to add/remove mid-save

How It Works (Technical)

MonsterAI patchUpdateTarget() 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 patchRemoveObjects() 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.


Source

Author: Captain
GitHub: https://github.com/KorCaptain