RE:NODE

Valheim raids on a server: how events pick a target

By RE:NODE Team
11 min read


On a Valheim server, raids are rolled by the server for the whole world, then aimed at one player. Every 46 minutes the server rolls a 20% chance. If it hits, it builds the list of events the world's boss keys allow, keeps only those that fit a player who is online, out of a dungeon, in the right biome and standing within 40 metres of at least three base pieces, picks one, picks a valid player, and starts the raid where that player stands. Nobody online at a base means no raid at that base. The raids world modifier changes the odds, the playerevents switch changes whose progress decides the event, and event, randomevent and stopevent are the console commands - which, like the rest of the cheat set, need a mod to work on a vanilla dedicated server.

That model explains almost every "why did we get raided" and "why do we never get raided" question on a shared server. Here it is in full.

How the server rolls a raid#

The event system runs on the server, not on the players' machines. The roll is world-wide, so ten players online do not get ten times the raids - they get one roll every 46 minutes, shared.

hitrandom pickEvent timerevery 46 minutesChance roll20% at normal rateEligible eventsboss and creature keysValid playersonline, in base, biomeRaid startsat the player's position
How a Valheim server chooses and starts a raid

Step by step:

  1. The timer. Every 46 minutes of server time the system checks for a new event. If an event is already running, a new one replaces it.
  2. The roll. At the default rate there is a 20% chance anything happens. Most checks do nothing, which is why a quiet week is normal and two raids in an evening is bad luck rather than a bug.
  3. The pool. The server lists every event the world's global keys allow. Each event has keys that enable it and keys that retire it - more on those below.
  4. The players. For each candidate event the server looks for an online player who is in one of that event's biomes, not inside a dungeon, and near a base. Events with no valid player drop out.
  5. The pick. One event is chosen at random from what remains, then one valid player for it. The raid starts at that player's position.

Two things follow that surprise people. A raid can only start where a player is, so a base nobody is visiting cannot be attacked, however large. And the event's biome is the exact biome under the player's feet, as the minimap shows it - a base on the line between Meadows and Black Forest can get either set.

Base detection: what makes you a target#

The base check is the one that decides who gets raided on a multi-base server. A player counts as "at a base" when at least three base pieces are within 40 metres of them. Base pieces are the ones that mark an area as a player base - workbenches, fires and beds among them - not every wall and floor.

SituationCan be targeted?
Inside the main base, by the workbenchYes
Alone at a portal hut with one fireNo - fewer than three base pieces
Outpost with workbench, campfire and bedYes
In a crypt or other dungeonNo
Sailing, far from anythingNo
Inside a base in a biome no eligible event usesNo

So the player most likely to be raided is the one who spends most time near crafting stations - the builder, usually. A small mining camp with a bed, a fire and a workbench counts as a base, which is how a three-person trip to the mountains ends up defending a lean-to against drakes while the main base is untouched.

The wolf event, "You are being hunted", is the exception: it skips the base check and can find a player anywhere in the right biome.

Base pieces also work against spawns. Creatures do not spawn close to dense player structures, and raid creatures appear 40 to 80 metres from the targeted player - often outside the 64-metre red circle the map shows. On a big, dense base, a raid can be mostly creatures milling around outside the walls. That is the base doing its job, not the raid failing.

Which boss keys enable which raids#

The main raid chain follows the bosses. Each boss kill sets a key that retires one raid and enables the next. On a world-based server (the default), the world's keys decide.

EventMessageCreaturesEnabled byRetired by
army_eikthyrEikthyr rallies the creatures of the forestBoars, necksNew worlddefeated_eikthyr
army_theelderThe forest is moving...Greydwarfs, brutes, shamansdefeated_eikthyrdefeated_gdking
army_bonemassA foul smell from the swamp...Draugr, skeletonsdefeated_gdkingdefeated_bonemass
army_moderA cold wind blows from the mountainsDrakesdefeated_bonemassdefeated_dragon
army_goblinThe horde is attackingFulingsdefeated_dragondefeated_goblinking
army_gjall, army_seekersThey sought you out (seekers)Gjall, ticks, seekersdefeated_goblinkingdefeated_queen
army_charredThe undead army marchesCharreddefeated_queendefeated_fader

Alongside the chain there are side events tied to creatures and the mid-game: foresttrolls (the ground shaking, needs a troll killed), skeletons, blobs, ghosts, wolves, surtlings (needs a surtling killed) and bats (needs a bat killed). Their exact enable and retire conditions have shifted between versions, and later updates add events of their own, so treat the list as a guide to names rather than a contract. Hildir's quest has three boss events too, which end when the matching chest is returned to her.

Because each kill retires a raid as well as enabling one, the pool at any time is small - often two or three events. Killing The Elder ends the troll raids for good; killing Bonemass ends the swamp-era side events. What each key is, and how to add or remove one, is in Valheim global keys and setkey.

World-based vs player-based raids#

By default raids follow the world. Once anybody has killed Moder, everybody's base can get Fuling raids - including the newcomer who joined last night with a bronze axe. On a server that has been running a year, that makes the game unplayable for new players.

The playerevents switch fixes it. With it on, the event pool for each candidate player is built from that player's own progress - the forsaken powers they hold and the boss items they have carried - rather than the world's keys. The veteran in black metal gets Mistlands raids at their base, and the newcomer gets greydwarfs at theirs, on the same world at the same time.

