Console Commands - Risk of Rain 2 Modding Wiki (2024)

Getting started

The console is a hidden in-game window in which you can view game logs and you can type developer commands. In this tutorial we will learn how to write our own commands.

The key combination to open the console is different depending on your keyboard layout. Generally the combination is Ctrl + Alt plus the button that is underneath the Esc key. In the case of a US/UK keyboard that is the grave key.

Shortcut (please add shortcuts for your region if necessary):
* UK/US = Ctrl + Alt + `* DE = Ctrl + Alt + Ö* ES = Ctrl + Alt + Ñ

Many mods use console commands. Notably mods like DebugToolkit are almost entirely console commands.

To enter a command first you must open the console, then type in the text box at the bottom of the window. The console has intellisense so as you start typing a command the console will make suggestions as to which command you want to type. You can start typing then use the up/down arrow keys to select the command you want from the list.

Sometimes commands require arguments. If a command requires arguments you can add them after the command separated by a space.

So command follows this general format:

mycommandname args[0] args[1] args[2] ... args[n]

e.g. if we have a command called give_item which takes 3 arguments in order args[0]=partial itemname, args[1]=count, args[2]=playerIndex (this is a real example from DebugToolkit, simplified for sake of tutorial)

give_item behemoth 10 0 will give 10 of brilliant behemoth to player at index 0 (this is usually the host).

CommandHelper

Also consider reading R2API's page about this.

One thing that will make your life much easier is R2API's CommandHelper and it basically does all the command registering for you.

How to use Commandhelper for your commands

Logically, it would make more sense to put this at the end of the tutorial after writing the commands but this is just a small bit that we can cover very quickly but it is also important not to miss.

Before you start your plugin's class, add: [R2APISubmoduleDependency(nameof(CommandHelper))]. This is right next to your BepInEx attribute. See also Using Submodules

In your main mod public void Awake() method you just need to add this little snippet which tells R2API to scan your mod for console commands:

public void Awake(){ ... R2API.Utils.CommandHelper.AddToConsoleWhenReady(); ...}

Done. Now we can forget about this and write as many commands as we like.

Writing your first command

To make out command we need to make a private static method with a ConCommand attribute. The method also has to take ConCommandArgs as an argument. See below:

[ConCommand(commandName = "MyCommandName", flags = None, helpText = "Help text goes here")]private static void MyCommandName(ConCommandArgs args){ //Actual code here }

Simple enough so far. Just replace the name of the method, the commandName and the helpText and you are ready to write your code.

Every command take ConCommandArgs as an argument. You can simply think of this as an array of strings you will receive from the console command (just like in the example above).

Although every command needs to have this ConCommandArgs, not every command needs to use it.

Example 1: no argument command

Some commands don't need an argument. Imagine a command which you just want to see a list of all player names, just type listallplayers into the console with no arguments.

[ConCommand(commandName = "listallplayers", flags = ConVarFlags.ExecuteOnServer, helpText = "Lists all players in game")]private static void ListAllPlayers(ConCommandArgs args){ var userNames = NetworkUser.readOnlyInstancesList.Select(u => u.userName); foreach(var user in userNames) { Debug.Log(user); }}

Notice how this command never uses args. This command will read the list of users, select the username and then write their username to the console window.

Example 2: using arguments

Now imagine a command in which we need to set a value of something. Lets just say for example we want to set the jump height of survivors to a certain int value.

[ConCommand(commandName = "jump_set", flags = ConVarFlags.ExecuteOnServer, helpText = "Set jump height of survivor. args\[0\]=(int)value")]private static void JumpSet(ConCommandArgs args){ int jumpHeight = args.GetArgInt(0); SetSurvivorJumpHeight(jumpHeight); //Imagine some other method somewhere else in your mod does this.}

In this case, we use an argument that can be accessed from args. If we type jump_set 10 for example then args[0] = 10. the ConCommandArgs struct contains methods for parsing this to an int so that we can pass it to a method that will set the value for us.

Do note at this point that this is fine when we are typing in expected values but what happens if someone types in the wrong arguments? This is where error catchment is a good practice.

Error catchment

There are reams of information on what to do with error catchment. This is a small dive into that.

For more information, a good place to start is here

If we look at the above example 2 what happens when someone types in a wrong argument? E.g. jump_set horse. We get an error. This isn't a problem as it will be handled by the game logic but wouldn't it be nicer if we could handle it ourselves and give a meaningful message to the user?

There are many ways to go about this and we'll dive into two of them:* The easy and dirty thing to do here is to surround your command code in a try{}catch{} block. If you haven't written your command you can create this block by using a build in VS snippet by typing try then pressing Tab twice. Alternatively, if you have already written your code you can highlight the code you want to surround then press Ctrl + K + S then type try and press Enter when you have try selected. (For more useful shortcuts see here)

[ConCommand(commandName = "jump_set", flags = ConVarFlags.ExecuteOnServer, helpText = "Set jump height of survivor. args\[0\]=(int)value")]private static void JumpSet(ConCommandArgs args){ try { int jumpHeight = args.GetArgInt(0); SetSurvivorJumpHeight(jumpHeight); //Imagine some other method somewhere else in your mod does this. } catch(Exception ex) { Debug.LogError(ex); }}/* Now when there is an error instead of throwing an error up it will be caught and it will instead run the code within the catch block. In the example above it writes the exception to the console, but instead of doing this you could write your own message here. Note if you do write your own message you miss out on making custom exceptions, but you might not care about this. */
  • The more elegant way, is to use a tryParse. Luckily, the args struct already provides these:
    [ConCommand(commandName = "jump_set", flags = ConVarFlags.ExecuteOnServer, helpText = "Set jump height of survivor. args\[0\]=(int)value")]private static void JumpSet(ConCommandArgs args){ int? jumpHeight = args.TryGetArgInt(0); if (jumpHeight.HasValue) { SetSurvivorJumpHeight(jumpHeight); //Imagine some other method somewhere else in your mod does this. } else { Debug.LogError("Couldn't parse the jump height!"); }}

You can check the argument count by using args.Count, or use args.CheckArgumentCount(X) to check if the command was called with at least X arguments.

Making arguments user-friendly

As a general rule: users are sloppy and lazy! Don't take offense at that, it is just a good rule to work with.

  • String arguments. Try and make these case-insensitive when possible.
  • Bool arguments. Users will use 0, false, -1 to denote false and 1, true to denote true. Consider using the following code snippet to parse your bools, as the default ConCommandArgs struct only provides a parser for true and false.
    /// <summary>/// Try to parse a bool that's either formatted as "true"/"false" or a whole number "0","1". Values above 0 are considered "truthy" and values equal or lower than zero are considered "false"./// </summary>/// <param name="input">the string to parse</param>/// <param name="result">the result if parsing was correct.</param>/// <returns>True if the string was parsed correctly. False otherwise</returns>internal static bool TryParseBool(string input, out bool result){ if (bool.TryParse(input, out result)) { return true; } if (int.TryParse(input, out int val)) { result = val > 0 ? true : false; return true; } return false;}
  • Float arguments. Some countries use a , instead of the American . (1,5 versus 1.5). Try and check if the argument was parsed correctly before inputting it raw into your code.

Naming convention

There is no agreed-upon naming convention for console command names within the Risk of Rain 2 modding community. The name of your command must be unique and make sense within the context of what the command is doing.

A recommendation is to avoid conflicts is to use the initials of your mod, followed by an underscore followed by a descriptive name of the command.

Console Commands - 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.

How to manually mod Risk of Rain 2? ›

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 console commands in Risk of Rain 2? ›

The Developer Console is a UI window which provides a history of the most recent event logs and also allows the player to issue commands or toggle some setting variables. It is disabled by default, but can be enabled on PC by pressing: Ctrl + Alt + ` for US/UK keyboards. Ctrl + Alt + Ö for German keyboard.

