NPV: Creating a custom NPC
Step 2: How to create a custom NPC
Summary
Published: May 13 2023 by manavortex Last documented update: Mar 18 2024 by manavortex
This page is a part of the NPV guide. It will show you how to use the provided example project to create a custom NPC for Cyberpunk 2077, whom you can then spawn with AppearanceMenuMod.
It will give you a brief overview over the control files and tell you how to pull in the right meshes (and appearances).
Wait, this isn't what I want!
How about ?
Find a more detailed guide about adding components to NPC app files under Appearances: change the looks. This may help you if you get stuck!
Prerequisites
This guide assumes that
you already have a head mesh (see this section otherwise)
that you're using a set of default paths (if not, you will have to adjust)
the corresponding files are in either of these folders
tutorial\npv\your_female_character\head
tutorial\npv\your_male_character\head
the meshes are named like their in-game equivalents, e.g.
h0_000_pwa_c__basehead.mesh
(if not, you will have to adjust)
Skipping and skimming
This guide contains as little fluff as possible, and since much of it has been covered in other guides, extra information will be contained in the links. These will be annotated as clearly as possible with what you need to read and what's optional.
If you're skimming in this guide, you will end up making mistakes. Read thoroughly. If at the end of a section you aren't where the guide says you're supposed to be, fall back and double-check your process. If you still have trouble, you can hit us up on discord in the #mod-development
channel.
Remember that at any time, you can check your progress by spawning your custom character.
How everything hangs together
This section will explain what the template files do and how they hang together. If you like suffering, you can rely on the "fuck around and find out" approach, but I recommend at least reading through it.
In the end, an NPV is just a custom prop with a god complex. For that reason, the file structure is the same (it's just a lot more complex, because you have more than 4 components).
If diagrams help you, then click on the link to see one.
The .lua file
We're registering our NPC with AppearanceMenuMod via a .lua file, which needs to end up in AMM's Custom Entities
folder. The full path in the Cyberpunk directory will be this:
bin\x64\plugins\cyber_engine_tweaks\mods\AppearanceMenuMod\Collabs\Custon Entities
I have prepared two example files in the Wolvenkit's project's resources
. Delete the one that you aren't using, then let's take a look at the other one:
tutorial_custom_female_character.lua
tutorial_custom_male_character.lua
The file content
This is the file content for the female example:
It loads our root entity from tutorial\npv\your_female_character\ops\your_female_character.ent
. That's the file which tells the game what to load.
You can and should change this file — see the inline documentation above for what to change. To do that, you can use a text editor such as Notepad++.
The root entity
You find the root entity for your character here:
Would you like to know more? (You don't need any of this information to finish the guide.)
The root entity hooks up your .app file and the appearance names in the .lua file, and that's about everything there is to say about it. Here's how it looks:
![](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%252FvD7ZgASFrboDbi03w2EM%252Fnpv_root_entity.png%3Falt%3Dmedia%26token%3Dbfb1bc43-4ad2-443c-a73b-a6303d6938a8&width=768&dpr=4&quality=100&sign=a0d5819b&sv=1)
If you want to add more appearances:
duplicate an existing entry
change the last key
name
to match the one in your .luachange the first key
appearanceName
to the one you want to put in your.app
Let's look at the .app file now.
The app file
You can find a more detailed guide about adding stuff to .app files under Appearances: change the looks. It's optional, unless you're really stuck.
This section will tell you how to edit your NPV's appearance – their skin colour, chrome, piercings, tattoos. We will do this in the .app file.
When changing component names, you want to leave the Component prefixes (t1_) in place — the game needs them to calculate collisions!
This is where all of your NPC's appearances are defined (appearanceDefinition
, linked to the root entity via name
). The appearanceDefinition's components define your NPV's properties, pulling in equipment, facial expressions, hair and skin.
Would you like to know more? (You don't need any of this information to finish the guide.)
It looks 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%252FOBWiOcLJVM1XOykJQdS9%252Fnpv_app_structure..png%3Falt%3Dmedia%26token%3D5cbaecc1-8b4e-4782-a2ca-a19d7a77e0f3&width=768&dpr=4&quality=100&sign=4813c8f3&sv=1)
Whenever you save the file, the Wolvenkit console will show you the results of the file validation. These will point you towards mistakes in your paths.
If you get a bunch of errors that complain about "mesh not found in project files" or "no depot path set, only hash given," that's no reason to panic – those errors come from files that you deleted, but which are still linked in the .app
. If you deleted them by accident, restore them from the template project. Otherwise, you can (and should) delete the components.
The next section, How do I know what to put?, will help you find the right appearance names.
If you feel completely lost, you can read up on how to change NPC appearances – the concept is exactly the same.
Also, File Validation will help you by detecting broken links: keep an eye on Wolvenkit's log when you save a file.
If you want to add another appearance
duplicate an existing entry
change the key
name
to match the one in your root entitychange the components
How do I know what to put?
To find out which variants and appearances to use, I suggest that you use NoraLee's excellent NPV Part Picker. It will look like this:
The NPV picker does this for you, but here's how to select your eyebrow appearance by hand:
open up the mesh file and expand the first list
appearances
see a bunch of entries with naming schemas like
colour_01
the numbers correspond with the type of eyebrow in the character editor (look them up here)
Select the correct colour and appearance number
The values you found out will go into the components in your NPV's .app file.
The NPV picker gives me a chunkMask...?
This property is used for hiding parts of a mesh. If the part picker gives you this number, simply paste it into the corresponding box in your component:
![](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%252FetsnGI4MPtVbjVK0iYqp%252Fchunkmask.png%3Falt%3Dmedia%26token%3Dbe8a9c1c-3eeb-4db6-82a1-55aab44214c8&width=768&dpr=4&quality=100&sign=7da889d6&sv=1)
You can learn more about this under Submeshes, Materials and Chunks, but this is not necessary for the tutorial.
Customizing Cyberware
If you skip this step, you will end up with invisible cyberware or the wrong colour/appearance.
When selecting a different cyberware than the preconfigured one, you have to set the appearance name, or the whole thing will show up in grey. The appearance names are usually identical to the cyberware (cyberware_01
, cyberware_02
etc.), but if you are uncertain, you can also open the mesh file and check the appearances
list at the top.
Wolvenkit's file validation triggers when you save a file, and it will help you to spot mistakes.
Customizing piercings and chrome: Chunkmasks
If you skip this step, you will end up with the wrong or too many piercings and cyberware. To learn more about chunkmasks, check this wiki page (if you can do it with the information below, you don't need to)
You have the full piercing or cyberware file, but you're only using parts of it — yet the game stubbornly shows you the whole mesh.
Fortunately, you don't have to edit it in Blender, because you can hide the parts you aren't using via chunkmasks.
Find the piercing
or cyberware
component in your .app
file:
![](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%252FQAKOK5UGSeLJZ0LMyW3P%252Fnpv_piercings_chunkmask_1.png%3Falt%3Dmedia%26token%3D0883f626-6f39-4c89-ab7e-0dba143dff4e&width=768&dpr=4&quality=100&sign=f5cb6664&sv=1)
How do I know which numbers to put?
You can see that inside the .mesh file (which you can see in the component's depotPath
). Open it in Wolvenkit, then switch to the Mesh Preview tab and toggle the checkboxes on the right; those directly correspond to the boxes you need to uncheck in the .app
file:
![](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%252FqZI5xnlbBCWsH0PsQSb0%252Fnpv_piercings_chunkmask_2.png%3Falt%3Dmedia%26token%3D2391ac29-9225-4fd4-996f-25b54eaec2cb&width=768&dpr=4&quality=100&sign=aafd33d1&sv=1)
To hide those bits in the .app, we simply need to uncheck the corresponding boxes - check the previous screnshot!
Hair
This section will teach you how to add another hair mesh to your NPV. We will first remove the default hair, then replace it with the one you want.
To use modded hair, find the correct files inside the mod and add them to your project.
If you want to look up in-game hairs, check Cheat Sheet: Hair
Delete the current hair from the .app — there should be 2-3 components, their names will start with either
hair_
orhh_0
Find the correct hair mesh. You have three options for this:
Looking it up on our nifty list
Filtering the files and clicking through their previews: female:
base\characters\common\hair > wa_ > .mesh > !shadow
male:base\characters\common\hair > ma_ > .mesh > !shadow
Enter the name of the hair mesh that you want to use into the Asset Browser's search bar (see next screenshot) and hit Return.
Once you have found the correct mesh file, right-click it and select "Find Files Using 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%252FNW2veImKsU8gVul1Al4i%252Fnpv_finding_hair_files.png%3Falt%3Dmedia%26token%3D89e6e76f-4bbe-4a3a-b37b-7f38fa77c0ab&width=768&dpr=4&quality=100&sign=5987ce59&sv=1)
This will give you a list of files, which you can mostly ignore. The only thing we care about is the hair's control file, which is usually an
.ent
file:
![](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%252FpWDFLIaSAhTecoyvLnJ0%252Fnpv_hair_filtering.png%3Falt%3Dmedia%26token%3Dd3469626-6b23-4cfb-a18f-19a496dc944d&width=768&dpr=4&quality=100&sign=66ef3e78&sv=1)
Some hair mods don't use an .ent file. In this case, the components will be inside the .app file's appearances, similar to NPC apps. You can copy the entire components
array of the appearance that you want to use.
If there are multiple files, check which one uses the most components per appearance.
Open the
.ent
file and expand thecomponents
array. You will find three components in there, which you can now copy over to your.app
!
![](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%252FHwP8eHrvzy8hsXTiyiAR%252Fnpv_hair_ent_file.png%3Falt%3Dmedia%26token%3D5a6da0b9-8514-4a7f-acc6-cc0e682035ae&width=768&dpr=4&quality=100&sign=c412e3a5&sv=1)
The body
As of version 2.2.0, the body mesh and arms are included for easier replacing.
The process is the same as what you did with the hair: find the files in the mod, add them to your project, move them to your NPVs folder and customize them to your liking.
You can find more information at Cheat Sheet: Body (which also contains the tattoo paths).
And that's the gist of it!
Go forth and create custom apperances!
You can check this guide, or look through the .app files for other NPCs for ideas. If you need further details, I highly recommend checking out NoraLee's much more detailed tutorial, which will also give you all the context you could possibly need.
For guides on how to export a whole animated character to Blender, you can check here.
Please remember that before sharing your NPV, you have to change the paths! You can find a full guide on the fastest way to do that here.
Don't forget, you can pack the Wolvenkit project by pressing the green button in Wolvenkit's toolbar, spawning Tutorial Man
and Tutorial Woman
via AMM to check out your progress.
Last updated