XCOM 2
Not enough ratings
XCom 2 adding namelists for Custom Countries
By Durlock
In this Guide i will try to explain how to create custom namelists for countries
   
Award
Favorite
Favorited
Unfavorite
Introduction
First of all thanks to Volman for his video on how to create custom Countries.

In this guide i will not explain how to create countries, only how to create namelists for them. And i have not yet modified existing namelists or added new namelists to existing countries.

I will assume you already created your country, if not follow this link
https://www.youtube.com/watch?v=ynTcLuVEM9g
and come back when you created your own country. :)

I will use Austria as example in this guide.
Creating and linking
When you created your country and used an existing Country from the base game as reference you should see code like this in one of your .uc files

here you can see that this country uses the class 'XGCharacterGenerator' to assign the names to your country.
But we do not want to mess around in the file of the vanilla game where this class is defined
so we create a file of our own with the necessary code:

1. Step

Create a unreal script file named NameArrays in the classes folder of your mod

2. Step

add:

class Namearrays extends Actor;

//Austria
var localized array<string> m_arrGeMFirstNames;
var localized array<string> m_arrGeFFirstNames;
var localized array<string> m_arrGeLastNames;

3. Step

"m_arrGeMFirstNames" means this is the array for German (Ge) Male(M) FirstNames

you want to change the "Ge" to something like "Aut" in this case for "Austria".
you can also put the whole countryname in it like m_arrAustriaMFirstNames; or anything you like
just remember how you spelled it, or copy it if need be.

just be carefull not to mess up the spelling if you have different letter sequences in the files it does not work and will result in an error.

when finished it should look like this

4. Step

Head back to your file where you defined your country

and replace the underlined code :

NameStruct.MaleNames = class'XGCharacterGenerator'.default.m_arrGeMFirstNames;
NameStruct.FemaleNames = class'XGCharacterGenerator'.default.m_arrGeFFirstNames;
NameStruct.MaleLastNames = class'XGCharacterGenerator'.default.m_arrGeLastNames;
NameStruct.FemaleLastNames = class'XGCharacterGenerator'.default.m_arrGeLastNames;

with 'NameArrays' and the lettersequences from your NameArrays.uc file:

NameStruct.MaleNames = class'NameArrays'.default.m_arrAutMFirstNames;
NameStruct.FemaleNames = class'NameArrays'.default.m_arrAutFFirstNames;
NameStruct.MaleLastNames = class'NameArrays'.default.m_arrAutLastNames;
NameStruct.FemaleLastNames = class'NameArrays'.default.m_arrAutLastNames;


You may wonder why there are 4 lines of script but only Male, Female, and Lastnames.
The game allows you to give women and men different lastnames
Usefull for Icelandic names for example where the male and female last names differ:

Male: Jon Eriksson
Female: Anna Eriksdottir
Adding Names to your nameArrays
Now create a new File in the Localization Tab

Call it whatever you like

and add everything between the lines:
____________________________________________________
[NameArrays]

;----Austria

;-Male First Names

m_arrAutMFirstNames[0]="Ben"
m_arrAutMFirstNames[1]="Jonas"
m_arrAutMFirstNames[2]="Leon"
m_arrAutMFirstNames[3]="Elias"
m_arrAutMFirstNames[4]="Finn"
m_arrAutMFirstNames[5]="Noah"

;-Female first names

m_arrAutFFirstNames[0]="Mia"
m_arrAutFFirstNames[1]="Emma"
m_arrAutFFirstNames[2]="Hannah"
m_arrAutFFirstNames[3]="Sofia"
m_arrAutFFirstNames[4]="Anna"
m_arrAutFFirstNames[5]="Emilia"

;-Last Names

m_arrAutLastNames[0]="Gruber"
m_arrAutLastNames[1]="Huber"
m_arrAutLastNames[2]="Bauer"
m_arrAutLastNames[3]="Wagner"
m_arrAutLastNames[4]="Müller"
m_arrAutLastNames[5]="Pichler"
_________________________________________________________

now we have added 6 names to each of the nameArrays we created earlier.

If you want to add female and male only lastnames, swap

"m_arrAutLastNames"
with
"m_arrAutMLastNames" for male
and
"m_arrAutFLastNames" for female
in all 3 files you created

in the NameArray file you may need to add another line of code.
just copy the last name line once and add

