bbar-ServerDiceRoll icon

ServerDiceRoll

A Valheim server mod to add shared dice roll functionality.

Last updated 3 months ago
Total downloads 471
Total rating 1 
Categories Mods Tweaks Server-side Utility Hildir's Request Update
Dependency string bbar-ServerDiceRoll-1.0.1
Dependants 1 other package depends on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

Valheim Server Dice Roller

A Valheim server mod to add shared dice roll commands that show up in player's message hud.

Usage

With this plugin enabled on the server, players can use the following three commands from the chatbox. Server operators can customize the prefix and name of each command, so check with them if you are having trouble.

!roll <die size>

  • Rolls a die between 1 and <die size>.
  • If no size is specified a default value is used (by default, 100, but this is configurable).
  • Examples:
    • !roll -> Soandso rolled a 100 sided die and got a 73!
    • !roll 20 -> Soandso rolled a 20 sided die and got a 10!

!award <list of recipients> <item description>

  • Randomly picks between the names specified in <list of recipients>.
  • Names should be comma seperated and cannot have spaces in them. They don't have to be in-game player names. For example: "Alice,Bob,Charlie,Dave,Ernie".
  • Optionally, anything that comes after the list of recipients will be passed along as a description of the item(s) being awarded.
  • Examples:
    • !award Alice,Bob,Charlie ->
      Soandso asks Odin to decide if Alice, Bob, or Charlie is worthy...
      Odin picks Alice!
    • !award Alice,Bob,Charlie some extra silver ->
      Soandso asks Odin to decide if Alice, Bob, or Charlie is worthy of "some extra silver"...
      Odin awards "some extra silver" to Charlie!

!results

  • Re-sends the most recent history back to the player who issued the command.
  • Example:
    • !results ->
      Soandso rolled a 100 sided die and got a 92!
      Johndoe rolled a 100 sided die and got a 36!

Features

image

A feature common to MMO's is some kind of "dice roll" command, to give people a fair way to randomly decide on who gets a rare piece of loot. This mod adds this to a server in a way that is usable by all players. There are other mods out there that do this client-side, but having the rolls handled by the server allows the server to serve as a neutral, trustworthy 3rd party (meaning, you don't have to rely on another player's client-side roll mod being honest).

Configuration

All of the options are fully documented in the config file that the plugin generates. Here are some extra notes:

Colors

Options in the [Color] section allow you to customize the color of messages by their type. You can use HEX color codes (RGB, and RGBA), or the following color names: black, blue, green, orange, purple, red, white, and yellow. Setting the option to an empty string disabled color overriding and uses the Valheim default. For more information see Unity's RichTextColor docs.

Message Location

Under the hood this mod uses the Valheim MessageHud to send messages to clients. The two possible locations for messages (at time of writing these docs) are TopLeft and Center. Both have tradeoffs.

The TopLeft option is where Valheim shows messages like "Unloading unused assets", and "Saving...". The Center option is where Valheim shows messages like "The forest is moving".

TopLeft messages are more out of the way (i.e. less annoying to other players), but they fade fast and are harder to read. Center messages, conversely, take up more screen space and are easier to read, but are (probably) more annoying for uninvolved players and can only show 5 lines at a time.

The default is TopLeft as it is the least intrusive option. But if you are playing on a server with just friends, give Center a try.

Why can't roll messages go to the chatbox? That would obviously be better!

Unfortunately it is not possible for the server to send chats to clients in Valheim (at least not without adding dependencies on other mods), as all chats must come from a real/authenticated user. If you can figure out a workaround, submit a PR or let me know.

Installation

BepinEx for Valheim is required for this plugin to work.

Install from your favorite mod manager, or manually by following these instructions:

  1. Download and extract the build artifact for the latest release
  2. Place the bbar.Mods.ServerDiceRoll.dll file into <GameDirectory>\Bepinex\plugins
  3. The first time the game starts with the plugin loaded, it will generate a config file: <GameDirectory>\BepinEx\config\bbar.Mods.ServerDiceRoll.cfg
  4. Open the cfg file to change configuration as needed. Any manual changes to that file will require a restart. The plugin is also compatible with the BepinEx configuration manager.

Quick Links

Attributions