Adding New Npcs

Mehrman.png


Note: This tutorial is presented with a caveat. It works in my game with no problems, but in -SeaBoundSaint-'s game it crashes
and I have no idea what causes the difference in behavior. So if you play with the included files please back everything up first and
start a new save file just in case.

Thank you to -SeaBoundSaint- for all the help provided. Past and Ongoing.

Cloning an NPC takes a number of steps
======================================
1. Editing All Of The Necessary Character xtbls
2. Renaming All Of The Necessary Mesh Files
3. Renaming The NPC. CNPC and SNPC files
4. Crunching The Character Xtbl to create a CVTF File.
5. Bonus Step: Change The Character's Appearance Or Clothing Colors

1. Character Xtbls That Need To Be Modded.

1.png


2. CNPC Files That Need To Be Modded

2.png


3. NPC Files That Need To Be Modded
3.png


4. SNPC Files That Need To Be Modded
4.png

Note: These pictures show the renamed files.
When you open character.xtbl and search for Anna you find three occurrences

(Original)
Code:
   <Character>
      <Name>npc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
  <Character>
      <Name>snpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
 <Character>
      <Name>cnpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>

To add your new character to the file all you need to do is select the Anna entries (one at a time)
and copy them. Then paste the copied entry directly under the original and change the npc name to that
of your new character.

(Modded)
Code:
 <Character>
      <Name>npc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
<Character>
      <Name>npc_Mehrman</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
<Character>
      <Name>snpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
<Character>
      <Name>snpc_Mehrman</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
<Character>
      <Name>cnpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
<Character>
      <Name>cnpc_Mehrman</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
You will do the same thing in this file

(Original)
Code:
<Character>
        <Name>npc_Anna</Name>
        <Approved>No</Approved>
        <Model>
            <Filename>npc_Anna.cmeshx</Filename>
            </Model>
        <Height_Class>Medium</Height_Class>
        <Height>1</Height>
        <Variation>0</Variation>
        <Base_Height_Offset>0</Base_Height_Offset>
        <Min_Blink>1000</Min_Blink>
        <Max_Blink>4000</Max_Blink>
        <Anim_Set>PML1</Anim_Set>
        <Rig>
            <Filename>SR2_Main_Rig.rigx</Filename>
            <Preload>true</Preload>
            </Rig>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        <Morph>
            <Filename>npc_Anna.morphx</Filename>
            </Morph>
        <Pcm>
            <Filename>npc_Anna.pcmx</Filename>
            </Pcm>
        <Cloth_Sim>
            <Filename>npc_Anna.simx</Filename>
            </Cloth_Sim>
        </Character>
(Modded)
Code:
<Character>
        <Name>npc_Anna</Name>
        <Approved>No</Approved>
        <Model>
            <Filename>npc_Anna.cmeshx</Filename>
            </Model>
        <Height_Class>Medium</Height_Class>
        <Height>1</Height>
        <Variation>0</Variation>
        <Base_Height_Offset>0</Base_Height_Offset>
        <Min_Blink>1000</Min_Blink>
        <Max_Blink>4000</Max_Blink>
        <Anim_Set>PML1</Anim_Set>
        <Rig>
            <Filename>SR2_Main_Rig.rigx</Filename>
            <Preload>true</Preload>
            </Rig>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        <Morph>
            <Filename>npc_Anna.morphx</Filename>
            </Morph>
        <Pcm>
            <Filename>npc_Anna.pcmx</Filename>
            </Pcm>
        <Cloth_Sim>
            <Filename>npc_Anna.simx</Filename>
            </Cloth_Sim>
        </Character>
<Character>
        <Name>npc_Mehrman</Name>
        <Approved>No</Approved>
        <Model>
            <Filename>npc_Mehrman.cmeshx</Filename>
            </Model>
        <Height_Class>Medium</Height_Class>
        <Height>1</Height>
        <Variation>0</Variation>
        <Base_Height_Offset>0</Base_Height_Offset>
        <Min_Blink>1000</Min_Blink>
        <Max_Blink>4000</Max_Blink>
        <Anim_Set>PML1</Anim_Set>
        <Rig>
            <Filename>SR2_Main_Rig.rigx</Filename>
            <Preload>true</Preload>
            </Rig>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        <Morph>
            <Filename>npc_Mehrman.morphx</Filename>
            </Morph>
        <Pcm>
            <Filename>npc_Mehrman.pcmx</Filename>
            </Pcm>
        <Cloth_Sim>
            <Filename>npc_Mehrman.simx</Filename>
            </Cloth_Sim>
        </Character>

There is only one entry in this file that needs to be changed, but there
are 5 name instances in it that need changing.
There are three entries that need changing here

(Original)
Code:
 <Character>
      <Name>npc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
 <Character>
      <Name>snpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
 <Character>
      <Name>cnpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
(Modded)
Code:
 <Character>
      <Name>npc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
    <Character>
      <Name>npc_Mehrman</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
Code:
<Character>
      <Name>snpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