var localized array<string> m_arrAutFLastNames;

should look like this

as well as adding an aditional part in your file in your localization folder where you specify the male and female lastnames instead of only the last names
______________________________________________________________
;-Male last names

m_arrAutMLastNames[0]="Jónsson"
m_arrAutMLastNames[1]="Siguroursson"
m_arrAutMLastNames[2]="Guomundursson"
m_arrAutMLastNames[3]="Gunnarsson"
m_arrAutMLastNames[4]="Ólafursson"
m_arrAutMLastNames[5]="Einarsson"

;-Female last names

m_arrAutFLastNames[0]="Jónsdóttir"
m_arrAutFLastNames[1]="Siguroursdóttir"
m_arrAutFLastNames[2]="Guomundursdóttir"
m_arrAutFLastNames[3]="Gunnarsdóttir"
m_arrAutFLastNames[4]="Ólafursdóttir"
m_arrAutFLastNames[5]="Einarsdóttir"
_______________________________________________________________
Testing and Troubleshooting
Testing


If everything is set you can test if your custom namelist works by going to your XComGameBoard in the config folder of your mod and changing the Unitweight= value to whatever you like i recomend adding 000 to the value to get nearly every random generated soldier from this country, and after testing you only need to delete the three 0 to get back the old value.

should look like this



Troubleshooting


If something does not work look for misspelled lines.
One wrong letter will pervent your mod from working and will cause an error.
Notes
I am also new to modding so maybe i missed something,
but it works in my "More Nationalities" mod so it should work for you too.

Have fun and good luck!
14 Comments
dreizehnX 29 Jan, 2017 @ 12:53pm 
Ok, I'll just try a bit then. ^^
Durlock  [author] 29 Jan, 2017 @ 10:53am 
I am really sorry but it i wrote this almost a year ago and i do not remember xD
dreizehnX 29 Jan, 2017 @ 9:59am 
Thanks for your assumption. ^^
At the (rather) end of your guide you write [quote]Now create a new File in the Localization Tab[/quote]
Are you referring to an *.ini file? Not so sure here but since I don't seem to be able to create *.int files through modbuddy, I guess it migh be an *.ini ...?
Durlock  [author] 29 Jan, 2017 @ 9:15am 
oh sorry xD

i think the same applies for races i think
Durlock  [author] 29 Jan, 2017 @ 9:14am 
i think the game adds up all weights from all nations and picks a number at random to determine the nationality of a new soldier.
for example if you only have 3 nations with the weights 3, 8 and 9 added up it is 20 so the game picks a number between 1 and 20 at random.
if it picks 5 it would be the second nation
if it picks 3 the first and
if it picks 14 the last nation.

I THINK ^^ that is how it works
dreizehnX 29 Jan, 2017 @ 12:35am 
Thanks for this explanation. Do I see this right and since this change only adds stuff to the game and don't change anything, there shouldn't be any complications with other mods?

This does not actually belong to your explanation, but since I see this in your last screenshot: Do you know how the weight-numbers work? For example about the races: Is there a difference between setting one race to 10 and the rest to 3 or if I set one race to 5 and the rest to 3? Or is it just about balance between the numbers? (still having a hard time with the numbers for Races and UnitWeight ^^)
lee.morrissey 20 May, 2016 @ 2:02pm 
Has anyone managed to find a solution to this issue?
plasm@n 12 Apr, 2016 @ 7:04pm 
Thanks your tutorial. Unfor it doesn't seem to work for me. Got the "Script vs. class name mismatch" Error. Usually coding errors are pretty harmless with Modbudy but this one crashes the game (actually it creates an endless loop). So messing with namelists is apparently at modders risk :(
Gearheadbsnist 10 Feb, 2016 @ 8:48pm 
Good news! Config files are actually doing things now. Updated namelists in the works for North America (start with what you know, and all that). Oddly enough, if I work with a vanilla localization file though, there seems to be some sort of logic error. I can input data directly into the original and have it work, but if I adjust the same arrays using the modding gui it does absolutely nothing. Weird...
Durlock  [author] 10 Feb, 2016 @ 1:18pm 
i am no coder but it says array out of bounds (0/0) if i am not mistaken it looks like you have not set any FemaleLastnames for your country or misspelled something.

I had the same Problem with Sint Maarten in my mod. I didn't set any lastnames and it resulted in an blackscreen and the same error you have posted.