Build DocFX

Hot-reloadable C# scripting for live mod prototyping for RisingV.

RisingV.Scripting is a scripting mod for V Rising that allows you to write reloadable scripts in a sandboxed domain.
It only depends on RisingV.Shared so does not need to be run from a core plugin.”

Features

  • Live reload – iterate on scripts without restarting the server
  • Sandboxing – executes inside a limited AppDomain with whitelisted assemblies
  • Diagnostics – real-time console & overlay logging for script errors
  • Command execution – run C# code from the in-game chat commands using .script run <code>

Note: This may not be the entire list—refer to the API docs for every class, interface, and extension method that RisingV.Scripting provides.

Installation

  1. Dependency – ensure RisingV.Shared is already installed.
  2. Download the latest release from Release
  3. Extract RisingV.Scripting.<version>.zip to your VRising BepInEx directory.
  4. Restart your dedicated server or client.
  5. The server or client will install the required DLLs upon first run, and then ask you to restart again.

For development in your mod, install the following:

dotnet add package RisingV.Shared
dotnet add package RisingV.Scripting

Getting started

  1. Add the RisingV.Scripting dependency to your plugin class to enable scripting support:

    // Added to your plugin class
    [BepInDependency("RisingV.Scripting")]
    
  2. Add the ScriptingEngine to your plugin's OnInitialize method:

    public override void OnInitialize()
    {
        EngineManager.AddEngine<ScripingEngine>();
    }
    

    or, if you aren't using the RisingPlugin base class you can add the engine directly:

    [BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
    [BepInDependency("RisingV.Scripting")]
    public class Plugin : BasePlugin
    {
        public override void Load()
        {
            Bootstrap.Load(p => {
                var engineManager = Bootstrap.SharedComponents.Get<EngineManager>();
                engineManager!.AddEngine<ScriptingEngine>(p);
            });
        }
    }
    
  3. Creating a new script is as simple as creating a new C# file in the BepInEx/config/<YOURMOD_GUID>/Scripts directory.

    using RisingV.Scripting.Managers;
    using RisingV.Scripting.RuntimeHost;
    using RisingV.Shared.Logging;
    using RisingV.Shared.Managers;
    using RisingV.Shared.Plugins;
    
    // Optional (namespace should match the plugin namespace or remove this line)
    namespace RisingV.Scripting.Tests;
    
    /// <summary>
    /// Sample script for testing purposes to demonstrate how it can be used.
    /// </summary>
    /// <param name="context">The script context containing the script data.</param>
    public class SampleScript(IScriptContext<ScriptData> context) : Script(context), IReloadableScript
    {
        public override void Initialize(ScriptManager manager, List<IPlugin> plugins)
        {
            Log.Info("SampleScript initialized.");
            // Called then the plugin is initializing, before any scripts are loaded.
        }
    
        public override void Load(ScriptManager manager, List<IPlugin> plugins)
        {
            Log.Info("SampleScript loaded.");
            // Called when the Shared Components are loading, after the plugin is initialized.
        }
    
        public override void Unload(ScriptManager manager, List<IPlugin> plugins)
        {
            Log.Info("SampleScript unloaded.");
            // Called when the Shared Components are unloading and before the plugin is terminated or reloading.
        }
    
        public override void Terminate(ScriptManager manager, List<IPlugin> plugins)
        {
            Log.Info("SampleScript terminated.");
            // Called when the plugin is being terminated, after all scripts are unloaded.
        }
    
        public override void Reload(ScriptManager manager, List<IPlugin> plugins, ReloadReason reason)
        {
            Log.Info("SampleScript reloaded. Reason: " + reason);
            // Called when the script is being reloaded, e.g. due to a change in the script file.
        }
    }
    

The script will be automatically compiled and loaded by the Scripting Engine. Make sure the script is marked with IReloadableScript interface to enable hot-reloading.

Configurations

RisingV.Scripting uses the RisingV.Shared.Config base class for configuration management. This allows you to define your plugin's configuration in a type-safe manner, with support for hot-reloading and easy access to configuration values.

BepInEx/configs
└── RisingV.Scripting
    └── Engines
        └── ScriptingEngine.cfg

Documentation

For a deeper dive, API reference, and design docs see https://docs.risingv.dev/scripting.

Contributing

PRs that add new functionality—or improve existing ones—are warmly welcomed. Please open an issue first if you plan a large refactor. See CONTRIBUTING.md for more information.

Community

Join the V Rising Mod Community Discord for modding support, updates, and discussions!

Discord

License

GNU GPL-3.0. See LICENSE for details.