Can you mod Risk of Rain 2 on console? ›

I am dearly sorry but currently there is no mod support for console. This would require considerable effort from hopoo and an agreement with each platform similar to what bethesda has, If you really want this on console then ask the Developers: Official Risk of Rain Twitter.

Is there a way to cheat in Risk of Rain 2? ›

Like many modern PC games, Risk of Rain 2 includes a developer console that players can access in order to adjust several different game settings and parameters. As players might expect, the developer console easy to access, and it's also the only way to enable cheats in the game.

Is r2modman the same as Thunderstore? ›

r2modman is a mod manager that you can use for many different games. 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.

Does cheat engine work on Risk of Rain 2? ›

This Risk of Rain 2 Cheat Engine Table allows you to completely alter the gameplay. You cannot just make things easier for you but can also make it as difficult as impossible.

What is r2modman? ›

A simple and easy to use mod manager for Risk of Rain 2, Dyson Sphere Program, Valheim and GTFO.

How do you get the secret character in 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.

How to mod ror2 with r2modman? ›

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 use r2modman on Steam Deck? ›

There is also the (open source) mod manager r2modman. It works great on Linux and since it has a Appimage, it can easily be installed on the Steam deck as well. It was originally intended for risk of rain, but works with rounds as well. On the steam deck, you have to go in the desktop mode to install it.

