HelloLua is a Skyrim Special Edition SKSE plugin that demonstrates how to integrate Lua scripting into an SKSE plugin using the CommonLibSSE-NG framework. This project showcases how to:
- Set up a basic SKSE plugin structure using CommonLibSSE-NG
- Integrate Lua 5.1 into your SKSE plugin
- Expose game functions to Lua scripts
- Track hit counts for NPCs in the game
- Create a simple Papyrus extension
- Use function hooking for game functionality
The project serves as a practical example for Skyrim modders who want to incorporate Lua scripting into their SKSE plugins.
- Lua Scripting Interface: Run Lua scripts from within your SKSE plugin
- NPC Hit Counter: Track and manipulate hit counts for NPCs
- Papyrus Extensions: Custom Papyrus functions available to game scripts
- Function Hooks: Example of hooking into game functions
- Console Output: Send messages to the Skyrim console from Lua
- Game Data Access: Get player position and other game data from Lua
- Skyrim Special Edition (supports both Anniversary Edition and pre-AE versions)
- SKSE
- Visual Studio 2022 with C++20 support
- CMake 3.24 or higher
- vcpkg
- Git (for submodule management)
This project uses Git submodules to include the Lua source code directly. After cloning the repository, you need to initialize and update the submodules:
git clone https://your-repository-url/HelloLua-CommonLibSSE-NG.git
cd HelloLua-CommonLibSSE-NG
git submodule init
git submodule updateIf you've already cloned the repository without initializing submodules, you can do both steps at once with:
git submodule update --initThis project uses CMake and vcpkg for dependency management:
1.Make sure you've initialized the Git submodules as described above 2.Configure the project with CMake:
cmake -B build -S . --preset=release3.Build the project:
cmake --build build --config ReleaseThe built DLL will be placed in build/release/HelloLua.dll.
- Copy
HelloLua.dllto your Skyrim SE installation:<Skyrim SE>/Data/SKSE/Plugins/ - Create a folder
Scriptsin<Skyrim SE>/Data/SKSE/Plugins/ - Copy the Lua scripts from the
Scriptsdirectory to<Skyrim SE>/Data/SKSE/Plugins/Scripts/
The plugin exposes several functions to Lua scripts:
Log(message): Write a message to the SKSE logPrintToConsole(message): Print a message to the Skyrim consoleGetPlayerPosition(): Returns player's x, y, z coordinatesTrackActor(formID): Start tracking hit counts for an actorUntrackActor(formID): Stop tracking hit counts for an actorGetHitCount(formID): Get the current hit count for an actorIncrementHitCount(formID, [amount]): Increase the hit count for an actor
-- Print a welcome message to the Skyrim console
PrintToConsole("HelloLua mod successfully loaded!")This plugin also provides Papyrus functions under the HitCounter class:
TrackActor(Actor target): Start tracking hit countsGetHitCount(Actor target): Get hit count for an actorIncrementHitCount(Actor target, int amount): Add to hit count
include/: Header filesCore/: Core functionality headers
src/: Source filesCore/: Implementation of core functionalityMain.cpp: Plugin entry point
Scripts/: Lua scriptsstartup.lua: Runs when the game loadsutils.lua: Utility functions for Lua scripts
ext/: External dependencieslua/: Lua 5.1 source code (Git submodule)
This project is available as an open-source example for the Skyrim modding community.
- Built with CommonLibSSE-NG
- Uses Lua 5.1