bash
# Launch argument on the dedicated server-setkey playerevents

It is the single most useful setting for a server that outlives its first group, and it costs nothing for a group that progresses together. The rest of the world switches are in Valheim world modifiers and presets.

The raids modifier#

The raids world modifier scales how often events happen. It sets the EventRate key, where 100 is the default 20% chance every 46 minutes.

ValueEffect
noneNo raids at all
muchlessFar fewer raids
lessFewer raids
normalDefault
moreMore raids
muchmoreFar more raids
bash
-modifier raids less

less is the right setting for a group whose bases keep getting damaged while one player is online alone. none is the right setting for a builders' server and the wrong one for most groups - without raids, half of the game's defensive building has no purpose. Admins can also change it without a restart with setworldmodifier raids less, if their version has the world modifier admin commands.

Changing the rate never cancels an event already running. It changes the odds from the next roll.

How a raid plays out on a server#

Once started, a raid has an area - 96 metres in radius around its start point, with a 64-metre red circle on the map - and a timer, from 80 seconds for the troll event to 150 for the bigger armies. Three server behaviours matter.

The timer only runs while someone is inside. Leave the area and the event pauses rather than ending, so a raid can still be there when the targeted player comes back from a portal trip. This is deliberate - you cannot escape a raid by teleporting away - and the wolf hunt is the only event whose timer keeps running regardless.

The zone owner spawns the creatures. Valheim zones are simulated by the first player to enter them. Raid creatures spawn only while that player is in the area, and they run on that player's machine. If the zone owner has a poor connection, the whole raid rubber-bands for everyone else. Valheim server performance and lag explains zone ownership and what to do about a laggy owner.

One raid at a time. If a new event triggers while one is running, the old one ends. There is no stacking of raids across bases.

stopevent, event and randomevent#

CommandEffect
event [name]Starts the named event at your position
randomeventStarts a random event from those currently eligible
stopeventEnds the current event
code
> event army_theelder> stopevent

All three are in the devcommands set. They work in single player and for the host of a world hosted from the game. On a vanilla dedicated server they are refused, admin list or not; the Server Devcommands mod is the usual way to give them to your admins - see the Server Devcommands guide and, for the rest of the cheat set, Valheim devcommands explained.

event ignores the key requirements, so you can start a raid the world has not unlocked. That makes it the best way to test defences - and a poor joke to play on someone else's base. randomevent respects eligibility, which makes it a fair way to see what the world would actually send. stopevent is the admin's emergency brake: a raid targeting someone in the middle of a server crash or a lag spike can be ended rather than left waiting for them.

Without the mod, a vanilla admin's options are blunt: everyone leaves the area and lets the event wait, or the raid is fought out.

Planning bases around raids on a shared world#

Once you know how targets are chosen, a few habits keep raids where the group wants them.

  • Decide where raids should happen. The base with walls, a moat and the group's best fighters is the one that should collect the raids. Keep beds, fires and workbenches there, and keep the count of base pieces at portal huts and farm outposts under three.
  • Do not leave the builder alone. The player who spends hours at the workbench is the most frequent target. If they are often online by themselves, raids less stops them losing an evening's work to drakes with nobody to help.
  • Space out separate bases. Players with their own homes on the same world should keep them well apart, so one raid's 96-metre area never covers two people's builds and two zone owners. Base placement for shared servers goes into spacing and zones in detail.
  • Use density. Because creatures avoid spawning close to player structures, a compact base with defences on the outside fares better than a sprawling one with gaps. Raid creatures come from beyond the walls.

Troubleshooting raids#

"We never get raided." Check raids is not set to none, that someone is spending time within 40 metres of three base pieces, and that the world has a raid in its pool. A world that has killed every boss up to Fader has few events left.

"The newcomer keeps getting Plains raids." World-based raids. Turn on playerevents.

"The raid is attacking our mining camp, not the base." The camp has a bed, fire and workbench, so it counts. Fewer than three base pieces at temporary camps keeps them off the list.

"The raid never ends." Nobody is inside the area, so the timer is paused. Go back and finish it.

"We got trolls after killing The Elder." That is a natural troll spawn, not the event; foresttrolls is retired by defeated_gdking. Check listkeys on a copy of the world if you are unsure.

"The raid creatures are rubber-banding." Zone ownership. See the tip above.

On RE:NODE the console in the panel lets you save before testing a raid with an admin mod, backup slots let you lock a copy of the world first and restore it with one button if a test goes wrong, and the world modifier arguments, -setkey playerevents included, are fields on the Startup tab.

FAQ#

How often do raids happen in Valheim?

At the default rate, the server checks every 46 minutes and has a 20% chance of starting an event. That averages one raid every few hours of play, with long gaps being normal.

Can a Valheim base be raided while everyone is offline?

No. Raids start at an online player's position, so an empty base cannot be attacked. Structures only take damage when creatures are near them, and creatures only run while a player's machine is simulating the zone.

Who gets raided when several players are online?

A random valid player for the chosen event: online, outside dungeons, in one of the event's biomes and within 40 metres of at least three base pieces.

How do I stop a raid on a dedicated server?

stopevent, but it needs devcommands, which a vanilla dedicated server refuses. With Server Devcommands installed, admins can use it. Otherwise fight it out or wait outside the area.

Does turning raids to none cancel the current raid?

No. It changes the odds from the next roll. The raid in progress runs until its timer ends.