<Character>
      <Name>snpc_Mehrman</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>
<Character>
      <Name>cnpc_Mehrman</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Character>

Change these individually, because if you copy and paste you might
not notice the differences in the code. (NPC,CNPC and SNPC)
There is only one instance in here to be changed
(Original)
Code:
<Character>
        <Name>npc_Anna</Name>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        <StreamCategory>Non Ambiently Spawnable</StreamCategory>
        </Character>
(Modded)
Code:
<Character>
        <Name>npc_Anna</Name>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        <StreamCategory>Non Ambiently Spawnable</StreamCategory>
        </Character>
<Character>
        <Name>npc_Mehrman</Name>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        <StreamCategory>Non Ambiently Spawnable</StreamCategory>
        </Character>
There are three instances that need changing here
(Original)
Code:
 <Preset>
      <Name>npc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Preset>
Code:
  <Preset>
      <Name>snpc_Anna</Name>
      <_Editor>
        <Category>Entries:TEST</Category>
      </_Editor>
    </Preset>
Code:
 <Preset>
      <Name>cnpc_Anna</Name>
      <_Editor>
        <Category>Entries:TEST</Category>
      </_Editor>
    </Preset>
(Modded)
Code:
 <Preset>
      <Name>snpc_Anna</Name>
      <_Editor>
        <Category>Entries:TEST</Category>
      </_Editor>
    </Preset>
 <Preset>
      <Name>snpc_Mehrman</Name>
      <_Editor>
        <Category>Entries:TEST</Category>
      </_Editor>
    </Preset>
    <Preset>
      <Name>cnpc_Anna</Name>
      <_Editor>
        <Category>Entries:TEST</Category>
      </_Editor>
    </Preset>
Code:
  <Preset>
      <Name>cnpc_Anna</Name>
      <_Editor>
        <Category>Entries</Category>
      </_Editor>
    </Preset>
<Preset>
<Name>cnpc_Mehrman</Name>
<_Editor>
<Category>Entries</Category>
</_Editor>
</Preset>[/CODE]
Again pay attention to the NPC,CNPC and SNPC entries
There is only one entry to clone here, but you will need to change
both of the NPC names
(Original)
Code:
<Preset>
        <Name>npc_Anna</Name>
        <Character>npc_Anna</Character>
        <Spawn_Info_Rank>Civilian - Normal</Spawn_Info_Rank>
        <Team>Civilian</Team>
        <AI_Personality>civilian normal</AI_Personality>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        </Preset>
(Modded)
Code:
<Preset>
        <Name>npc_Anna</Name>
        <Character>npc_Anna</Character>
        <Spawn_Info_Rank>Civilian - Normal</Spawn_Info_Rank>
        <Team>Civilian</Team>
        <AI_Personality>civilian normal</AI_Personality>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        </Preset>
<Preset>
        <Name>npc_Mehrman</Name>
        <Character>npc_Mehrman</Character>
        <Spawn_Info_Rank>Civilian - Normal</Spawn_Info_Rank>
        <Team>Civilian</Team>
        <AI_Personality>civilian normal</AI_Personality>
        <_Editor>
            <Category>Entries</Category>
            </_Editor>
        </Preset>
Personal xtbl files refer to the npc xtbl files that pertain
specifically to your character, not the generic files mentioned above.

(Originals)
Meshes.vpp_pc
=============
cnpc_Anna.cmesh_pc
cnpc_Anna.g_cmesh_pc
cnpc_Anna.pcm_pc
cnpc_Anna.sim_pc
cnpc_Anna.morph_pc
cnpc_Anna,cvtf

Pegs.vpp_pc
===========
cnpc_Anna.peg_pc

Textures.vpp_pc
===============
cnpc_Anna.g_peg_pc

Common.vpp_pc
=============
cnpc_Anna.xtbl
cnpc_Anna_cha.xtbl
cnpc_Anna_des.xtbl
cnpc_Anna_pre.xtbl

These all need to be renamed:

cnpc_mehrman.cmesh_pc
cnpc_mehrman.g_cmesh_pc
cnpc_mehrman.pcm_pc
cnpc_mehrman.sim_pc
cnpc_mehrman.morph_pc
cnpc_Mehrman,cvtf
cnpc_mehrman.peg_pc
cnpc_mehrman.g_peg_pc
cnpc_Mehrman.xtbl
cnpc_Mehrman_cha.xtbl
cnpc_Mehrman_des.xtbl
cnpc_Mehrman_pre.xtbl
(Originals)
Meshes.vpp_pc
=============
npc_Anna.cmesh_pc
npc_Anna.g_cmesh_pc
npc_Anna.pcm_pc
npc_Anna.sim_pc
npc_Anna.morph_pc
npc_Anna,cvtf

Pegs.vpp_pc
===========
npc_Anna.peg_pc

Textures.vpp_pc
===============
npc_Anna.g_peg_pc

Common.vpp_pc
=============
npc_Anna.xtbl
npc_Anna_cha.xtbl
npc_Anna_des.xtbl
npc_Anna_pre.xtbl

