Risk of Rain 2 Modding Wiki (2024)

This tutorial outlines the basic steps of how to create an item, use 3d assets, and implement its behaviour.

The boilerplate mod implements a very simple item, so using it as a reference point is useful.

ItemAPI

ItemAPI is the submodule of R2API that manages the registration of custom Items, Equipment, and their respective ItemDisplays. When using it you should also declare a dependency to it at the top of your class inheriting from BaseUnityPlugin by adding the attribute [BepInDependency(ItemAPI.PluginGUID)]

To add an item to the game, a mod maker will have to call the ItemAPI.Add(CustomItem item) or its equipement counterpart, ItemAPI.Add(CustomEquipment item) method. Once the method is called, a boolean will be returned by ItemAPI to indicate the successful registration of the Item/Equipment. Note that the actual item will be added at the initialisation of the relevant catalog at a later time and until then it will not have an ItemIndex/EquipmentIndex assigned.

CustomItem / CustomEquipment is a class that holds 2 variables:- An ItemDef / EquipmentDef: These are classes from the game code, which basically hold all the needed informations for the game to define an item or an equipment, its name, its tier, the text that will show up when you look at its logbook entry, and so on. To create an instance of this class, use ScriptableObject.CreateInstance<ItemDef>().- An array of ItemDisplayRule: This allows to define one rule, or multiple rules that will dictate where the item 3d model will show up on the survivors.

Unity assets

TODO: Ideally a dedicated page with a tutorial on how to create and export assets that can be linked from anywhere else would be better. For now keeping the item asset example here.

Risk of Rain 2 uses Unity Version 2019.4.37, so let's download that and install it.I did an .unitypackage out of my Rampage mod, that you can download here, it'll serve as a base for this part.

Launch the editor and create a new project.Once that done, double click the .unitypackage, it should make a popup, every files should be checked by default, press Import, once its imported, you should see various new files in your Assets/ folder.

Click on Window -> PackageManager and search for AssetBundleBrowser and install it, if not already done so.

Let's start with the Import/ folder.As you can see when going into the Import/belt/ folder, a prefab called is already configured to be included in a future exampleitemmod assetbundle :

Risk of Rain 2 Modding Wiki (1)Same goes for the icon located in the Import/belt_icon/ folder :

Risk of Rain 2 Modding Wiki (2)

You can change the name of the future assetbundle by selecting New on the dropdown menu when clicking on it.

Once all the assets you wanted to package are correctly assigned an assetbundle, simply right click on the window explorer of Unity and click on AB Make, it'll be created in the Assets/AssetBundle folder.

Risk of Rain 2 Modding Wiki (3)

Risk of Rain 2 Modding Wiki (4)

Now that we have our assetbundle, we can finally do the best part, the code. ;)

Building from source

  • Clone / Download as zip the Boilerplate Item Solution
  • Open CustomItem.sln
  • The code is honestly pretty straight forward, though there is one thing to do still :

Importing the assetbundle into the Visual Studio Project :

  • Right click the project name in the solution explorer
  • Add
  • Existing item
  • Add the assetbundle
  • Properties of assetbundle
  • Select Embedded resource

Risk of Rain 2 Modding Wiki (5)

Then, in the Assets.cs file, make sure that the namespace and the filename of the assetbundle is correctly set.

using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("CustomItem.rampage"))

You can now compile and test your plugin !

Item Behavior

Writing code is what makes any item exhibit a behavior, spawn any effects, etc.

Below are some APIs or source code methods that are likely to be used or hooked for implementing an item's behavior:- R2API.RecalculateStats for modifying character stats- RoR2.GlobalEventManager.OnHitEnemy for item procs- RoR2.GlobalEventManager.OnCharacterDeath for on-kill procs- RoR2.HealthComponent.TakeDamage for damage modifying effects- RoR2.EquipmentSlot.PerformEquipmentAction for activating an equipment

If your item can represent multiple states, .e.g, active and on cooldown, you will need an accompanying ItemBehavior component attached to the character's body game object. The game provides two such mechanisms that are similar in functionality.

RoR2.CharacterBody.ItemBehavior

This class gives you access to two fields:- body, which is the character owning this behavior- stack, which is the number of stacks of the related item

