Code completion for built-in Cyber Engine Tweaks, Dear ImGui and Cyberpunk 2077 types and functions (except sqlite)
Type resolving for Game.GetScriptableSystemsContainer():Get("Type")
, NewObject("Type")
, and GetSingleton("Type")
Contextual suggestions for default values and predefined sets
Download and extract the Cyber Engine Tweaks Lua Lib.
The lib files linked above is not the newest version.
You can join the Cyberpunk 2077 Modding Community discord server and then visit this message to download the newest version (CET 1.27 / Patch 2.01 Typedefs).
You can alos check the pinned messages in the #cet-lua-scripting channel for any future update.
Install the Lua by sumneko extension.
Locate settings.json in VS code
Ctrl + Shift + P
C: > Users > (yourname) > AppData > Roaming > Code > User > {} settings.json
Add next settings to the .vscode\settings.json
or in the Settings GUI:
NOTE: ensure commas occur after every line
On first use it takes a couple of minutes to parse and cache all definitions. Unfortunately there is no visual indication of this process. When it's done the code assistance will be more responsive.
To install the typedefs for Dear ImGui, you can manually download the files from GitHub repository Nats-ji/CET_ImGui_lua_type_defines and then follow the same installation process in #cet-typedef to install them in VSCode.
You can specify the type of the parameters with @param
annotation. It's very handy for Observe
and Override
:
If type of some variable cannot be resolved or ambiguous you can force the type with @type
annotation:
The type of the result of some functions depends on the parameters passed to the function. If a valid type name is passed as a parameter, then the resulting type must be resolved without custom annotations.
A collection of helpful links and resources
Decompiled game scripts: These are the game's scripts decompiled to redscript. Extremely useful for understanding how functions work under the hood, game systems and classes interact with each other and what classes and functions are available. For more information on how to transpile redscript code to .lua code, read up on the Scripting API. Works best if downloaded and opened in some IDE like VSCode that lets you search across all files at once.
cp2077-cet-kit: psiberx's github repository with helper functions and scripts
NativeDB: This is a database containing all the classes and their functions, their relation to each other, their functions, attributes and all the Enum's. Very useful for quickly looking up what functions a class offers and what parameters it takes. Also helpful for understanding which classes inherit from which. Nativedb has more types than decompiled scripts.
CET translation helper: A utility that helps you translating your CET mods, by lgomes_gvizstudio on github
CET Kit: A collection of utility scripts, for tracking game states (In Game etc.), setting up timers and timed actions, storing data per game save and more.
Official CET Examples: A collection of small example mods, such as controlling NPC AI, working with map pins, reading player inputs and more.
Cyberpunk 2077 Explorer: Visual overview of the game's classes and structure. Very helpful for understanding the higher level structure.
Cyberpunk 2077 Modding Community: Discord server with multiple CET related channels, lots of more resources and snippets (Discord search is your best friend)
Simple Gameplay Mod Tutorial: An extensive tutorial covering how to work with the TweakDB, create a CET mod, override and observe functions and use redscript.
LUA code playground: An online sandbox to familiarize yourself with LUA and test some code without having to launch Cyberpunk with CET. Note that any CET/Game functions won't work in it.