Easily and immediately run Lua scripts in KCD2 from your VSCode editor with a keybind
Permissions and credits
Credits and distribution permission
Other user's assetsAll the assets in this file belong to the author, or are from free-to-use modder's resources
Upload permissionYou are not allowed to upload this file to other sites under any circumstances
Modification permissionYou must get permission from me before you are allowed to modify my files to improve it
Conversion permissionYou can convert this file to work with other games as long as you credit me as the creator of the file
Asset use permissionYou must get permission from me before you are allowed to use any of the assets in this file
Asset use permission in mods/files that are being soldYou are not allowed to use assets from this file in any mods/files that are being sold, for money, on Steam Workshop or other platforms
Asset use permission in mods/files that earn donation pointsYou are not allowed to earn Donation Points for your mods if they use my assets
Author notes
This author has not provided any additional notes regarding file permissions
File credits
This author has not credited anyone else in this file
Donation Points system
Please log in to find out whether this mod is receiving Donation Points
Changelogs
Version 2.1.2
Compatibility with game version 1.2.2
Version 2.1.1
Fix inconsistencies/errors with Lua ran from this that do not occur when ran from Lua in a .pak mod (Script.SetTimer behaviour and some crashes) - now uses the luaL_loadfile and lua_pcall from memory in WHGame.dll instead of what we link against
Builds/links against Lua from CryEngine directly so we can set storedebug to 1 in the global_State
Version 2.0.0
Fix crashes that would sometimes occur a short period after sending and executing Lua
Send only the Lua file paths and run it with luaL_dofile instead of sending the entire contents
Fix ReloadScript calls that are in comments being resolved and their files being sent
This project provides tools for Lua development in Kingdom Come: Deliverance 2, consisting of:
A VS Code extension for sending Lua code to the game
A DLL mod (.asi) that enables convenient runtime Lua code execution in the game
It is loaded into the game with the Ultimate-ASI-Loader and hooks into the game's Lua state. It communicates with VSCode via a local TCP socket which sends the Lua to be executed on demand. It is compatible with Windows and also Linux with the game running under Wine. The ASI loader is included in the zip distributed here on Nexus Mods.
Installation
Download the mod and extract dinput8.dll and vscodelua.asi to the same directory that contains your KingdomCome.exe (KingdomComeDeliverance2/Bin/Win64MasterMasterSteamPGO)
The VSCode extension provides multiple commands and shortcuts to allow you to run the currently open Lua script or your entire mod's workspace of Lua scripts. When resolveReloadScriptDependencies is enabled in the extension (on by default) it will also find and resolve Script.ReloadScript calls and send those files if they can be found in the workspace. More details can be found in the extension's readme
Source code and further details are available on GitHub if you encounter any problems please open an issue there.