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.
ValheimTwitch
Twitch interacts with Valheim through Streamer.bot: on-screen notifications, mob & item spawning with viewer-named enemies, native raid events, in-game /request item requests, and Twitch viewer portrait build pieces.
By CodeWithTD
| Date uploaded | 2 days ago |
| Version | 0.5.0 |
| Download link | CodeWithTD-ValheimTwitch-0.5.0.zip |
| Downloads | 13 |
| Dependency string | CodeWithTD-ValheimTwitch-0.5.0 |
This mod requires the following mods to function
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.2351ValheimModding-Jotunn
Jötunn (/ˈjɔːtʊn/, 'giant'), the Valheim Library was created with the goal of making the lives of mod developers easier. It enables you to create mods for Valheim using an abstracted API so you can focus on the actual content creation.
Preferred version: 2.30.2README
ValheimTwitch
Bring your Twitch chat into Valheim. Follows, subs, raids and channel point rewards show up in your game, and viewers can spawn enemies, start raids and request items - all through Streamer.bot.
What it does
- Twitch alerts in-game: follows, cheers, subs, gift subs, raids and channel point redemptions appear as on-screen messages.
- Spawn enemies: a viewer can summon a monster (or a specific creature) for everyone to fight. Optionally the creature is named after the viewer.
- Spawn items: give yourself or drop items into the world.
- Raids: start a native Valheim raid - randomly, or pick one by name.
/requestin chat: players type/request <item>in-game and Streamer.bot decides what happens (grant the item, charge channel points, ...).- Viewer portraits: temporarily disabled while the piece is being rebuilt.
Requirements
- Valheim with the Thunderstore Mod Manager (or r2modman)
- BepInExPack for Valheim (installed automatically as a dependency)
- Jotunn (
ValheimModding-Jotunn, installed automatically as a dependency) - Streamer.bot with its WebSocket server enabled
Installation
- Install the mod from Thunderstore with the Mod Manager. Its dependencies come along automatically.
- Start Valheim with Start modded.
- Set up Streamer.bot (see below).
The mod's settings are in BepInEx/config/CodeWithTD.ValheimTwitch.cfg. You
only need to change them if your Streamer.bot setup is different from the
defaults.
Streamer.bot setup
- In Streamer.bot, open the WebSocket server settings (under its API or Servers settings) and turn the server on.
- Keep the default host (
127.0.0.1) and port unless you've changed them. The port must match the one in the mod's config. - Connect your Twitch account so Twitch events reach Streamer.bot.
To check it works, start Valheim and look for a line saying Streamer.bot is
connected in BepInEx/LogOutput.log. You can also see the connection listed in
Streamer.bot's WebSocket tab.
Quick test
Create an action in Streamer.bot with a C# sub-action and this code, then run the action. A message should appear on screen in Valheim:
using System;
public class CPHInline
{
public bool Execute()
{
string json = "{\"action\":\"show_message\",\"title\":\"HELLO\",\"message\":\"Twitch is connected!\"}";
CPH.WebsocketBroadcastJson(json);
return true;
}
}
Commands
Streamer.bot sends commands to the mod as JSON. Use the same C# sub-action pattern as above and change the JSON:
| What you want | Example JSON |
|---|---|
| Show a message | {"action":"show_message","title":"RAID!","message":"42 viewers"} |
| Show a big centre message | {"action":"show_notification","message":"RAID INCOMING!"} |
| Spawn monsters | {"action":"mob_spawn","mob":"Greydwarf","amount":5,"level":3,"viewer":"Andilippi"} |
| Spawn one specific enemy | {"action":"enemy_spawn","enemy":"Troll","amount":1,"level":2} |
| Give items | {"action":"item_spawn","item":"Wood","amount":10} |
| Start a raid | {"action":"raid_start"} or {"action":"raid_start","raid":"wolves"} |
| Stop the raid | {"action":"raid_stop"} |
vieweris optional. When set, the spawned creatures are named after the viewer ("Andilippi's Troll").levelis optional for monsters: 1 = normal, 2 = one star, 3 = two stars.- Monster and item names are listed in SPAWNS.md.
- Raid names include
wolves,foresttrolls,skeletonsandarmy_eikthyr. An unknown name is rejected and the log shows the full list.
Item requests (/request)
Players can type /request <item> in the in-game chat. Streamer.bot receives
the item name, a full stack amount and the player's name, and runs an action
you set up:
- Create an action named
ValheimItemRequest(or whatever name you set under[Requests] ActionNamein the config). - Add a C# sub-action that gives the item back:
using System;
public class CPHInline
{
public bool Execute()
{
string item = args["item"].ToString();
string amount = args["amount"].ToString();
string json = "{\"action\":\"item_spawn\",\"item\":\"" + item + "\",\"amount\":" + amount + "}";
CPH.WebsocketBroadcastJson(json);
return true;
}
}
Add a cooldown or channel point cost in Streamer.bot if you want to limit requests. The mod doesn't limit them itself.
Settings
The main options are in BepInEx/config/CodeWithTD.ValheimTwitch.cfg:
[WebSocket]- connection to Streamer.bot (host, port, optional password).[Notifications]- turn the on-screen Twitch alerts on or off.[Spawning]- how many monsters or items one command can create.[Raids]- turn raid commands on or off.[Requests]- turn/requeston or off, and choose its action name.
Troubleshooting
- Nothing happens in-game: check that Streamer.bot's WebSocket server is on
and the port matches the config. Look for "Connected to Streamer.bot" in
BepInEx/LogOutput.log. - Spawns or raids don't work: these only run on the host (the player running the world or server). Clients can't start them.
- Still stuck? Send your
LogOutput.logwhen reporting an issue.
Credits and more
- Technical details, build steps and the full command reference are in TECHNICAL.md.
- The full list of spawnable monsters, enemies and items is in SPAWNS.md.
- Changes are listed in CHANGELOG.md.
CHANGELOG
Changelog
All notable changes to ValheimTwitch are documented here.
0.5.0
- Portraits reworked around one blank piece + per-piece viewer selection
(fixes placed portraits being invisible on Valheim 1.0 / Unity 6, where
the old per-viewer prefab activation no longer worked):
- One generic VT Portrait piece in the hammer's furniture menu. Place it blank, then press E on it to open the viewer picker and click a registered viewer; the piece immediately shows their avatar.
- The assignment is stored on the piece's own networked ZDO (vanilla
ZNetView.LoadFieldspersistence), so it survives reloads and syncs to every player with the mod; any player with the mod can reassign it. viewer_portraitnow registers/refreshes a viewer in the picker list (name + avatar URL) instead of creating a per-viewer build piece;viewer_portrait_removedrops a viewer from the list. Placed portraits keep showing their assigned viewer until reassigned or removed.[Portraits] MaxPortraitsnow caps the picker list (registered viewers), not build pieces.- The piece has a configurable build cost via
[Portraits] Cost(defaultWood:2, LeatherScraps:2, Raspberry:1, Mushroom:1, Blueberries:1); materials are refunded when removing it with the hammer. - The piece looks like a wooden tile (vanilla wood material, ItemDrawers style) with the avatar shown on the front; the viewer picker is styled after XPortal's panel (woodpanel, AveriaSerif, ValheimOrange header, dark dropdown-style rows).
- Diagnostics: placement, restore and avatar-download events are logged.
- Note: portrait pieces placed with 0.4.0 (per-viewer prefabs) will not restore in worlds saved with that version; remove them with the hammer before updating (they were invisible anyway on 1.0).
0.4.0
- Viewer-named enemies: optional
"viewer"field onmob_spawn/enemy_spawnwrites the viewer's name to the vanilla synced hover-name override (the tamed-pet name field), so every player sees e.g. "Andilippi's Troll" above the enemy's health bar. Rich-text characters are stripped from viewer names. - Twitch viewer portraits as buildable pieces:
viewer_portraitcommand ("name"+"url", https only): registers a framed "VT Portrait: <viewer>" piece in the hammer's furniture menu (free to build, rotates like any piece). The avatar is downloaded from the URL (e.g. the Twitch CDN image from Streamer.bot's Get User Info sub-action) and applied to the shared material.- Placed portraits are networked ZDOs, so they persist with the world;
the list of portrait pieces is kept in
BepInEx/config/CodeWithTD.ValheimTwitch.portraits.jsonand restored on world load. Remove placed copies with the hammer, andviewer_portrait_removedrops a viewer's piece from the menu. [Portraits] Enabled(default on) and[Portraits] MaxPortraits(default 10) config; portraits show for the host (co-op clients without the mod cannot resolve the custom prefab).
0.3.0
- Native Valheim raid events (host/server only; raids are shared world state
driven by the game's own
RandEventSystem, so HUD messages, music, spawners, durations and network sync are all vanilla behavior):raid_startcommand: a random native raid (the game's own roll, respecting biome/base/progression conditions) or a forced specific raid by name; rejected while another raid is in progress.raid_stopcommand: stops the raid currently in progress.[Raids] Enabledconfig gate.
- In-game
/request <item>chat command: resolves the item (multi-word requests like "fine wood" work), looks up a full stack size, and triggers a Streamer.bot action by name (WebSocketDoActionrequest) with the arguments%item%,%amount%and%player%- bind channel point costs, cooldowns, item granting, etc. in Streamer.bot. Action name is configured via[Requests] ActionName; no mod-side rate limit by design. - Root README.md restored (it had been overwritten with SPAWNS.md content).
0.2.0
- Manifest metadata refresh for Thunderstore.
0.1.0
- Initial Phase 1 baseline.
- Streamer.bot WebSocket client (Hello handshake, OBS-style challenge authentication, event subscriptions, auto-reconnect, graceful shutdown).
- Notifications through Valheim's own MessageHud (local player only, the
game's own font, position and timing):
show_messagecommand: top-left general text (title + message).show_notificationcommand: large yellow center-screen message.
- Automatic top-left notifications for Twitch follows, cheers, subs, resubs, gifted subs, gift bombs, raids and channel point redemptions.
- Spawning, executed only with host/server authority so spawned entities are
networked for all players:
mob_spawncommand: mob types (e.g. Greydwarf covers greylings, greydwarfs, shamans and brutes), variants and mixed levels rolled per creature, optional level ceiling.enemy_spawncommand: one specific enemy prefab, optional level.item_spawncommand: items into the inventory or dropped on the ground.
- Curated vanilla prefab catalog (bosses excluded); unknown names rejected, amounts clamped to configured limits.
- Configuration for WebSocket connection settings, spawning limits and debug logging.
- Thunderstore packaging (
package.ps1), with direct Mod Manager profile deploy for testing.
Not implemented yet
- Spawn and raid commands on a pure client (requires a server-side component and an RPC protocol; currently rejected by design).
- Bosses in the spawn catalog.