NPC Editing - A Comprehensive Guide

Right now I just assume that the clothing items are extremely hard coded to the character model itself that any changes will just result in everything failing
You can edit the chances that an already assigned clothing item will appear on an NPC, and the color set it spawns with. But you can't change what the item a character wears is because the shape of those clothing items is pre-baked into the character's mesh.
Volition probably built the NPC meshes by feeding these .xtbl files into a tool we don't have. At least we have the .cvtf cruncher.

Example:
Code:
                        <Vid_group>
                            <Name>head hair</Name>
                            <Vid_chances>
                                <Vid_chance>
                                    <Description>Shaundi hair</Description>
                                    <VID_list>12</VID_list>
                                    <Chance>100.000</Chance>    <--- YOU CAN ONLY EDIT THIS.
                                </Vid_chance>
                            </Vid_chances>
All Character Meshes (.cmesh) in SR2 are divided up into sections and given a number (known as a "Visual Identifier" or "VID"). For NPCs, each number represents a section of the mesh which is visually identifiable as a clothing item. The chances of the given VID spawning on the NPC can be changed, but the item the VID represents cannot.
 
You can edit the chances that an already assigned clothing item will appear on an NPC, and the color set it spawns with. But you can't change what the item a character wears is because the shape of those clothing items is pre-baked into the character's mesh.
Volition probably built the NPC meshes by feeding these .xtbl files into a tool we don't have. At least we have the .cvtf cruncher.

Example:
Code:
                        <Vid_group>
                            <Name>head hair</Name>
                            <Vid_chances>
                                <Vid_chance>
                                    <Description>Shaundi hair</Description>
                                    <VID_list>12</VID_list>
                                    <Chance>100.000</Chance>    <--- YOU CAN ONLY EDIT THIS.
                                </Vid_chance>
                            </Vid_chances>
All Character Meshes (.cmesh) in SR2 are divided up into sections and given a number (known as a "Visual Identifier" or "VID"). For NPCs, each number represents a section of the mesh which is visually identifiable as a clothing item. The chances of the given VID spawning on the NPC can be changed, but the item the VID represents cannot.
Darn, well thanks for the help anyways

Also yeah, you are correct about editing the chances, I managed to make the Ronin girls to only wear track pants, by reducing the chance for the latex pants to 0.001, if it's completely 0 then one of them will spawn in with no legs lol
 
I've already found it but thanks. Btw do you know what to edit if I want to disable ragdoll for protagonist? That no one would be able to knock me out.
Your best bet is using Sandbox++ code: 888-838 to disable ragdolling entirely.

If you want to do it via table files, it's a bit all over the place.
- There's some stuff in gameplay_constants.xtbl about how much force in an impact from a car characters can take before ragdolling.
- gameplay_constants.xtbl also controls how damage is inflicted when ragdolling.
- I'm sure there's something somewhere that controls the point at which during falling, your character starts to freefall instead of dropping down to their feet (so theoretically, you could have it so you could jump off the Phillips Building and land on your feet).
- spawn_info_ranks.xtbl allows you to adjust how much damage a character can take before ragdolling, but it won't actually disable it.
 
Your best bet is using Sandbox++ code: 888-838 to disable ragdolling entirely.

If you want to do it via table files, it's a bit all over the place.
- There's some stuff in gameplay_constants.xtbl about how much force in an impact from a car characters can take before ragdolling.
- gameplay_constants.xtbl also controls how damage is inflicted when ragdolling.
- I'm sure there's something somewhere that controls the point at which during falling, your character starts to freefall instead of dropping down to their feet (so theoretically, you could have it so you could jump off the Phillips Building and land on your feet).
- spawn_info_ranks.xtbl allows you to adjust how much damage a character can take before ragdolling, but it won't actually disable it.
thanks again, I will look into it tomorrow. Also I was wondering about picking up objects, is it possible to add some more objects to pick up or not? I tried something before but didnt work.
 
Oh how I hate my learning disabilities. I got so excited at the prospect of being able to customize the NPCs of Saints Row 2, to create the mod of my dreams...

And for a while I was able to understand what was being said in this Editing Guide... Then suddenly my eyes crossed, and my brain short circuited.

Has anyone on here heard of the learning program Scratch?
1726881640187.png

