You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lubyanoy Ivan edited this page May 28, 2025
·
4 revisions
PolyScripts provide a powerful way to extend The Battle of Polytopia through direct code modification at runtime. They are compiled .NET class libraries (DLLs) that PolyMod loads alongside your mod.
PolyScripts rely on HarmonyX for non-destructive method patching. This allows your mod to modify the game's behavior without directly altering the base game files.
Each PolyScript must have a public static void Load(ManualLogSource logger) method. This serves as the entry point for your PolyScript. PolyMod will automatically discover and execute this method when your mod is loaded.
usingBepInEx.Logging;namespaceMyCoolMod{publicstaticclassMyCoolScript{publicstaticvoidLoad(ManualLogSourcelogger){logger.LogMessage("PolyScript loaded!");// Your code here! Use HarmonyX to patch game methods, etc.}}}
Building a PolyScript
Create a C# Class Library Project: Use Visual Studio or a compatible IDE to create a new .NET 6.0 Class Library project.
This will generate a .dll file.
Copy the compiled .dll file into your mod's root directory (the same directory as your manifest.json file).
Utilize the ManualLogSource logger to output debugging information to the BepInEx console. This is critical for identifying issues in your code.