public class CustomItemBehavior : CharacterBody.ItemBehavior{ private void Awake() { // This is important because it prevents OnEnable from getting called // before `this.body` has been assigned a value. If you skip this, you // need to null check for it in OnEnable if you need it. base.enabled = false; } private void OnEnable() { // Any initialisation logic, null check for `this.body` as necessary // `this.stack` is still unassigned at this point so use `this.body.inventory` } private void FixedUpdate() { // logic } private void OnDisable() { // Any clean-up logic, null check for `this.body` as necessary }}

To activate this behavior, hook on RoR2.CharacterBody.OnInventoryChanged and do an inventory check to add the component.

On.RoR2.CharacterBody.OnInventoryChanged += CharacterBody_OnInventoryChanged;private void CharacterBody_OnInventoryChanged(On.RoR2.CharacterBody.orig_OnInventoryChanged orig, CharacterBody self){ if (NetworkServer.active) { // Setting the behavior stacks to 1 or 0 may be more appropriate // by checking if it exists in the inventory at all. self.AddItemBehavior<CustomItemBehavior>(self.inventory.GetItemCount(customItemDef)); } orig(self);}

RoR2.Items.BaseItemBodyBehavior

This approach also gives you access to body and stack and it's handled in an automatic way where you don't have to manually add or remove the component. This only requires a little bit of boilerplate to achieve.

First of all, you need to add the SearchableAttribute to your assembly so any item behaviors in your mod can be detected.

using BepInEx;using R2API;[assembly: HG.Reflection.SearchableAttribute.OptIn]namespace MyMod{ [BepInDependency(ItemAPI.PluginGUID)] [BepInPlugin(PluginGUID, PluginName, PluginVersion)] public class MyMod : BaseUnityPlugin // etc}

Then implement the behavior as follows.

public class CustomItemBehavior : BaseItemBodyBehavior{ [BaseItemBodyBehavior.ItemDefAssociationAttribute(useOnServer = true, useOnClient = false)] public static ItemDef GetItemDef() { return customItemDef; } // Any other lifecycle methods you need, such as OnEnable, FixedUpdate, etc.}

It is the method GetItemDef that ensures the game maps this behavior to a certain item. The ItemDefAssociationAttribute declares whether this component is to be handled either by the server, clients, or both. In the majority of the cases due to handling buffs, spawning game objects, etc, just the server is what is needed.

Item tags are used by droptables to either require or ban specific categories of items from being selected as loot. The following is a list of the uses of any item tags, compiled by RandomlyAwesome:- AIBlacklist means enemies aren't allowed to have it, in practice it means Scavengers or Artifact of Evolution can't roll for it + some (but not all) ItemStealController behavior is disabled by default- BrotherBlacklist means that specifically Mithrix isn't allowed to have it, usually it's on things that can softlock his fight like tougher times.- CannotSteal prevents being taken by ItemStealController- CannotCopy means things that inherit an inventory (turrets minions etc) won't copy it from their master- CannotDuplicate prevents that item from showing up in 3D printers- WorldUnique items won't show up in any drop tables/random drops (unless manually added)- LowHealth adds the health threshold marker to your health bar- Scrap is prioritised for things that consume items, PriorityScrap is used before Scrap- Cleansable is old/unimplemented behavior for cleansing pools- Gamemodes can remove items with specific tags from the pool, InteractableRelated and ObliterationRelated are disabled in Simulacrum- The rest are pure categorisation, specific drop tables might exclude items with relevant tags. Damage, Healing, and Utility have category chests, the rest don't.

Risk of Rain 2 Modding Wiki (2024)

FAQs

Is modding allowed in Risk of Rain 2? ›

Modding the game is currently possible on PC. This page serves as an entry into the world of Risk of Rain 2 modding and installing mods. The Developer Console can be accessed by hitting Ctrl + Alt + ` on the US key layout. The modding wiki can be found here.

What is the best mod manager for Risk of Rain 2? ›

A simple and easy to use mod manager for Valheim, Risk of Rain 2, Dyson Sphere Program, BONEWORKS, and many other games.

How do I get r2modman? ›

First things first, download r2modman from its GitHub page. For Windows, you would want to get r2modman-Setup-VERSION.exe or r2modman-VERSION.exe . The former installs the mod manager to your system, while the latter simply runs r2modman without any sort of installation.

Is r2modman the same as Thunderstore? ›

ok so R2modman is a dolar store non Overwolf version of Thunderstore mod manager. Originally posted by Gombeczka: ok so R2modman is a dolar store non Overwolf version of Thunderstore mod manager. Pretty much this.

What does r2modman do? ›

It's quite simple really, a mod manager is an application to make it easier to control which mods you have installed. You can choose to update, enable/disable or even uninstall mods with a simple click, all whilst keeping it available on another profile.

How to mod Risk of Rain 2 without mod manager? ›

Installing Mods on your Client Manually
  1. Open Steam and Navigate to your Library.
  2. Right Click Risk of Rain 2 and navigate to Manage > Browse local files.
  3. Navigate to BepInExPack > BepInEx > Plugins.
  4. Copy your mod folders here.
  5. Your done! Your game will now launch with your installed mods.

Can you use r2modman for Lethal Company? ›

The Thunderstore.io mod manager is also an option, but it is essentially the exact same thing just with ads, so r2modman is preferred. Once you have downloaded that, run the installer and then you should be mostly good to go. When the mod manager is open, you should search for "Lethal Company".

Is Thunderstore safe to use? ›

While some affirm the platform's security measures and large user base as indicators of reliability, others urge vigilance against possible threats, emphasizing the need to stick with reputable downloads.

Do you need Overwolf for r2modman? ›

r2modman works wonderfully without overwolf, not sure why the thunderstore needs it to hold its hand. At least let me look at the files in a code exported modpack from my friends so I don't have to download your app, install it, import the mods, copy the list, uninstall the app, then manually add them to r2modman.

Can you mod rainworld? ›

Rain World has a well-established community of modders who have produced a wide variety of game mods in a range of formats. Formats include code modifications and custom rooms and Regions. The Rain World Modding Wiki can be found here. For information only about installing a mod loader and mods, see its BepInEx page.

Can you mod Risk of Rain 2 on Steam? ›

Installing Mods on your Client Manually

Open Steam and Navigate to your Library. Right Click Risk of Rain 2 and navigate to Manage > Browse local files. Navigate to BepInExPack > BepInEx > Plugins. Copy your mod folders here.

How do you start modded Risk of Rain 2? ›

Installing mods on r2modman is very simple once you have created and selected a profile you can: Click "Online" then browse the mods that have appeared(I recommend sorting by "Last Updated"), click on a mod, click download, confirm "Download with dependencies" and you're done.

Can you play Risk of Rain multiplayer with mods? ›

To start modding for multiplayer, you need to be aware of exactly that: you're modding for multiplayer. Your code needs to work in an environment where more than one client is going to be active at a time, which means you should be coding accordingly: Stop using global static variables for everything.

Can you play heretic Risk of Rain 2? ›

Kur-skan, the Heretic is a secret playable character in Risk of Rain 2. The Heretic cannot be selected from the character selection screen at the start of a run. Instead, she must be transformed into by holding all 4 Heresy items at once.

Top Articles
igg-games.com Reviews | check if site is scam or legit| Scamadviser
igg-games.com review: is igg-games.com betrouwbaar?
Metra Union Pacific West Schedule
Euro (EUR), aktuální kurzy měn
No Limit Telegram Channel
Missed Connections Inland Empire
The Daily News Leader from Staunton, Virginia
Academic Integrity
35105N Sap 5 50 W Nit
Fototour verlassener Fliegerhorst Schönwald [Lost Place Brandenburg]
Mawal Gameroom Download
Nashville Predators Wiki
4156303136
Tracking Your Shipments with Maher Terminal
Craftology East Peoria Il
Haunted Mansion Showtimes Near Millstone 14
Gdp E124
Delaware Skip The Games
Self-Service ATMs: Accessibility, Limits, & Features
Universal Stone Llc - Slab Warehouse & Fabrication
Mj Nails Derby Ct
Jeffers Funeral Home Obituaries Greeneville Tennessee
Which Sentence is Punctuated Correctly?
Fleet Farm Brainerd Mn Hours
Hannah Palmer Listal
Maine Racer Swap And Sell
Free T33N Leaks
Www Mydocbill Rada
Funky Town Gore Cartel Video
Stubhub Elton John Dodger Stadium
Used Safari Condo Alto R1723 For Sale
Ghid depunere declarație unică
Murphy Funeral Home & Florist Inc. Obituaries
Cheap Motorcycles Craigslist
October 31St Weather
Myfxbook Historical Data
Www Craigslist Com Brooklyn
303-615-0055
Bartow Qpublic
Weather Underground Cedar Rapids
Pain Out Maxx Kratom
Memberweb Bw
Quick Base Dcps
Mychart University Of Iowa Hospital
Wisconsin Volleyball titt*es
Secrets Exposed: How to Test for Mold Exposure in Your Blood!
Kushfly Promo Code
CPM Homework Help
Optimal Perks Rs3
Edict Of Force Poe
Tamilblasters.wu
Bones And All Showtimes Near Emagine Canton
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 6163

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.