I'm 29 now, but this is the only program I've ever successfully managed to create a game on... And that was in College... 10 Years ago.

The fact that all the lines of code were already created, so all you had to do was put them into place, made it so much easier to use. I didn't have to struggle to understand what each individual piece of code was, I just had to know which piece went where to make things work.

Maybe that is what this guide is intended to do... And maybe I just don't have to capacity to understand it... I was cursed with the ability to create an endless stream of great video game ideas or even mod ideas for pre-existing games, but unable to actually learn the ability to do anything with these ideas.

Maybe someone can help me understand what I need to do though an example.

So, this is the NPC I'm hoping to create, or as close as possible.
1726882783272.png1726882686681.png
Yes, she does have the "Stilwater Correctional" on the back of her jacket and wristband

Other than her appearance, she would also use:
Voice - Female British NPC
Movement Style - Cell Phone Walk
Compliment - Blown Kisses
Taunt - Polish Sword
Combat Style - Ronin
Melee Weapon - None
Firearm - NR4
Team - Saints

She does not appear in any of the Gang Customization options, and instead spawns in the open world like any other NPC, but she can be recruited. Her spawn chances are 100%, but if recruited she will not spawn again until being dismissed.

The spawn locations (If Possible) would be:
Sommerset - Sat at the slot machine in the Brotherhood Apartment1726883699112.png1726883738183.png

Encanto - Browsing the shelves in Sloppy Seconds1726884628799.png

Saints Hideout (Fully Upgraded) - Sat on any sofa

So, when all's said and done, what would the complete list of code look like that I'd use to make the mod? And would I just add the code straight to my game files, or would I put it through GOTR?
 
Oh how I hate my learning disabilities. I got so excited at the prospect of being able to customize the NPCs of Saints Row 2, to create the mod of my dreams...

And for a while I was able to understand what was being said in this Editing Guide... Then suddenly my eyes crossed, and my brain short circuited.

Has anyone on here heard of the learning program Scratch?
View attachment 40851

I'm 29 now, but this is the only program I've ever successfully managed to create a game on... And that was in College... 10 Years ago.

The fact that all the lines of code were already created, so all you had to do was put them into place, made it so much easier to use. I didn't have to struggle to understand what each individual piece of code was, I just had to know which piece went where to make things work.

Maybe that is what this guide is intended to do... And maybe I just don't have to capacity to understand it... I was cursed with the ability to create an endless stream of great video game ideas or even mod ideas for pre-existing games, but unable to actually learn the ability to do anything with these ideas.

Maybe someone can help me understand what I need to do though an example.

So, this is the NPC I'm hoping to create, or as close as possible.
View attachment 40854View attachment 40852
Yes, she does have the "Stilwater Correctional" on the back of her jacket and wristband

Other than her appearance, she would also use:
Voice - Female British NPC
Movement Style - Cell Phone Walk
Compliment - Blown Kisses
Taunt - Polish Sword
Combat Style - Ronin
Melee Weapon - None
Firearm - NR4
Team - Saints

She does not appear in any of the Gang Customization options, and instead spawns in the open world like any other NPC, but she can be recruited. Her spawn chances are 100%, but if recruited she will not spawn again until being dismissed.

The spawn locations (If Possible) would be:
Sommerset - Sat at the slot machine in the Brotherhood ApartmentView attachment 40855View attachment 40856

Encanto - Browsing the shelves in Sloppy SecondsView attachment 40858

Saints Hideout (Fully Upgraded) - Sat on any sofa

So, when all's said and done, what would the complete list of code look like that I'd use to make the mod? And would I just add the code straight to my game files, or would I put it through GOTR?
scratchy.. been a while i used that program
 
thanks again, I will look into it tomorrow. Also I was wondering about picking up objects, is it possible to add some more objects to pick up or not? I tried something before but didnt work.
I don't know for sure, but I think I remember seeing something ages ago on this. Try digging through the forums. You might find something.

for a while I was able to understand what was being said in this Editing Guide... Then suddenly my eyes crossed, and my brain short circuited.
The guide is essentially a translation of the TableDescriptions into plain English. Not everything works 100% of the time. Changing Hair colors is particularly hit or miss in my experience. So it might be the guide, not you.
I was cursed with the ability to create an endless stream of great video game ideas or even mod ideas for pre-existing games,
I noticed your "Saints Row V (Not real of course)" thread, and I for one am blown away by just how much you've come up with!

