You are viewing a potentially older version of this package. View all versions.
aetuss-BetterEnemyAI-1.5.2 icon

BetterEnemyAI

Enemies stop circling around you after attacking and give up long chases sooner. All values configurable.

Date uploaded a day ago
Version 1.5.2
Download link aetuss-BetterEnemyAI-1.5.2.zip
Downloads 56
Dependency string aetuss-BetterEnemyAI-1.5.2

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2360 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.2360

README

BetterEnemyAI

Stops enemies from circling around you after they attack, and makes them give up long chases sooner.

What changes?

  • No circling after attacks: After an attack, enemies no longer run circles around you while waiting for their next attack. If they are in range they stand still and face you; otherwise they move toward you. Enemies that end up beside or behind you first walk back around to your front (GroundFrontArc), so they don't wait out of sight. Chargers like boars, whose attack needs a run-up, instead back off to run-up distance, turn to face you and charge again.

  • Softer circling for flyers: Flying enemies (deathsquitos, bats, drakes, etc.) still circle you while their attack recharges, like in vanilla, but slower and smoother. They back off about 6 meters, drift around you with changing speed and direction, stay in front of you or at your sides instead of flanking behind you, and dive again once their attack is ready. Walking toward them closes the distance instead of pushing them away. FlyingWander sets how much they move and FlyingFrontArc how far around you they may go. You can switch them back to vanilla circling or make them hover in place instead.

  • No periodic circling: Some enemies stop attacking every now and then to circle around their target. This is turned off.

  • Shorter chases:

    • An enemy gives up if it can't see or hear you for 10 seconds (vanilla: 30 seconds).
    • An enemy gives up if 20 seconds pass without it hitting you or taking damage from you (vanilla: 60 seconds).
    • An enemy gives up once it gets 60 meters away from where the chase started, unless you're in the middle of a fight.
    • A ground enemy gives up if it has no path to you for 6 seconds (say, you're up on a rock), unless you're in the middle of a fight. Near your buildings, enemies that attack buildings keep their vanilla behavior, so your base can still be raided.
    • An enemy that gave up won't look for a new target for 8 seconds. If you hit it, it fights back right away.
    • An enemy that gave up walks straight back to where the chase started, instead of slowly wandering around where it stopped (vanilla).
  • Sleep while taming: An animal you're taming (fed, with taming started) no longer stops you from sleeping with "enemies nearby". Wild creatures still do. (TamingDoesntBlockSleep)

Sea creatures like serpents keep their vanilla circling (it's how they fight boats), and land creatures keep it while swimming. Tamed animals, friendly creatures and bosses are not affected (bosses can be enabled in the config). Chases by raid monsters stay vanilla by default. Creatures added by other mods are affected too.

Configuration

All values can be changed in game with F1 (Configuration Manager) or in your mod manager's config editor. To exclude specific creatures, list their prefab names in ExcludedCreatures, separated by commas. Example: Wolf,Deathsquito

Per-creature settings

CreatureOverrides gives specific creatures their own values. Write the creature's name, a colon, then Setting=Value pairs separated by commas; separate creatures with semicolons:

Troll: GiveUpWhenNoCombatSeconds=30, MaxChaseDistance=80; Greydwarf: GiveUpWhenNoCombatSeconds=15

Any setting name from the config works. There are also three shortcuts:

  • Chase=Vanilla keeps that creature's normal chasing (e.g. Deathsquito: Chase=Vanilla)
  • Circling=Vanilla keeps its normal circling
  • Enabled=false turns the mod off for it

Use a dot for decimals (1.5). Mistakes are skipped and reported in the BepInEx log.

To find creature names, stand near them, open the console (F5) and type bea_creatures. It lists every creature within 40 m (or bea_creatures 100 for 100 m) and whether the mod affects it.

Reporting problems

Turn on DebugLog (in 1 - General) and the BepInEx log (BepInEx/LogOutput.log) will record what enemies decide, e.g. Wolf gave up the chase: no path to the target. Report problems and ideas on GitHub Issues, and include those lines.

Multiplayer

Note: Multiplayer and dedicated servers haven't been tested yet. It's built to work there, but if something seems off, please report it on GitHub Issues.

Enemy AI in an area is run by the player who "owns" that area, so every player should install the mod. If you run a dedicated server, install it there too.

  • Settings sync: When you join a server that has the mod, the server's settings are used for everyone, so enemies behave the same no matter who is nearby. Your own config file isn't changed; your settings come back when you leave. If the host changes a setting in game, it's sent to everyone right away. On a dedicated server, edit the server's config file and restart it.
  • Missing mod warning: If someone joins without the mod, the server log (and the host, in a player-hosted game) gets a message about it. A version mismatch between server and client is reported the same way.

CHANGELOG

Changelog

1.5.3

  • README: says that the mod was made with AI (Claude by Anthropic), as Thunderstore asks. The DLL carries the same note in its metadata. No gameplay changes.

1.5.2

  • README: notes that multiplayer and dedicated servers haven't been tested yet. No code changes.

1.5.1

1.5.0

  • An animal you're taming (fed, taming started) no longer counts as an enemy nearby when you try to sleep (TamingDoesntBlockSleep, on by default).

1.4.4

  • New icon.

1.4.3

  • Sea creatures (serpents) keep their vanilla circling, and land creatures keep it while swimming, instead of trying to walk to your front or back off for a run-up in the water. Their chases are still shortened.

1.4.2

  • Fixed enemies giving up mid-fight (they then re-alerted moments later, which made wolves howl again): the distance and no-path rules now wait until neither side has attacked for 5 seconds.
  • Boars and other chargers no longer walk around you after backing off for a run-up, which looked like circling; they wait at run-up distance facing you and charge as soon as their attack is usable again.
  • New DebugLog setting writes enemy decisions to the BepInEx log.

1.4.1

  • Fixed boars (and other enemies whose attack needs a run-up) taking a long time to attack again: they now wait outside their attack's minimum range, backing off first if they're too close.

1.4.0

  • Ground enemies that end up beside or behind you after attacking (e.g. boars charging past) walk back around to your front before waiting, instead of standing behind you (GroundFrontArc, also per creature).

1.3.0

  • Ground enemies give up after 6 seconds without a path to you, unless you're hitting them or they're at your base and can attack buildings (GiveUpWhenUnreachableSeconds, also per creature; Chase=Vanilla turns it off too).

1.2.0

  • Enemies that give up a chase now walk straight back to where the chase started (ReturnAfterGiveUp, on by default, also per creature).

1.1.0

  • Per-creature settings: CreatureOverrides gives specific creatures their own values, with Chase=Vanilla, Circling=Vanilla and Enabled=false shortcuts.
  • New console command bea_creatures lists nearby creatures by the names the settings use.

1.0.0

  • First release: no circling after attacks, softer circling for flyers, shorter chases, server settings sync.