Player And AI Event Broadcaster - Lua Helper
🟠 Updated over a year agoPreview

🔍 Analysis
- 👍 1.1% endorsement rate — high engagement, a strong quality signal
- 🏆 #13 of 89 Utilities mods in this game by downloads
📋 About This Mod
Broadcasts "callbacks" for all player events and some AI events that other lua scripts can receive in listener functions to perform actions when specific player events occur.
NOTICE: This is a resource/utility for modders. Regular mod users should only download this if another mod requires it. It will do nothing for you otherwise.
What Does This Do?
-
[]Adds a new "Startup" script to the game that can register/broadcast callbacks.
[
]Edits the "player.lua" script to register callbacks for each player event ("OnInit", "OnReload", "OnSetModel", and "OnAction"). Read compatibility notes below.[]
Allows modders to "observe" player events/actions and execute their own script's actions without overriding the "player.lua" file (only this mod will need to override it).
[]
As of v1. 0. 1, the mod now also overrides several AI script files from the "KCD2/Data/Scripts/Entities/AI" folder and it's "Shared" sub-folder, and allows registering callbacks for these (work the same as player event callbacks). See changelogs for details.
Compatibility Notes:
-
[]Not compatible with other mods that edit the "player.lua" file (for obvious reasons).
Installation:
- [
Usage Instructions:
-
[]I have tried to make this as simple to use as possible.
[
]The optional "Receiver Test" file can be used as an offline example (This is the same example, just with notes and a different script/table name). This file can also be useful to log player actions in-game (to get their names to check for in your script and execute your own functions when they occur in-game).[]You do not need all of this. You only need to set up callbacks and listener functions for the events you need to use in your script.
[]Simply replace the console logging calls in this example with your own code/functions to execute on the events (basically identical to registering UIAction listeners).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--Script table declaration
examplescript= {}
--Setting up listener functions
function examplescript. PlayerActionListener(action, activation, value)
System. LogAlways("Received Player Action:")
System. LogAlways(" Action Name:" .. tostring(action))
if tostring(action) == "jump" then
--Do jump functions
function examplescript. PlayerInitListener()
System. LogAlways("Received Player Initialized Event")
function examplescript. PlayerResetLis
-
[]Not compatible with other mods that edit the "player.lua" file (for obvious reasons).
📊 Mod Details
- Game
- Kingdom Come 2 Mods
- Author
- TheManualEnhancer
- Version
- 1.0.1
- Downloads
- 7,002
- Endorsements
- 78
- Category
- Utilities
- Created
- 3/18/2025
- Updated
- 3/24/2025
🔧 How to Install KCD2 Mods
Use Vortex or manual.
📖 Full step-by-step install guide for KCD2 →
Visit the official mod page for specific installation instructions for this mod.
🎮 Need cheat codes or console commands? Check ur gaming wiki for KCD2 commands, item IDs, and more.
Keep browsing — more KCD2 mods await