Welcome to Apollo's Little Guide on how to start modding! And no I don't plan to make a video on this.
This is a tutorial after 5 days of modding, I may get some terms wrong
Yes, if you are determined you can understand a lot instead of asking for a spoonfeed
Let's get started! Head on to https://docs.reactor.gg and follow the documentation, come back here after you've got your first mod created!
Before getting into modding, it is recommended to know the necessary Classes when modding
You will most likely use these always when creating mods for youself or other clients.
- VersionShower.Start - Shows Versions in the Start Menu
- PingTracker.Update - Shows the Ping at the top right while in game (Good for advertising or whatever)
- BanPatch.AmBanned - Prevents bans
- PlayerControl.HandleRpc - Handles custom RPCs that has been sent through a code
- IntroCutScene.MoveNext - Handles the "Crewmates" or "Impostor" intro.
- PlayerControl.RpcSetInfected - Handles the role giving before the game starts
- HudManager.Update - This is used to update the meeting and players name
These are the important classes you want to know, some of them contains methods youll use A LOT.
- PlayerControl - The main source for nearly everything through the player.
- ShipStatus - Controls the starting and ending of the game
RPC = Remote Procedure Call
RPC allows you to send a message with data across the network to tell other players to do something. Look at the Reactor.Example inside of Reactor Repo for an example on how to use RPC
For a list of classes, you can use dnSpy along with inspecting Assembly-CSharp-2020.12.9s.dll
in #resources
After you've created your first mod, you can now head to your TemplatePlugin.cs
Replace everything in that class into:
using BepInEx;
using BepInEx.Configuration;
using BepInEx.IL2CPP;
using HarmonyLib;
using Reactor;
namespace Example
{
[BepInPlugin(Id)]
[BepInProcess("Among Us.exe")]
[BepInDependency(ReactorPlugin.Id)]
public class ExamplePlugin : BasePlugin
{
public const string Id = "gg.reactor.Example";
public Harmony Harmony { get; } = new Harmony(Id);
public override void Load()
{
Harmony.PatchAll();
}
}
}
Now create a patches directory/folder and create a class named PingTrackerPatch.cs
Input the following code below, I'd advise you learn everything I've commented inside it otherwise you're just a poor child who just wants to be successful by doing nothing.
Change ExampleProject to whatever you named your project!
using HarmonyLib;
namespace ExampleProject
{
[HarmonyPatch(typeof(PingTracker), nameof(PingTracker.Update))]
public class PingTrackerPatch {
public static void Postfix(PingTracker __instance) {
__instance.text.Text += "Mod by YOURNAME";
}
}
}
Now for an in-depth analysis of what you need to understand and what is happening
using HarmonyLib; // Call HarmonyLib to use HarmonyPatch
namespace ExampleProject
{
// Make sure you patch at the top of the class otherwise it wont work.
// typeof(Class) delcares what class youll be detecting
// nameof(Class.Method) determines what method you want to detect when it is executed
[HarmonyPatch(typeof(Class), nameof(Class.SpecificMethodToDetect))]
// Name can be anything, just make sure it has Patch at the end for better practice.
// Also optional, you can create a patch directory
public class ClassPatch {
// Prefix runs the code before it sends the method
public static bool Prefix(Class __instance) {
// Do something with the Class you declared
return true;
}
// Postfix runs the code the moment the class starts
public static void Postfix(Class __instance) {
// Do something with the class you delcared
}
}
}
Before testing the mod, I would recommend to turn on logs so you can debug any errors.
Head to the path:
C:\Program Files (x86)\Steam\steamapps\common\Among Us\BepInEx\config
or wherever bepinex is located in
Click BepInEx.cfg
and change Enabled = true
in the [Logging.Console]
header
If you want to run 4 instances of Among Us without clicking the exe file 8 times, you can download this .bat file and place it inside:
C:\Program Files (x86)\Steam\steamapps\common\Among Us
now run the bat file once you're done!
Download the .bat file https://cdn.discordapp.com/attachments/790517195003527189/816540451062153226/AUTester.bat
Hey @apollyon600 , i seem to have an issue wit this one line of code: [BepInDependency(ReactorPlugin.Id)]
It the variable 'Id)]' seems to be underlined red and im not sure why that is?
Some help would be great!!