Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
05. Console and Spawning
Updated 2 hours agoFor testing, for a creative world, or for getting a look at something without grinding for it.
Opening the console
- Press F5 to open the console.
- Type
devcommandsand press Enter. Valheim repliesDev commands: True. helplists everything available.
devcommands has to be re-enabled each time you start the game.
Prefab names
These are what MidgardPlus adds. Names are case sensitive.
| Prefab | What it is |
|---|---|
MP_CompanionHorn |
The Companion Horn item |
MP_Companion |
The companion creature itself |
MP_ChestReinforced |
The Reinforced Chest, 8x4 |
Giving yourself the horn
spawn MP_CompanionHorn 1
This is the one worth using. It drops the horn at your feet; pick it up, equip it and use it, and you get a proper companion with a name, the right star level, health scaled to your settings and a follow target already set.
Spawning a companion directly
spawn MP_Companion 1
A companion spawned this way arrives already tamed, because the prefab is built that way. It will not have a name, a scaled health pool, a star level from your settings, or you as its follow target, because all of that is applied by the horn rather than by the prefab.
Use the horn for a companion you intend to keep. Use this for a quick look at one.
To spawn one with stars anyway, the third argument is the level:
spawn MP_Companion 1 3
Level 3 is two stars. Valheim counts levels from 1, so level 1 is no stars.
Spawning the chest
spawn MP_ChestReinforced 1
Normally you build it with the hammer under Furniture: 10 Fine Wood and 4 Iron at a Workbench. Both materials come back when you take it down.
The recipes MidgardPlus adds
These are craftable, not spawn-only. Vanilla makes all three find-only, which is the whole point of adding them.
| Item | Station | Level | Cost | Yield |
|---|---|---|---|---|
| Chain | Forge | 2 | 4 Iron | 1 |
| Iron Nails | Forge | 1 | 1 Iron | 20 |
| Tar | Workbench | 3 | 8 Resin, 4 Coal, 2 Bloodbag | 4 |
Other commands worth knowing
| Command | What it does |
|---|---|
spawn <prefab> [amount] [level] |
Spawn anything by prefab name |
tame |
Tame every tameable creature nearby |
killall |
Kill every creature nearby |
pos |
Print your coordinates |
goto <x> <z> |
Teleport |
debugmode |
Free camera and flight, Z toggles fly |
removedrops |
Clear item drops lying around |
Vanilla prefab names for gear you might want to test a companion with: SwordIron,
ShieldIronTower, HelmetIron, ArmorIronChest, ArmorIronLegs, CapeWolf, SwordSilver,
ArmorPaddedCuirass. Drop any of them in a companion's bag and they will put it on.
If a spawn command does nothing
- Check spelling and capitals.
mp_companionwill not work. - Make sure
devcommandsis on for this session. - Custom prefabs only exist once the mod has registered them. Confirm
Registered companion creature.is inBepInEx/LogOutput.log.