How to YAML: Tweak modding basics
This is a tutorial created with new modders in mind. Some terms may not be correct, but you will be able to create a functional tweak with this method. It's not optimal; it's slow, tedious, and redundant. However, it was the only way I could understand how to make YAML tweaks.
Take into consideration that I'm not an expert, but I've helped a lot of people to start on tweaks and this knowledge will allow you to, at least, navigate more easily at first.
For this tutorial, you need:
Visual Studio Code (or Notepad++, but the tutorial will show you VSCode)
A bookmark for YAMLlint (you can check your YAML files for indentation errors)
Patience, lots of patience. Please, read this guide completely and re-read if needed.
After downloading and installing all the requirements (and yes, SAVE that bookmark, trust me), let's start with the basics.
Understanding YAML Tweaks
YAML tweaks are like a decompiled
version of the .tweaks files that you can find inside the REDmod folder. YAML format is easier to read and understand, but have some differences with REDmod syntax. You can also try and make tweaks using the REDmod syntax inside TweakXL, but personally I have no experience with that yet.
There are some concepts you need to understand before starting:
Indentation
Indentation organizes code using blank spaces, as shown below:
In the past, using indentation wasn't mandatory and mostly used by pro coders to order their files as a good practice. However, for YAML files, indentation is MANDATORY. If you indent wrong, your mod won't work, simple as.
The best way to indent, in my opinion, is using 2 blank spaces (pressing space bar
twice) to make indentations.
"But what about just using tab?" you may think. DON'T. DON'T USE TAB FOR INDENTATION. Using tab for indentation could cause issues, because not all text editors interpret tab in the same way.
Using double space will guarantee your file will keep the same structure everywhere. It even feels natural and VSCode will put nice and useful lines to show your indentation.
Records
Think of records as unique containers grouping multiple properties — which can be other records, or Flats.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FJcj39lEclCRwDROTTwiB%252Fimage.png%3Falt%3Dmedia%26token%3Dca8e08bb-23e0-4f33-abb5-e2c17b06e058&width=768&dpr=4&quality=100&sign=17b768d3&sv=1)
Record names must be unique!
You can't create two records with the same name — they will overwrite each other!
You can learn more on psiberx's github readme, or head over to Types of tweak records
Flats
Flats are values. They can be numbers (integers <like 1 or 2> or floats <like 1.5 or 2.3>), characters (even entire words) or boolean (True or False). They can be more complex things, for that I suggest you to read what Psiberx has to say about this.
Inlines
This is where most new modders make mistakes.
Inline is a way to create records without nesting them under a record name, but coded and nested directly in the property of another record. Yeah, I know, it's hard to understand. Let's do some examples.
This example is a named record with other named records nested on it:
This is the same as above but with inline coding:
When to use inlines or whole named records? That depends on your project. Sometimes creating a record with a UNIQUE name will save you more space and work than creating it on inlines every single time. Sometimes it's the other way around. It's ok to even not using inlines at all if you aren't comfortable with them.
Later in this tutorial, you'll see that some records are named to something like this RecordName_inline0
, RecordName_inline1
, etc. Those inlineX
names are created automatically for easier reading and the number can change without ANY warning on every single game update. The number generated will be dependent on the position of the inline record inside another record. Inline means literally "this is IN LINE X".
NEVER useinlineX
records as base in your items, that will only create headaches for the future you. Using inlineX
records as base for your items is a BAD PRACTICE and could prevent your mod from working on ANY update.
Please, DON'T USE inlineX
RECORDS AS BASE FOR YOUR OWN RECORDS.
Let me explain it better with more examples:
In this example, this a record using inlines in update 2.1
In this example, is the same record, but on update 2.2
In this example, MyBigRecord_inline0
will have a completely different value depending on the update.
In update 2.1 the value1
and related to BaseStats.ExampleBaseStat1
, but then in update 2.2 the value will be 8
and related to BaseStats.ExampleBaseStat3
.
If you used MyBigRecord_inline0
in your item code, your item would stop working as intended. It doesn't matter that popular modders do this, DON'T USE INLINES AS BASE FOR YOUR RECORDS.
Check psiberx's YAML bible about inline records.
Prereqs
You'll see this word a lot inside TweakDB. Prereqs means Prerequisites
and, as the name states, is used to check that certain conditions are met to start, for example, something like an Effector
.
You can find more about this under Types of tweak records -> Prereq, or find a full list under Cheat Sheet: Prereqs.
Effector
Those are records that are used to be activated under certain conditions depending on their Prereqs. So Effector means "Something that activates some Effect". That effect could be almost anything, from stats to visual effects.
You can find more about this under Types of tweak records -> Effector
TweakDB
Tweaks and Scripts are 2 sides of the same coin.
On its own, a tweak does nothing — the engine makes use of the records via scripts.
Think of a script as the instruction, and a tweak as the definition. That way, a script doesn't actually need to understand what it's doing, and all the logic is neatly encapsulated.
For example: Take 500g (the instruction) of Items.Flour
(the definition).
In this tutorial we will use Wolvenkit Tweak Browser. There are many ways of Browsing the tweak database, but you can save them for later, when you are more advanced (or feeling bold).
How to make a research for your YAML Tweak mod
Having clarified some very basic concepts, let's start this guide:
1: Find the thing you want to do
Let's say you want to do a new item that have the Thrusters mechanics from Rogue Boots that you use in certain endings.
What's the best approach to this? Using those Thrusters boots logic in your item.
Unfortunately, most items don't share the same internal name as the name you can see in the description. The best way I've found to deal with this, is going to the community Cyberpunk wiki and looking for your specific item, in this case, those cool Boots.
Internally, that item is called q115_thrusters
. Now that we know that, we can search the item in Wolvenkit Tweak Broswer.
Read Spawn Codes (BaseIDs/Hashes) for how to find an item's unique ID.
2: Using Wolvenkit Tweak Browser
Open Wolvenkit and create a project (for example, I have one project dedicated to research called TEST, which I use every time I need to search something on Wolvenkit), then open it.
Open the Tweak Browser tab and pin it. It should look like this:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FuPoxQ2keK3eGYmCXHch5%252F1%2520InitialTweakBrowser.png%3Falt%3Dmedia%26token%3D7b2d024b-57e0-4c35-9659-8eac0fbc21e0&width=768&dpr=4&quality=100&sign=f8067e4b&sv=1)
Paste q115_thrusters
into the search bar and click on Filter...
and activate Show inline records
. This should look like this:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FyFjORSLZlSW662cAPUX4%252F2%2520ItemSearch.png%3Falt%3Dmedia%26token%3D20b5fa3d-bb83-444b-8aa4-85353df9e182&width=768&dpr=4&quality=100&sign=d4986316&sv=1)
Do a right click into the first item and select Add TweakXL Override
. Do the same for the inline0
and inline1
, but ignore the rogue
and weyland
versions, we don't need that, just the first 3 results shown in this image:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FRPv2sCJywxBBvOfLZ3xB%252F3%2520OverridingValue.png%3Falt%3Dmedia%26token%3D7cb0b9ab-2518-4d23-84fb-aa6b7b5ea803&width=768&dpr=4&quality=100&sign=b51dfd83&sv=1)
Those tweaks should be stored in the left panel inside these folders in the image:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252F3bxPwqgGt8AS1M5tIfNN%252F4%2520WhereTweaksAre.png%3Falt%3Dmedia%26token%3Dafee87d7-3866-40c5-85af-7e6f36ae1dea&width=768&dpr=4&quality=100&sign=572f8be1&sv=1)
Put the cursor above the YAML files and click on the yellow folder to open the folder containing those tweaks in Windows Explorer:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FtyR2oyYUxZvhJlp6CyZv%252F5%2520OpeningYourExtractedTweaks.png%3Falt%3Dmedia%26token%3Df6fe21f8-42aa-48e3-868b-a77160aaae19&width=768&dpr=4&quality=100&sign=de607a14&sv=1)
3: Working with the YAML files
Open the 3 YAML files in VSCode:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FJZcr1yB3ioC18jo5YEUf%252F6.png%3Falt%3Dmedia%26token%3Da51d95d1-9116-4c4e-a7c8-5bf544e8a3e8&width=768&dpr=4&quality=100&sign=6b1224c6&sv=1)
Now, from the latest inline (inline1
in this example), copy the whole contents and paste it below the anterior record (in this case, inline0
):
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FCnKwbCoDLvMcx4ZbADTx%252F7.png%3Falt%3Dmedia%26token%3Dfe52ca93-97d3-4368-9255-e89ba5f56cc0&width=768&dpr=4&quality=100&sign=ef58a186&sv=1)
Now, copy the mixed contents and paste them into the base record (the item on this case). This is how it should look:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FaDaRN0sBs1vgQgMBBhkE%252F8.png%3Falt%3Dmedia%26token%3Db7df499e-4179-4593-91fe-aee31332ff11&width=768&dpr=4&quality=100&sign=88c2961e&sv=1)
Those records below the main item record (inline0
and inline1
) are the ones that manages the Thrusters logic/mechanics.
You can add them to almost any item, but you'll have to research on your own how to do it on each case. Not all items needs the effects nested in the same places, and not all effects needs to be nested like this.
ALWAYS FIND A WORKING EXAMPLE IN THE BASE GAME IF YOU ARE NEW ON THIS AND IF YOU WANT TO KEEP YOUR SANITY. Trust me.
Now, the importance of VSCode in this tutorial. VSCode has an incredibly powerful and useful highlighting system for text by just doing double click
on ANY WORD. With this system, you'll understand how things are nested on ANY item you find. Look at this example:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FSEZiWtPQ1Uj7Ty3JmKOR%252F9.png%3Falt%3Dmedia%26token%3Db521a094-71c0-4e27-9757-04277d44971c&width=768&dpr=4&quality=100&sign=1aa21528&sv=1)
If you pay attention to the miniature code on the right side and the scroll bar, there is a highlight that will point you exactly where things are nested:
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FHeutfMuor5UypcSOXcdJ%252F10.png%3Falt%3Dmedia%26token%3D03baf024-ad72-4125-b64e-d0e52b2e6a05&width=768&dpr=4&quality=100&sign=25240722&sv=1)
If you move over that highlight, you will finally have your answer.
![](https://wiki.redmodding.org/~gitbook/image?url=https%3A%2F%2F1427525421-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F4gzcGtLrr90pVjAWVdTc%252Fuploads%252FNr61MJmTnvmKgH960kjl%252F11.png%3Falt%3Dmedia%26token%3Dbbd41e1f-3f13-4961-81e0-b7252b6c2a1e&width=768&dpr=4&quality=100&sign=3e3a52f7&sv=1)
Final thoughts
This tutorial logic can be applied to ANYTHING that can be found in TweaksDB, how many inline records you are going to find will depend on each particular case. I picked a simple example to not extend this too much, but some items have more than 30 inlines... You are warned.
I've tested this method with many users, and all of them have been able to create their mods. This is not a way to do all items you have in mind, because is extremely inefficient, but once you understand how things are nested and how records are structured, you'll have a better time creating items afterwards.
I hope this will be helpful for you.
Thank you for reading, and good luck in your projects!
REMEMBER TO BOOKMARK THE PSIBERX YAML TWEAK BIBLE
You can also use this online tool to see if your YAML file has errors
Last updated