About this mod
Custom commands allowing more advanced functionality. Run Lua code blocks, run commands after delays, on game event triggers, and much more.
- Permissions and credits
- Changelogs
- Adds a multitude of new, extremely powerful yet easy to use console commands you can use to do things such as execute Lua game functions, run commands on game event triggers, and much more.
- The commands can all also be used in-game or in .cfg files, such as an "autoexec.cfg" file or mod cfg files.
- Mainly intended as a tool for mod devs, though may be useful to some mod users also (if you like to tweak things at all, maybe).
Why Does This Mod Do?
- To simplify executing commonly-used lua code (in the console for testing/debugging), and to be able to execute Lua code through cfg files or the console at all without Dev Mode enabled for the game (most of this is possible without the mod using Dev Mode, but some things would be much harder to do).
Installation:
- Extract to main KCD2 install folder or install with Vortex. To uninstall manually, delete the "TME CCommands" folder from your [KCD2/Mods] folder.
Command List: Lists the mod's commands in the console (vanilla search feature/command)
Usage In Console:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
?tme_
~~~~~~~~~~~~~~~~~~~~~~~~~~~Clear Console: Clears all the text in the console, making it easier to see new messages.
Example usage for console/cfg file keybinds:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_ClearConsole
bind "delete" "tme_ClearConsole"
~~~~~~~~~~~~~~~~~~~~~~~~~~~Auto Save: Saves your game using the resting system, ensuring your progress is safe.
Example usage for console/cfg file keybinds:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_AutoSave
bind "delete" tme_AutoSave
~~~~~~~~~~~~~~~~~~~~~~~~~~~Delay: Executes any other (vanilla or mod) console command after a defined duration, in milliseconds. Note: Using this in the main menu (as a command or keybind) will not work. It can only be used when fully loaded into a game.
Input Parameters: CommandName (String), Milliseconds (Integer) - Note: 1000ms = 1 second
Example usage for console/cfg file keybinds:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_delay tme_autosave 5000
bind "delete" "tme_delay 'tme_autosave' 5000"
~~~~~~~~~~~~~~~~~~~~~~~~~~~Log Message: Displays a custom message in the console, useful for notifications.
Input Parameters: String (text to display)
Example usage for console/cfg file keybinds:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_Log "Hello World"
bind "delete" "tme_Log 'Hello World'"
~~~~~~~~~~~~~~~~~~~~~~~~~~~Silent CVar Execution: Changes a configuration variable (CVar) without logging the action to console.
Input Parameters: CVar Name (String), Value (Int/Float/String/Etc)
Example usage for console/cfg file keybinds:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_SilentCVar r_sharpening 0
bind "delete" "tme_SilentCVar r_sharpening 0"
~~~~~~~~~~~~~~~~~~~~~~~~~~~Execute Lua Code String: Runs a string of Lua code or a single lua function directly (mod or vanilla Lua functions/code). Includes error handling and logging syntax errors to console.
Input Parameters: String (Lua function/code block in a string)
Example usage for console/cfg file keybinds:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_LuaString "System.LogAlways('Hello World')"
tme_LuaString "for key, value in pairs(System) do System.LogAlways(key) end"
bind "delete" "tme_LuaString System.LogAlways('Hello World')"
~~~~~~~~~~~~~~~~~~~~~~~~~~~Add New Console Command: Yep, it adds a new console command to do whatever you want (runs mod or vanilla Lua functions). If you would like to make keybinds for the commands you create, just make sure the keybind is set after the command is created in your cfg file.
Input Parameters: CommandName (String), LuaFunction (String-formatted), Description (String)
Example usage for "autoexec.cfg" file (or any cfg file that executes on game launch):
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_NewCommand "MyNewCommand" "System.Quit()", "Quits the game instantly."
tme_NewCommand "MyOtherCommand" "System.SetCVar('r_sharpening', 0)", "Sets sharpening to 0.")
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note: These should be set up in an "autoexec.cfg" file (or any other .cfg file that you have executing on game launch).
Update: These commands have been changed in v1.0.1 to now support executing lua code (as strings) when the gameplay events trigger.
On Save Loading Start Event: Executes any console command or lua code (as a string) when the player starts to load a savegame.
Command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_OnLoadStart
~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Gameplay Start Event: Executes any console command or lua code (as a string) when gameplay starts (after loading, after some cutscenes/quest transitions, etc).
Command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_OnPlayStart
~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Gameplay Paused Event: Executes any console command or lua code (as a string) when gameplay is paused.
Command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_OnPlayPause
~~~~~~~~~~~~~~~~~~~~~~~~~~~
On Gameplay Resumed Event: Executes any console command or lua code (as a string) when gameplay is resumed after being paused.
Command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
tme_OnPlayResume
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Input Parameters: LuaString or Command
Example usage in "autoexec.cfg" file (or any other cfg file that is executed on launch):
~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Note: Make sure to use the proper command (from above) for the event you'd like to trigger it
tme_OnExampleEvt "r_sharpening 0"
tme_OnExampleEvt tme_ClearConsole
tme_OnExampleEvt "exec filename.cfg"
tme_OnExampleEvt "System.LogAlways('Game event was triggered!')"
~~~~~~~~~~~~~~~~~~~~~~~~~~~