Maybe someone can help me understand what I need to do though an example.
There's quite a bit involved in what you want to accomplish. It won't be exact, but you can get close.
So, this is the NPC I'm hoping to create, or as close as possible.
1726882783272.png1726882686681.png
It's not possible to add new clothing items to an NPC (see Post #11 for more info).
You can, however, change the colors and spawn chances of items which already exist in the character's mesh via their .xtbl file.
In npc_shaundi's case, she has both her regular and gym outfits tied to the same model. So you could mix and match items from those outfits if you wanted to. (eg: Arm Sweatband Right paired with Bellbottom Jeans.)
Yes, she does have the "Stilwater Correctional" on the back of her jacket and wristband
In order to change a Logo on an NPC, the Logo you are changing it to also has to be in the .peg files (and potentially in the .cmesh files too, in which case the method in the guide is not actually possible, since .cmesh files can't be edited).
I would instead recommend editing the contents of the Logo image which is already there, while retaining it's filename. You can use Masamaru's sr2PegTool to extract and rebuild .peg files.
Voice - Female British NPC
If you can find a British female voice in SR2, you can use <Persona_Override> in the NPC's Preset file (npc_name_pre.xtbl) to force the character to use a specific Persona (voice). You can find Persona names in persona.xtbl.
See this post for more info.
Movement Style - Cell Phone Walk
You will want to change the "walk" animation (not "custom walk") to use "gml1_bs_cell_walk.animx" in whichever Animation Set file the character is using (gml1.xtbl, gfl1.xtbl, pml1.xtbl, pfl1.xtbl, cml1.xtbl, pol1.xtbl). You can see which Animation Set the character is using in their Character file (npc_name_cha.xtbl).
Compliment - Blown Kisses
Taunt - Polish Sword
NPCs use Compliments/Taunts A/B/C/D in gml1.xtbl (this is why they're listed separately from the others). Whatever you change these to, the NPCs will use them. But be aware that these animations will also change in the Plastic Surgeon.
Blown Kisses: gml1_bs_sd_comp_k.animx
Polish Sword: ykza_sd_plsh_swrd.animx
Combat Style - Ronin
Add "<Melee_Style>Ronin</Melee_Style>" to the character's Preset file (npc_name_pre.xtbl).
Melee Weapon - None
Firearm - NR4
This could be a little more complicated. The way I'd recommend doing it is assigning a Homie's spawn_info_rank to your NPC via their Preset file. Then modify that spawn_info_rank's loadout in spawn_info_ranks.xtbl. Bear in mind, whatever you change here using this method will also affect whichever Homie that spawn_info_rank belongs to. (It will only affect their Homie versions though, not mission versions.)
There might be a spawn_info_rank which is already set up how you want it though.
Team - Saints
Add "<Team>Playas</Team>" to the character's Preset file (npc_name_pre.xtbl). This should also make them recruitable.
She does not appear in any of the Gang Customization options
Gang Customization NPCs are assigned via gang_customization.xtbl. So as long as your NPC isn't listed in there, you're good.
and instead spawns in the open world like any other NPC
Make sure "<Flag>no_ambient_spawning</Flag>" is NOT present in the Preset file.
if recruited she will not spawn again until being dismissed.
I'm not sure that's possible, unfortunately.
The spawn locations (If Possible) would be:
Sommerset - Sat at the slot machine in the Brotherhood Apartment1726883699112.png1726883738183.png

Encanto - Browsing the shelves in Sloppy Seconds1726884628799.png

Saints Hideout (Fully Upgraded) - Sat on any sofa
You'll want to find those Action Nodes in action_node_npcs.xtbl, then add your NPC to the Action Node's "<Model_List>".
Example:
Code:
        <Model_List>
            <Model>npc_shaundi</Model>
            </Model_List>
And would I just add the code straight to my game files, or would I put it through GOTR?
Once you have all your modified files, install them to your patch.vpp_pc as you would any other mod, via GotR or sr2ModManager.

Hope this helps! Sorry for the late reply.
 
Back
Top