Will Risk of Rain 2 get DLC on console? ›

Survivors of the Void is the first expansion for Risk of Rain 2, released on March 1st, 2022 on Steam alongside its eponymous update and on November 8, 2023 for consoles. This article will contain features introduced in the DLC.

Is Risk of Rain 2 good on console reddit? ›

The new and improved console version of Risk of Rain 2 is here and is stable. The console version of RoR2 really has seen some ups and downs. Despite the issues it had previously, I still personally had a blast with it as I put over 600 hours into it.

Can I still get achievements with mods Risk of Rain 2? ›

I Can Confirm this, and no. having mods on should not disable achievement obtaining. i have tested this.

Can you mod Darktide without getting banned? ›

You'll only be banned for: Using mods that directly affect unmodded players' experience of the game and/or are used to grief other players. Examples: Speed hacks, outright cheating in missions, etc. Using mods that affect the stability/performance of the game service.

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.

Top Articles
Tractor Supply Company: Finanzdaten Prognosen Schätzungen und Erwartungen | 889826 | US8923561067 | MarketScreener
Pet Appreciation Days Return to Tractor Supply – Company Announcement
Calvert Er Wait Time
4-Hour Private ATV Riding Experience in Adirondacks 2024 on Cool Destinations
Craigslist Cars And Trucks For Sale By Owner Indianapolis
Gore Videos Uncensored
The Pope's Exorcist Showtimes Near Cinemark Hollywood Movies 20
Words From Cactusi
Lowes 385
Nyuonsite
Western Razor David Angelo Net Worth
Crime Scene Photos West Memphis Three
Whiskeytown Camera
123 Movies Babylon
Comenity Credit Card Guide 2024: Things To Know And Alternatives
A.e.a.o.n.m.s
U.S. Nuclear Weapons Complex: Y-12 and Oak Ridge National Laboratory…
Summoner Class Calamity Guide
Bjork & Zhulkie Funeral Home Obituaries
6001 Canadian Ct Orlando Fl
7 Fly Traps For Effective Pest Control
Images of CGC-graded Comic Books Now Available Using the CGC Certification Verification Tool
Gdlauncher Downloading Game Files Loop
Dignity Nfuse
Vistatech Quadcopter Drone With Camera Reviews
Lehmann's Power Equipment
20 Different Cat Sounds and What They Mean
Https Paperlesspay Talx Com Boydgaming
MyCase Pricing | Start Your 10-Day Free Trial Today
Meridian Owners Forum
Bend Missed Connections
Reserve A Room Ucla
Askhistorians Book List
Loopnet Properties For Sale
Hotel Denizen Mckinney
Gr86 Forums
Joe's Truck Accessories Summerville South Carolina
Best Restaurants In Blacksburg
Hannibal Mo Craigslist Pets
Elisabeth Shue breaks silence about her top-secret 'Cobra Kai' appearance
Sukihana Backshots
Nina Flowers
Celsius Claims Agent
Child care centers take steps to avoid COVID-19 shutdowns; some require masks for kids
Youravon Com Mi Cuenta
Wisconsin Volleyball titt*es
Gander Mountain Mastercard Login
Nurses May Be Entitled to Overtime Despite Yearly Salary
300+ Unique Hair Salon Names 2024
Black Adam Showtimes Near Kerasotes Showplace 14
Zalog Forum
Saw X (2023) | Film, Trailer, Kritik
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 6161

Rating: 4 / 5 (61 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.