These all need to be renamed:

npc_mehrman.cmesh_pc
npc_mehrman.g_cmesh_pc
npc_mehrman.pcm_pc
npc_mehrman.sim_pc
npc_mehrman.morph_pc
npc_Mehrman,cvtf
npc_mehrman.peg_pc
npc_mehrman.g_peg_pc
npc_Mehrman.xtbl
npc_Mehrman_cha.xtbl
npc_Mehrman_des.xtbl
npc_Mehrman_pre.xtbl
(Originals)
Meshes.vpp_pc
=============
snpc_Anna.cmesh_pc
snpc_Anna.g_cmesh_pc
snpc_Anna.pcm_pc
snpc_Anna.sim_pc
snpc_Anna.morph_pc
snpc_Anna,cvtf

Pegs.vpp_pc
===========
snpc_Anna.peg_pc

Textures.vpp_pc
===============
snpc_Anna.g_peg_pc

Common.vpp_pc
=============
snpc_Anna.xtbl
snpc_Anna_cha.xtbl
snpc_Anna_des.xtbl
snpc_Anna_pre.xtbl

These all need to be renamed:

snpc_mehrman.cmesh_pc
snpc_mehrman.g_cmesh_pc
snpc_mehrman.pcm_pc
snpc_mehrman.sim_pc
snpc_mehrman.morph_pc
snpc_Mehrman,cvtf
snpc_mehrman.peg_pc
snpc_mehrman.g_peg_pc
snpc_Mehrman.xtbl
snpc_Mehrman_cha.xtbl
snpc_Mehrman_des.xtbl
snpc_Mehrman_pre.xtbl
Open the npc file for your new character

Scroll down and you will find a section like this:
Code:
<Color_Scheme_Chances>
                                <Color_Scheme_Chance>
                                    <Name>Unnamed</Name>
                                    <Chance>100.000</Chance>
                                    <Color_Values>
                                        <Color_Value>
                                            <Variable_Name>Diffuse_Color_R</Variable_Name>
                                            <Color>Abyssal Purple</Color>
                                        </Color_Value>
                                        <Color_Value>
                                            <Variable_Name>Diffuse_Color_G</Variable_Name>
                                            <Color>Abyssal Purple</Color>
                                        </Color_Value>
                                        <Color_Value>
                                            <Variable_Name>Diffuse_Color_B</Variable_Name>
                                            <Color>Abyssal Purple</Color>
                                        </Color_Value>
                                        <Color_Value>
                                            <Variable_Name>Decal_Map_2_Color</Variable_Name>
                                            <Color>Abyssal Purple</Color>
                                        </Color_Value>
                                    </Color_Values>
                                </Color_Scheme_Chance>
                            </Color_Scheme_Chances>

Here is where you decide what color your npc's clothing will be. Every piece of clothing will have one of these sections.

Note: There are more than one section that effects the npc clothing so make sure you edit the color information section'
For more on editing NPC files see:
-SeaBoundSaint-'s NPC Editing Tutorial: https://www.saintsrowmods.com/forum/threads/npc-editing-a-comprehensive-guide.21322/
You will need to use the sr2_npc_table_crunch utility (see Tools Section)
-SeaBoundSaint- has included a zip file called NPC Cruncher Stuff with his NPC Editing Tutorial (also in Tools section)

Download both files and unpack them in the same directory then open the 'Run SR2 NPC Table Crunch.bat' file in a text
editor and read it. It is self explanatory. So change the file names accordingly and then run the bat file.
If everything goes correctly you will have a cvtf file in the directory with your bat file.
Drop all of your changed files into your Mods Folder and recompile your game patch. Then drop the patch in your
game directory and enjoy.
-SeaBoundSaint-'s NPC Cruncher Helper is available here:

Volitions NPC Cruncher is here:

The npc_target01_pre file is included. It sets your first hitman target to the new npc.
 

Attachments

Last edited:
I have a theory about why it might crash some games but I am unable to test it out.

I am using the Gog version of the game which uses 4gb memory where as an unpatched Steam version uses 2gb. I own a legally purchased version of the game, so as far as I am aware the exe has not be altered in any way other than that done by Gog itself.

Please remember that I am not a programmer so my guess could be way off but I'm wondering if the new npc is using either more memory than 2gb allots (in the case of the unpatched Steam executable) or if it is something about the way the memory is segmented (in the case of the patched Steam executable), assuming that the mod doesn't work with them. (Not certain if segmented is the proper word, but I think you get my meaning.)

I know that my mod works properly for two reasons. First I only applied the color changes to the new npc and secondly I have triple checked to make sure that I used the proper npc in the npc_target01_pre.xtbl.

So if anyone wants to weigh in about whether it works or not please mention which executable you have.

I only care whether its Steam, Gog, patched or unpatched. Whether you purchased the game or not is no buisness of mine.

Thanks.


It doesn't appear to be a Gog vs Steam issue, so more research is being done.
 
Last edited:
Back
Top