View Single Post
Old 03-29-2018, 01:10 AM   #3
joefromchicago
Hall Of Famer
 
joefromchicago's Avatar
 
Join Date: Jun 2011
Posts: 3,630
NOTE: This guide is for modding OOTP version 22 and earlier. For version 23 and later, see this post.

III. Incorporating Your Nameset Into the OOTP Names Files

I recommend creating a separate nameset text file before incorporating that information into the OOTP names files. You'll probably find that it's easier to make edits in a separate nameset file than in the names files, and it will make it possible for you to post your namesets in this forum so that the rest of the OOTP community can enjoy the benefits of your hard work.

When creating players, OOTP draws names from two files located in your game's Database Folder: the names.txt file for last names and the first_names.txt file for first names (nicknames are handled in a somewhat different manner and will not be covered here). In order for OOTP to use your names, therefore, they have to be added to these names files. Now that OOTP can handle an unlimited number of namesets, it's easy to add a nameset to the ones that are currently included in the game. If you are replacing an existing nameset, you will copy-and-paste your names over the names that you want to replace in each file. If you are adding a nameset, you can simply copy-and-paste the new names to the end of each names file. In addition, you will also need to make changes to the world_default.xml file (the procedure for that is outlined below).

IV. Incorporating Modded Namesets Into the OOTP Names Files

A number of namesets have been posted to this subforum and are listed in the original post above. You can follow the instructions in the preceding section to incorporate any of those modded namesets into your OOTP names files. Pay careful attention to the nameset ID assigned to the modded nameset. If it duplicates an existing nameset ID, adding that modded nameset will simply add those new names to the existing nameset that has the same ID. To avoid this situation, if the ID value of the modded nameset either conflicts with an existing nameset ID or if the ID is a special character rather than a number, you will need to make a change to the nameset's ID value before adding it to the names files. For instance, you may want to incorporate a nameset, but the names in that set have "35" as their ID number, and you don't want to replace or add to the existing "35" nameset. How, then, do you add the modded "35" nameset while keeping the existing one?

There are a couple of ways to handle this situation. You could, of course, edit every single ID value individually, but for large namesets that task would be both laborious and tedious.

A quicker way is to go into the modded nameset file(s) and perform a search-and-replace for the nameset ID that you want to replace. For instance, you can search for "35" in the modded nameset and change it to some number that does not duplicate the number of an existing nameset. That way, the two namesets won't have the same ID. The problem with this method, though, is that you will replace every instance of the number "35" in the file, including any instance where "35" is in the frequency field (that's not a problem where the nameset ID is a special character, such as an asterisk, as there would be no danger of replacing a frequency value).

A more efficient method for replacing a nameset ID is to transfer the data to a spreadsheet. Again, I will use OpenOffice for this example: other spreadsheet programs should be able to perform this function, although they may use different steps. First, after creating a spreadsheet, select all of the data in the modded nameset and then copy-and-paste that data to cell A1 in the spreadsheet. In OpenOffice, you will immediately get a dialog box asking you how you want that data to be copied.

Name:  openoffice text import box check graphic.png
Views: 6059
Size:  138.6 KB

Check the "separated by comma" box and press "OK." The spreadsheet will now display all of the data in the first three columns. The nameset ID values will appear in column C. You can now replace all of the values in that column with the value that you want to assign to that nameset, using a fill-down function. Next, enter a comma in cell D1 and fill down to the end of the list. After you have made these edits, you can recreate the comma-separated values by entering the following code into cell E1:

Code:
=A1&D1&B1&D1&C1
That will give you the data in the format that OOTP can use in the names files. Now fill down the information in cell E1 to the end of the list and then copy-and-paste that column into your text file or directly into the appropriate names file. You should now have the modded nameset but with a new ID number.

CONTINUED

Last edited by joefromchicago; 05-16-2022 at 08:07 AM.
joefromchicago is offline   Reply With Quote