ScriptHookV for .NET 7.0+, supports two modes, NativeAOT and CoreCLR (JIT)
Download ScriptHookVDotNetCore.zip from release page and extract ScriptHookVDotNetCore.asi to your game root.
- Use latest .NET Core API (.NET 7 or higher)
- Can run alonside existing ScriptHookVDotNet based mods
- Easy upgrade/migration from ScriptHookVDotNet
- Reload scripts without restarting the game. Press End to unload all scripts, Home to reload
- Better performance
Note: content below is mostly about running scripts under CoreCLR runtime, for NativeAOT related information, refer to this document
- Make sure you have .NET 7 SDK installed
- Create a project targeting .NET 7
- Install the nuget package
dotnet add package ScriptHookVDotNetCore
- Define a class that inherits from
GTA.Script
- Subscribe to events like you would in ScriptHookVDotNet, or override
OnStart
,OnTick
and other methods as you need - Build the project and copy the dll in
native
folder of the output directory to GTAV\CoreScripts - Voila! Start the game and you'll see your script running.
- Take a look at the examples to see how you can use the scripting API.
The code is written in such way that should make the migration from ScriptHookVDotNet pretty easy.
- Remove the reference from SHVDN
- Upgrade project TFM to .NET 7
- Remove WinForms reference as it's not supported by NativeAOT (yet).
Keys
andKeyEvent
are now defined in theGTA
namespace. - Install the nuget package, then you should be good to go.
- Some internal APIs were removed, such as
SHVDN.ScriptDomain
andSHVDN.Console
. A new static classGTA.Console
was introduced in 1.1, which expose access to the in-game console. - If you use the reflection api(or serialization library such as Newtonsoft.json) in NativeAOT mode, you'll probaly need to configure trimming options, using the descriptor format xml file is recommended.
- Install .NET 7 SDK, C++ desktop development workload and build tools v143
- Clone the repo
- Install vcpkg manually or using scoop.
- Install dependencies
vcpkg integrate install
vcpkg install minhook:x64-windows-static
vcpkg install spdlog:x64-windows-static
vcpkg install nethost:x64-windows-static
vcpkg install inih:x64-windows-static
- Download and extract ScriptHookV SDK to sdk folder
- Build the solution with Visual Studio 2022
- ScriptHoookVDotNet and all of its contributors for the amazing work on the scripting API
- DotNetCorePlugins, which powers the dynamic assembly loading/unloading
The C++ core and the AOT/CoreCLR-specific runtime are written from scratch, while most parts of the scripting API are from ScriptHookVDotNet. See LICENSE