Repository navigation
Scripts
Bartholomew Ho edited this page Nov 9, 2026
·
1 revision
A script is a single .cs or .vb file. Platform.NET compiles it when the game starts, so you need no project, no SDK and no Visual Studio. It's the quickest way to try something.
Save this as fh2-mods-dotnet\scripts\RepairButton.vb (create the folders if they're missing):
Public Class RepairButton
Inherits [Mod]
Public Overrides ReadOnly Property Info As ModInfo
Get
Return New ModInfo("RepairButton", "1.0.0")
End Get
End Property
Protected Overrides Sub OnInit()
ANNA.Items("Car").Add("Repair", Sub() Player.Car?.Repair())
End Sub
End ClassOr in C#, as RepairButton.cs:
public class RepairButton : Mod
{
public override ModInfo Info => new("RepairButton", "1.0.0");
protected override void OnInit() =>
ANNA.Items("Car").Add("Repair", () => Player.Car?.Repair());
}Start the game. That's it.
-
One file is one mod: a public class that inherits
Mod. -
Already imported for you:
System,System.Linq,System.Collections.Generic,System.IO,System.Text,System.Threading,System.Threading.Tasks,System.Numerics,FH2andFH2ModPlatform. -
If it doesn't compile, the errors go to
platform.logand the console, with the file, line and column. That script doesn't start, and everything else carries on. - With auto-reload on (MODS > Installed mods > Platform.NET > Reload .NET mods when rebuilt), saving the file recompiles it and swaps it in.
-
To turn a script off, rename it, to
RepairButton.vb.offsay. - A script and a folder mod can't share a name. The folder wins.
Scripts need the .NET 10 runtime, like hosted mods. They can't be built as NativeAOT, and they can't use NuGet packages. When you need either, see Your first mod in C# or Your first mod in VB. The code moves over unchanged; just add the Imports / using lines.
Playing
Getting started
Writing mods
The FH2 classes
- Game
- Player
- Vehicle
- World
- Garage, CarCatalog, Profile
- UI and Hud
- Camera
- Audio
- ANNA
- Skills
- DebugOverlay
- Controller
- GameInput
- GameWindow
- Menus and UiElement
- SettingsTile
- ButtonIcons and Picture
- MapView, PhotoCamera, GarageCamera
More