🔩
Mod Developer
DeveloperModder
  • 👋Welcome!
  • Support
    • Dashboard
    • 📄Dictionary
    • 📘Glossary
      • ▫️Files
        • ▫️Assets
          • ▫️Appendix
        • ▫️Red4 Shaders
          • ▫️Definitions
          • ▫️Descriptions
      • ▫️In-Game Objects
        • ▫️Building
        • ▫️Character
          • ▫️Hair
        • ▫️Clothes
          • ▫️Variants
        • ▫️Environment
        • ▫️Vehicle
          • ▫️Assests
            • ▫️Appearance Mapping
          • ▫️TweakDB
        • ▫️Weapon
    • 🐣Getting Started
      • ▫️1. Setup
      • ▫️2. Download
      • ▫️3. Configure
    • 👪Community Links
    • 🔨Troubleshooting
      • ❔FAQ
      • ❗Problems
  • Documentation
    • Dashboard
    • Generalized guidees
      • Replace a player item with an NPC item
      • Mesh editing
      • Remove an Animation (and Potentially Replace It)
      • Change Position and Rotation of an entMeshComponent
      • PagEdit Voiceover and Subtitles In a Quest
      • Recoloring items
      • Creating new items (adding to the game)
    • 🎨Graphical Editors
      • 🦮General Guides
      • 📄General References
      • ▫️Adobe Substance
      • ▫️Autodesk Maya
      • ▫️Blender
      • ▫️Gimp
      • ▫️Krita
      • ▫️Photoshop
    • 🧑‍💻Modding Tools
      • ▫️Cyberpunk Engine Tweaks
        • 🦮Guides
          • ▫️Installing
            • ▫️Troubleshooting
            • ▫️Proton
          • ▫️Usage
          • ▫️Scripts
          • VS Code
        • 📄Reference Sheets
          • ▫️Config File
          • ▫️Font & font size
          • ▫️Uninstalling
          • ▫️UI Examples
      • ▫️MLSETUP Builder
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️REDmod
        • 🦮Guides
        • 📄Reference Sheets
          • ▫️Commands
            • ▫️Deploy
            • ▫️Import
          • ▫️Usage
          • ▫️Structure
      • ▫️Redscript
        • 🦮Guides
          • Get Started
            • Download
            • REDscript in 2 minutes
        • 📄Reference Sheets
          • Language Features
            • Intrinsics
            • String formatting
            • Loops
      • ▫️Red4ext
        • 🦮Guides
          • ▫️Get Started
            • Installing RED4ext
            • Installing a Plugin
            • Configuration
            • Uninstalling
          • ▫️Creating a Plugin
          • ▫️Creating a Custom Native Class
            • Adding a Native Function
        • 📄Reference Sheets
      • ▫️TweakDB
        • ▫️TweakXL
          • 📄Reference Sheets
        • ▫️ArchiveXL
          • 📄Reference Sheets
        • 🦮Guides
      • ▫️WolvenKit
        • 🦮Guides
          • ▫️Getting Started
            • ▫️Download
            • ▫️Setup
            • ▫️Install
            • ▫️Uninstall
            • ▫️Create a mod
          • ▫️Custom Photo Mode Expressions
        • 📄Reference Sheets
          • ▫️Overview
          • ▫️Editor
            • ▫️Project Explorer
            • ▫️Properties
            • ▫️Asset Browser
          • ▫️Release Notes
      • ▫️WolvenKit.CLI
        • 🦮Guides
        • 📄Reference Sheets
    • ⚙️Utilities
      • ▫️010 Editor
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️3DS
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️Deep Asset Discovery
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️Noesis
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️Notepad++
        • 🦮Guides
        • 📄Reference Sheets
      • ▫️PixelRick's Save Editor
        • 🦮Guides
        • 📄Reference Sheets
  • Collaboration
    • Dashboard
    • 🤝Get Involved
      • Needed Documentation
      • Wanted Ads
    • 📅Meetings
Powered by GitBook
On this page
  • Getting started
  • Functions
  • Handles
  • Helpers
  1. Documentation
  2. Modding Tools
  3. Cyberpunk Engine Tweaks
  4. Guides

Scripts

PreviousUsageNextVS Code

Last updated 2 years ago

Explain how to load custom lua fileThe use of dofile() is being deprecated in versions v.1.9 and later of Cyber Engine Tweaks. Please see the on how to create a proper mod.

Getting started

You can write commands directly in the console but for more complex scripts, you may use files.The console will look for files where Cyberpunk2077.exe is located, ideally you will put your files in a folder dedicated to that, for example official Cyber Engine Tweaks files are located in plugins/cyber_engine_tweaks/scripts, here we will assume you put your custom .lua file in this scripts folder.You can execute your file by typing in console:dofile("plugins/cyber_engine_tweaks/scripts/myfile.lua") -- DEPRECATED

Functions

There are 2 function types and 2 handle types.

Global functions

They do not need a handle and are all located in the Game object. Sample:Game.PrintHealth()-- orGame.AddToInventory("Items.money", 500)

Handle functions

They require a handle (more on that later). Assuming you have a player handle:print(player:IsNaked())print(player:IsMoving())player:OnDied()

Handles

Handles are a way to pass an object to the function. For example IsNaked makes no sense without telling the engine for which object we want to know this information.

Singleton

These handles are static, there is only one in the game, for example the gameTimeSystem is a singleton so there is no need to tell the script engine which one you want. That being said you need a singleton handle so it knows you want to call a function on that system.Sample:gameTime = GetSingleton("gameTimeSystem")print(gameTime:GetGameTime())gameTime:SetGameTimeByHMS(12,0,0) -- 12h0m0s

Regular handles

These handles are not unique, for example, the game contains multiple NPCs so there are as many handles as NPCs. Currently as far as I know we can only get the handle of the player by calling the global function Game.GetPlayer().Sample:player = Game.GetPlayer()if player:IsNaked() thenplayer:OnDied() -- kill the player if it's nakedendplayer = Game.GetPlayer()ts = Game.GetTransactionSystem()​tid = TweakDBID.new("Items.money")itemid = ItemID.new(tid)​result = ts:GiveItem(player, itemid, 100000)if result thenprint("We added " .. tostring(itemid) .. " to the inventory!")elseprint("Failed to add " .. tostring(itemid))end

Helpers

If you need to dump the content of a type, you can use the function like the following:player = Game.GetPlayer()dmp = Dump(player, false)print(dmp)You can also call for a static type you want to know about but don't have an instance of:type = DumpType("gameItemID", false)print(type)​dump_player.txt9KBTextResult of Dump

🧑‍💻
▫️
🦮
▫️
Modding Introduction page
Global
Player
Dump
DumpType