https://github.com/destuur/kcdutils
Lua Wrapper for Kingdom Come: Deliverance 2
https://github.com/destuur/kcdutils
kcd2 lua modding
Last synced: 9 months ago
JSON representation
Lua Wrapper for Kingdom Come: Deliverance 2
- Host: GitHub
- URL: https://github.com/destuur/kcdutils
- Owner: Destuur
- License: mit
- Created: 2025-08-23T22:41:17.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-09T22:30:02.000Z (10 months ago)
- Last Synced: 2025-09-10T02:12:49.485Z (10 months ago)
- Topics: kcd2, lua, modding
- Language: Lua
- Homepage:
- Size: 452 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# KCDUtils
**Version:** 0.2.0
**Author:** Destuur
**Game:** Kingdom Come: Deliverance 2
## Overview
**KCDUtils** is a collection of Lua utilities designed to simplify modding in **Kingdom Come: Deliverance 2**.
It provides ready-to-use functions, helpers, and a consistent framework for creating Lua-based mods.
## Features
- Modular utility scripts organized under `Scripts/Mods/KCDUtils`.
- Core loader file: `kcdutils.lua`.
- Helper functions for common gameplay modifications, event handling, and data management.
- Fully structured mod folder with `mod.manifest` for seamless integration.
- Namespaced under `KCDUtils` to prevent conflicts with other mods.
## Installation
1. Download the latest release ZIP.
2. Extract the contents into your `Mods` folder:
```
../KingdomComeDeliverance2/Mods/
```
3. Folder structure:
kcdutils/
Data/
kcdutils/
Scripts/
Mods/
kcdutils.lua
KCDUtils/
(all utility Lua files)
mod.manifest
## Dependencies
- **LuaDB** is required only if you want to use database-related utilities.
Players using mods depending on KCDUtils with DB functionality must also have LuaDB installed: [LuaDB on Nexus Mods](https://www.nexusmods.com/kingdomcomedeliverance2/mods/1523).
### Be aware, that also KCDUtils.Config uses LuaDB, to persist config values.
## Usage
> [!IMPORTANT]
> Before using instantiated KCDUtils functions in your mod, you **must register your mod** with `KCDUtils.RegisterMod()`.
> This ensures that the DB, Logger, Config, and other utility tables are correctly instantiated and namespaced.
1. Set table at the top of your entry .lua file:
```lua
{{MODNAME_CLASS}} = {{MODNAME_CLASS}} or { Name = "{{MODNAME_CLASS}}" }
```
2. Register mod right after, and before calling your first function to get instantiated utils:
```lua
{{MODNAME_CLASS}}.DB, {{MODNAME_CLASS}}.Logger = KCDUtils.RegisterMod({{MODNAME_CLASS}})
```
3. Explore the scripts in `KCDUtils/` to see available helper functions.
## Notes
- KCDUtils is **standalone**, no other dependencies required for general utilities.
- Future updates will include new utility functions and improvements.
## License
This project is released under the MIT License. See the [`LICENSE`](https://github.com/Destuur/KCDUtils/blob/main/LICENSE) file for details.
Please credit the author **Destuur** and **KCDUtils framework** when using it in your mods, for example on Nexus Mods.