Valheim Night Sanctuary
A lightweight BepInEx mod that keeps late-game night spawns out of your starting area. You define a sanctuary by distance from the world center or by biome. Inside it, night spawns from a higher progression tier than the local biome are blocked.
The mod is one Harmony patch on the world spawner. It runs only at night and only inside the sanctuary. It adds no prefabs, RPCs or save data.
Features
- Zone modes. Choose where the sanctuary applies:
CenterRadius: every zone within a set distance of the world center (default 1500 m).BiomeOnly: every zone in the selected biomes, for example the Meadows.WholeWorld: the whole map.
- Progression cap (
CapAtCurrentBiome). At night, a spawn that requires a boss kill is blocked when that boss belongs to a higher tier than the biome the spawn happens in. Each biome keeps its own native night spawns, so no zone goes empty. - Adjustable difficulty (
CapWithTierOffset). The same cap, raised byBiomeTierOffsettiers. With an offset of 1, the Meadows also get Eikthyr's night spawns (Greydwarfs); with 5, everything up to Yagluth's (Fulings). See How the Cap Works. - Non-destructive. The mod never adds, removes or reorders spawn entries and never edits saved spawn timers. During each spawn check it lowers one runtime flag on the blocked entries and restores it right after. Spawn lists stay exactly as the game or other mods left them.
- Live toggle.
ToggleModremoves or re-applies the patch at once. No restart needed.
Not affected: daytime spawns, raids (random events), fixed spawners in locations and dungeons, spawner structures, and creatures that already exist.
How the Cap Works
Some night spawns start only after a boss is defeated. For example, after Yagluth dies, groups of Fulings roam the Meadows at night. The mod gives each biome and each boss a tier and compares them.
Biome tiers follow the progression order:
| Tier | Biome |
|---|---|
| 0 | Meadows, Ocean |
| 1 | Black Forest |
| 2 | Swamp |
| 3 | Mountain |
| 4 | Plains |
| 5 | Mistlands |
| 6 | Ashlands |
| 7 | Deep North |
Boss tiers. A boss has the tier of the biome that its defeat opens up. Eikthyr opens the Black Forest, so his key has tier 1. This is why Yagluth, the Plains boss, has tier 5. The table lists the night creatures of the world spawner that need a boss key (Valheim 1.0.15):
| Tier | Boss | Key | Night spawns it unlocks (biomes they spawn in) |
|---|---|---|---|
| 1 | Eikthyr | defeated_eikthyr |
Greydwarf, alone and in groups of 2–3 (Meadows) |
| 2 | The Elder | defeated_gdking |
Greydwarf Brute and Greydwarf Shaman (Meadows); Draugr, only in misty weather (Meadows, Black Forest, Mountain, Plains) |
| 3 | Bonemass | defeated_bonemass |
Skeleton (Meadows, Black Forest, Swamp, Mountain, Plains) |
| 4 | Moder | defeated_dragon |
none |
| 5 | Yagluth | defeated_goblinking |
Fuling group of 3 (Meadows, Black Forest, Mountain) |
| 6 | The Queen | defeated_queen |
Seeker (Meadows, Black Forest, Swamp, Mountain, Plains); Seeker Brood and Tick (Mistlands) |
| 7 | Fader | defeated_fader |
Charred Warrior and Charred Marksman (Meadows, Black Forest, Swamp, Mountain, Plains) |
The rule. Inside the sanctuary at night, a spawn is allowed only when the tier of its boss is not higher than the tier of the zone's biome. Spawns without a boss key, or with a key that is not in this table, are always allowed, so every biome keeps its native night creatures.
CapWithTierOffset raises the zone's tier by BiomeTierOffset, up to 7. The offset counts bosses, not biomes. In the Meadows (tier 0):
BiomeTierOffset |
Night spawns this offset adds in the Meadows |
|---|---|
| 0 | none (same as CapAtCurrentBiome) |
| 1 | Greydwarfs (Eikthyr) |
| 2 | Greydwarf Brutes and Shamans, Draugr in mist (The Elder) |
| 3 | Skeletons (Bonemass) |
| 4 | nothing new (Moder unlocks no night spawns) |
| 5 | Fulings (Yagluth) |
| 6 | Seekers (The Queen) |
| 7 | Charred (Fader); nothing is blocked |
In other biomes the count starts from that biome's tier. For example, a Black Forest zone (tier 1) with an offset of 1 allows spawns up to tier 2 (The Elder).
The sanctuary check uses the center of each 64 m × 64 m zone, so the border follows the zone grid.
Installation
Mod manager (recommended)
- In Gale search for Valheim Night Sanctuary and install it. The manager also installs
BepInExPack_Valheimif it is missing. - Start the game once from the mod manager to create the config file.
Manual
- Install
BepInExPack_Valheim. - Copy
Valheim_Night_Sanctuary.dllto<Valheim>/BepInEx/plugins/Valheim_Night_Sanctuary/. - Start the game once to create the config file.
Server
Install BepInExPack_Valheim, ConditionalConfigSync and this mod on the server. Edit the settings in the server's config file. Players receive them when they connect.
Configuration
File: BepInEx/config/com.lotrig.valheimnightsanctuary.cfg. Changes to the file apply while the game runs. If BepInEx.ConfigurationManager is installed, you can also change the settings in game (F1). In multiplayer, the server's file applies (see Multiplayer).
| Section | Key | Default | Description |
|---|---|---|---|
| 1 - General | ToggleMod |
true |
Enables the mod. Applies immediately. |
| 2 - Zone Detection | SanctuaryMode |
CenterRadius |
Which zones are sanctuary: CenterRadius, WholeWorld or BiomeOnly. |
| 2 - Zone Detection | SanctuaryRadius |
1500 |
Radius in meters around the world center (0, 0, 0). Range 0–10500. Used by CenterRadius. |
| 2 - Zone Detection | TargetBiome |
Meadows |
Biomes that are sanctuary. Used by BiomeOnly. Separate several biomes with commas, for example Meadows, BlackForest. |
| 3 - Night Logic | SanctuaryProgressionMode |
CapAtCurrentBiome |
CapAtCurrentBiome: block out-of-tier night spawns inside the sanctuary. CapWithTierOffset: the same cap, raised by BiomeTierOffset tiers. Vanilla: no change. |
| 3 - Night Logic | BiomeTierOffset |
0 |
How many boss tiers above the zone's biome are allowed: 0 = none, 1 = one more boss, and so on. In the Meadows, 5 allows everything up to Yagluth's Fulings. Range 0–7; 7 = no limit. Used only by CapWithTierOffset. See How the Cap Works. |
Multiplayer
Valheim runs creature spawning on a client, not on the server. The player who controls a zone (usually the first player to arrive there) spawns its creatures for everybody. The mod takes effect in that player's game.
- Single player needs only this mod. Your own config file applies.
- For multiplayer, install ConditionalConfigSync with this mod, on the server and on every client. The server's config file then applies to everybody: the server sends its values to each player on connect and after every change, and a player's own values return after they disconnect. The server rejects players without compatible copies of both mods.
- With ConditionalConfigSync installed, you can join only servers that run both this mod and ConditionalConfigSync.
- Without ConditionalConfigSync, nothing is synced or checked: each player's own config applies in the zones they control, and players without the mod spawn vanilla creatures there.
- Spawn rules are world rules. While ConditionalConfigSync is active, the server always owns every setting of this mod, and
SyncPolicy.cfgcannot hand one to the players. - If ConditionalConfigSync causes problems, the server admin can remove it from the server and keep this mod. Players must then remove it too, because with it they cannot join such a server. The easiest way is to share a new modpack code (for example a Gale profile code) without it. After that, nothing is synced or checked.
- A dedicated server does not spawn creatures in zones. Its copy of the mod holds the config and runs the version check.
In single-player you control every zone, so no extra setup is needed.
Compatibility
- Built for Valheim 1.0.15 (network version 40) and BepInEx 5.4.23.
- The mod does not change spawn lists. Entries added by spawn-editing mods such as Spawn That! are filtered by the same rule as vanilla entries. Use with Spawn That! and Spawner Tweaks has not been tested yet.
- Optional: ConditionalConfigSync 1.x, version 1.0.9 or later (shudnal), for config sync and the version check in multiplayer. With an older version, the mod logs a warning and keeps its settings local. With version 2.0 or later, it logs a warning and still tries; if that fails, the settings stay local.
Troubleshooting
- The mod logs a warning when the settings leave the sanctuary empty:
SanctuaryRadiusis 0, orTargetBiomeis None inBiomeOnlymode. It logs an info line whenBiomeTierOffsetis 7 inCapWithTierOffsetmode, because then no spawn is blocked, and whenBiomeTierOffsetis above 0 inCapAtCurrentBiomemode, because then the offset is ignored. - To see which spawns the mod blocks, set
LogLevels = Allunder[Logging.Disk]inBepInEx/config/BepInEx.cfg.LogOutput.logthen gets oneBlocked night spawnline for each blocked spawn entry and zone.
Building from Source
You need a current .NET SDK.
- Copy
.env.exampleto.envand setVALHEIM_DIR(the folder that containsvalheim_Data) andMOD_DIR(the folder that containsBepInEx/). The build uses the nearest.envin the project folder or any folder above it..envis git-ignored. - Run
dotnet build Valheim_Night_Sanctuary.csproj, and add-c Releasefor a release build.
-p:ValheimDir=... and -p:ModDir=... override the .env values. After a build, the DLL is copied to <MOD_DIR>/BepInEx/plugins/Valheim_Night_Sanctuary/ if that folder exists.