Author: GrnEyedDvl
Last Update: 8/23/08
Platform and Version: M2TW/Kingdoms v1.05
Difficulty: Medium
Content Overview:The goal here is to get a large family tree to run properly at the beginning of the game.
Required Tools: Notepad, Alpaca's string.bin convertor
Optional Tools:
Files to be changed:
data\world\maps\campaign\imperial_campaign:
descr_strat.txt
data folder:
descr_names.txt
data\text folder:
names.txt
Content:
I recently had to build a family tree out of a chart that looked like a bowl of spaghetti. This is probably one of the most complex family trees ever put into a Total War game, with 26 characters, 11 generals and 3 branches of the family spanning 5 generations. This took me quite a while as coding the family tree has several requirements that I did not know when I first started. Coding a simple tree such as used by the vanilla game is easy, coding a monster like this took some work so I thought I would write a fairly detailed tutorial on it.
These are the basic rules of creating a family tree, in no particular order.
1. Faction leaders relative line must be listed first.
2. Twins and multiple marriages are not allowed.
3. Siblings must be listed in order, from oldest to youngest.
4. Minimum age requirements from campaign_db.xml must be observed.
5. No more than 4 children.
6. Characters may not be spawned on the same x,y location.
The Basics
To get a character in the game, the character needs to have a character_record. The character_record contains the basic information about the character, such as name, age, and sex. There are two ways to create a character_record, depending upon what you want to do with the character. If you are creating a character that you want to appear on the strat map, then you use the "character" command. This is as basic as it gets for a Faction Leader, and has all the required information. if you are creating the Faction Heir, then replace the word "leader" with the word "heir". The x and y entries are his location on the strat map, more on that later. The Traits line will not really be addressed in this tutorial, but it must be a valid trait in export_descr_character_traits.txt. You can safely leave that line out. The Unit line is required, or the character will have no army and will not be able to be spawned.
Code:
character William, named character, male, leader, age 50, x 109, y 147
traits Factionleader 1
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
If all you are doing is creating a character that you want to show in the family tree, but not the strat map, then it is even simpler. All you need is a name, a sex, an age, and a status (alive/dead). The never_a_leader entry is not required. Some people have reported that if you leave that entry off that they will show the faction leader icon over their picture if the character is dead, but I have not been able to recreate that.
Code:
character_record Henry, male, age 1, alive, never_a_leader
Do not create two entries for the same character. This will only confuse the engine and throw some weird errors in the log. If your character is male and over the age of 16, you must use the strat map version to create the character. If your character is female and over the age of 16, you must use the strat map version if you wish her to be able to marry.
Once you have your characters created, to get them into the Family Tree you have to define their relatives. The relative command is used to do this. First you list the male character, then his wife, then up to 4 children in order of age descending. If you get the children out of order, you will get an error. Note that the space between entries is not a space, its a tab. You must terminate the relative line with "end" or you will get an error.
Code:
relative Philip, Bertrada de Montfort, Louis, Constance, Michiel, Henry, end
relative Husband, Wife, Oldest_Child, Younger_Child, Youngest_Child, end
Some things to remember:
Character names must be listed in descr_names.txt and defined in names.txt so the engine knows what to display inside the game.
Use tabs instead of spaces.
Children must be listed from oldest to youngest.
Names must be unique. If you have two characters named William it will cause problems. More on that later.
Basic Tree
To start I took the vanilla descr_strat for M2, and removed every character except William from England. This gives us a family tree of one person, with no relative entries, and no character record entries to worry about. Now we are going to add and remove characters from the game so I can show you the process, and also show you the errors that get created and how to fix them when you see them. For the first part of this I am not trying to be historically accurate, just give you a feel for how everything works together and show you some simple mistakes to avoid.
This is the entry in descr_strat:
Code:
character William, named character, male, leader, age 50, x 109, y 147
traits Factionleader 1
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
And this the resulting family tree:
Poor old King William looks a bit lonely there, so lets give him a loving wife and 3 children. We are going to give him a son over the age of 16, a daughter over the age of 16, and a son under the age of 16. Remember to pick names from the proper faction in descr_names.txt, I picked Alfred, Ambrose, Aldet, and Agatha simply because they are the first ones in the list. After William's entry in descr_strat enter the information for your new characters. For Alfred, we are making him over 16 so we need to create a strat map record just like we did for William, we are not making Agatha a Princess because we want her to be married later in the tutorial, so hers will be a standard character_record. Ambrose will be a male under 16 so we just need a standard character_record and he will be spawned when he comes of age.
Since we will be placing some characters on the strat map, now would be a good time to get a list of valid x,y coordinates so we dont get any errors from a bad location. Run the game and bring up the console with the tilde key. Move your mouse to a good spot for a character and type show_cursorstat. This will give you the current location of your mouse. Do this several times and get a list of valid coordinates. Here is the list I will be using based on the vanilla map.
107, 155
100, 158
102, 152
102, 154
106, 149
112, 149
101, 149
Now create your characters. Make the generals first, and the characters that only show on the family tree last. I try to create them in order of age and use comments just so it is easier to keep everything in order. Also make sure that your oldest child is at least 16 years younger than his father, and that none of the children have the same age.
Alfred:
Code:
character Alfred, named character, male, heir, age 30, x 107, y 155
traits Factionleader 1
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
Code:
;Williams family
character_record Aldet, female, age 29, alive, never_a_leader
character_record Agatha, female, age 29, alive, never_a_leader
character_record Ambrose, male, age 14, alive, never_a_leader
Next create the relative line, make sure you go in the proper order:
Code:
relative William, Aldet, Alfred, Agatha, Ambrose, end
Run the game and your new family tree should look like this:
I made Alfred 30 and William 50, but if we make Alfred 40 we get a crash to the menu and this error in our log:
20:15:56.750 [script.err] [error] Script Error in mods/barebones/data/world/maps/campaign/imperial_campaign/descr_strat.txt, at line 400, column 35
Parent is not old enough to father this child
King William:50 < King William:40
This error is a bit decieving as it lists the name King William twice and doesnt list Alfred's name at all. What it is saying is that King William 50 is not old enouth to father the child of King William who is 40.
If we screw up the order of the children and place Ambrose first instead of last, we get a crash to the menu and this error in the log:
20:20:11.609 [script.err] [error] Script Error in mods/barebones/data/world/maps/campaign/imperial_campaign/descr_strat.txt, at line 400, column 47
Children of King William: King William (age 30) is supposed to be younger than King William (age 14)
Again the children are not listed by name, but by their father.
Another thing I have noticed is that when you get a crash to the menu the error log is not always updated properly. If your log doesnt show the error then try to start the game twice in a row and it will update.
Surnames
Currently our little family has no last name. This is easy to fix, just give William a last name. Pick something from the surnames section in descr_names. I picked Russell. Update Williams entries with the last name Russell, and all his children will inherit the last name. Here is our current code:
Code:
character William Russell, named character, male, leader, age 50, x 109, y 147
traits Factionleader 1
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
character Alfred, named character, male, heir, age 30, x 107, y 155
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
;Williams family
character_record Aldet, female, age 29, alive, never_a_leader
character_record Agatha, female, age 29, alive, never_a_leader
character_record Ambrose, male, age 14, alive, never_a_leader
relative William Russell, Aldet, Alfred, Agatha, Ambrose, end
And here is our current tree:
Alfred will still show Prince Alfred, but Agatha and Ambrose both show the last name in the tree. Williams wife Aldet still has no last name, you can give her a different last name than William, I chose Neville.
Note that you cannot give a child a different last name than his father. I tried to give Ambrose the last name of Rodgers, but it still shows up as Russell in the game. The surname is directly inherited from the father and cannot be changed, but it does not cause a crash.
Adding Spouses and Children
Lets expand our little tree by giving both Alfred and Agatha spouses and children. For Alfred his wife will be Elizabeth Talbot and he will have a 10 year old son named Richard. Agatha will have a husband named Thomas Buttler and a 12 year old daughter named Edyth. we will also make Thomas Butler a general on the strat map.
Alfred's family first:
Code:
;Alfreds family
character_record Elizabeth Talbot, female, age 27, alive, never_a_leader
character_record Richard, male, age 10, alive, never_a_leader
For Agatha's family, we make Thomas Buttler a general and give him a strat map location:
Code:
character Thomas Buttler, named character, male, age 30, x 100, y 158
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
And for her daughter we create a new character_record:
Code:
;Agathas family
character_record Edyth, female, age 12, alive, never_a_leader
Then we assign all the relatives, start with Alfred since he is the oldest. Make sure you place the new relative lines beneath Williams line as he is the faction leader.
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred, Elizabeth Talbot, Richard, end
relative Thomas Buttler, Agatha, Edyth, end
Note that the above code will give us a crash to the menu and an error in our log:
21:14:49.703 [script.err] [error] Script Error in mods/barebones/data/world/maps/campaign/imperial_campaign/descr_strat.txt, at line 411, column 13
couldn't find Alfred's character_record
21:14:49.703 [script.err] [error] Script Error in mods/barebones/data/world/maps/campaign/imperial_campaign/descr_strat.txt, at line 412, column 32
Couldn`t find spouse Agatha
While this is frustrating, its very simple to explain. There are no characters named Alfred and Agatha, but there are characters named Alfred Russell and Agatha Russell. When we made the character_records for Alfred and Agatha, we did not use the last name of Russell. But when the game created those entries it applied William's last name and appended it to their character_records. So if we use this code the game loads and displays just fine:
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard, end
relative Thomas Buttler, Agatha Russell, Edyth, end
Here we see that Alfred's wife keeps her original last name, and his son Richard still has the last name of Russell. Agatha keeps her last name, but her daughter Edyth is named after Thomas Butler.
Lets make some more kids, after all William has a large family and making babies is supposed to be fun. Lets give both Alfred and Agatha 4 kids each. Alfred's other 3 children will be Maria, Julia, and Rufus. Agatha's other 3 children will be Robin, Phillip, and Katherine. Here is our new code:
Code:
;Williams family
character_record Aldet Neville, female, age 29, alive, never_a_leader
character_record Agatha, female, age 29, alive, never_a_leader
character_record Ambrose, male, age 14, alive, never_a_leader
;Alfreds family
character_record Elizabeth Talbot, female, age 27, alive, never_a_leader
character_record Richard, male, age 10, alive, never_a_leader
character_record Maria, female, age 8, alive, never_a_leader
character_record Julia, female, age 5, alive, never_a_leader
character_record Rufus, male, age 0, alive, never_a_leader
;Agathas family
character_record Edyth, female, age 12, alive, never_a_leader
character_record Robin, male, age 10, alive, never_a_leader
character_record Phillip, male, age 7, alive, never_a_leader
character_record Katherine, female, age 2, alive, never_a_leader
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
And here is our new tree. Its starting to fill up a bit.
Another Generation is Born
But I think we screwed up. Alfred's son Richard and Agatha's daughter Edyth are both married and have kids of their own now. We should have caught that earlier, now we have to go back in and change a few things. Richard Russell is actually 19, not 10, and is married with 2 kids. The first problem is that Alfred is not old enough to have a 19 year old son as he is only 30. He needs to be at least 35. But William isnt old enough to have a 35 year old son since he is only 50. He needs to be at least 51. So there are several things we need to change. First make William 51 and make Alfred 35, that part is simple.
Then remove the character_record for Richard and create a new strat map character for him using one of the x,y locations you picked earlier. You can create the strat map record using only his first name, but I suggest you include his last name as well just to keep everyone properly sorted out. Remember that he is now Richard Russell every time you refer to him or you will get an error that Richard's character record cannot be found. Change his name in Alfred's relative line too. Then create a wife and 2 children for Richard, remember that since he is 19 his oldest child can only be 3.
Code:
;Richards family
character_record Margaret Went, female, age 20, alive, never_a_leader
character_record Samuel, male, age 2, alive, never_a_leader
character_record Matilda, female, age 1, alive, never_a_leader
Do the same thing for Edyth. Edyth is really 18, not 12, which means her parents must be at least 34. Change Thomas Buttler's and Agatha's ages to 34, and Edyth's age to 18. Then create a husband and 2 kids for Edyth. Her husband will be a strat map record, again using one of the x,y locations you picked earlier.
Code:
character Laurence Powell, named character, male, age 19, x 102, y 154
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
Code:
;Edyths family
character_record Harold, male, age 1, alive, never_a_leader
character_record Edward, male, age 0, alive, never_a_leader
Then add the new relative lines. Remember to include last names.
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard Russell, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
relative Richard Russell, Margaret Went, Samuel, Matilda, end
relative Laurence Powell, Edyth Buttler, Harold, Edward, end
Our new tree looks like this, as you can see its starting to extend off the screen and there is now a scroll bar so you can see it all:
The Older Generation
But didn't poor William have any siblings? Was he an only child? Of course not. He had 2 brothers and a sister, an older brother named Edward, and a younger brother named Walter, and a younger sister named Elizabeth. But we cannot add his siblings unless we add his father, who was also named William. We will start at the top of the tree with William Senior.
What do we know about William Sr? Well we know he has to be at least 67 because William is 51, but we also know that William has an older brother named Edward. Let's say Edward is 54, which would mean William Sr needs to be at least 70. And we know he has to have a wife, otherwise our William would never have been born. His wife's name is Emeline Witcombe, and she needs to be at least 70 as well. Is William Sr still alive? Fortunately he is, but poor Emiline died a few years ago.
Lets make William Senior first, once we get him working in the game we will add William Jrs siblings. The first problem we will run into is that there is already a character named William Russell. This will cause our entire tree to crash if we don't come up with a solution. What we have to do is create a unique name that the game can recognize but will also display properly in the game. To do this we need to edit the descr_names.txt file and the names.txt file in the text folder. You can call your new name whatever you want, I just tend to add the letter i to the end of the current name. If I have more than one then just keep adding i, Williami, Williamii, Williamiii. This lets me keep track of how many Williams I have out there.
My entry in descr_names will be:
Williami
And in names.txt, you might have to extract this file with Alpacas tool first:
{Williami}William
The part inside the brackets is what is called by the game engine, the part outside the brackets is what is displayed in the game. So William Sr's entry looks like this:
Code:
character Williami Russell, named character, male, age 70, x 106, y 149
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
For his wife, we know she is 70 and that she has been dead a few years. This is easy to do, we just replace the "alive" part of her character_record with "dead 5" which will tell the game she has been dead for 5 years. It will show in game that she died peacefully in 1075 AD or 5 years before whenever the start of your game is.
Code:
character_record Emeline Witcombe, female, age 70, dead 5, never_a_leader
Then add a relative entry for William Sr. Place it at the bottom. This is the entire list of relatives so far:
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard Russell, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
relative Richard Russell, Margaret Went, Samuel, Matilda, end
relative Laurence Powell, Edyth Buttler, Harold, Edward, end
relative Williami Russell, Emeline Witcombe, William Russell, end
Now that William has a father, we can add his siblings. His older brother Edward and his younger brother Walter we need to make strat map entries for. His sister Elizabeth just needs a character_record. For Edward, remember that we already have an Edward, but he is a Powell so we should be ok.
Code:
character Edward Russell, named character, male, age 74, x 112, y 149
army
unit NE Bodyguard exp 1 armour 0 weapon_lvl 0
character Walter Russell, named character, male, age 49, x 101, y 149
army
unit NE Bodyguard
Code:
character_record Elizabeth Russell, female, age 46, alive, never_a_leader
For the relative entries, remember that we added an older brother for William, so he needs to be listed first.
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard Russell, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
relative Richard Russell, Margaret Went, Samuel, Matilda, end
relative Laurence Powell, Edyth Buttler, Harold, Edward, end
relative Williami Russell, Emeline Witcombe, Edward Russell, William Russell, Walter Russell, Elizabeth Russell, end
And the resulting tree, new tree screenshots will have to be taken in two parts.
The Grandparents
Thats right, Grandparents, and maybe a brother or 2 for William Sr. William Sr is 70, so his parents need to be at least 86. We will assume they are both dead so we dont have an 86 year old general running around the map, so all we need are character_records. This is the last layer we can go for ancestors unless we change the max_age in campaing_db.xml. You should also note that once we get away from the faction leader, we can change surnames. Our grandparents will have the last name of Bennett, which means that William Sr will now be William Bennett, but his sons will all be Russell. You can use this to simulate a second marriage and name some children after the mother's side of the family if you wish.
Code:
;grandparents
character_record Leonard Bennett, male, age 86, dead 16, never_a_leader
character_record Beatrice Bennett, female, age 86, dead 19, never_a_leader
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard Russell, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
relative Richard Russell, Margaret Went, Samuel, Matilda, end
relative Laurence Powell, Edyth Buttler, Harold, Edward, end
relative Williami Russell, Emeline Witcombe, Edward Russell, William Russell, Walter Russell, Elizabeth Russell, end
relative Leonard Bennett, Beatrice Bennett, Williami Russell, end
For William Srs brothers, we will make all of them dead so we dont have to mess with strat map records. You know how it works anyways.
Code:
;uncles
character_record Roger Bennett, male, age 71, dead 2, never_a_leader
character_record Henry Bennett, male, age 68, dead 1, never_a_leader
character_record Lewes Bennett, male, age 65, dead 1, never_a_leader
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard Russell, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
relative Richard Russell, Margaret Went, Samuel, Matilda, end
relative Laurence Powell, Edyth Buttler, Harold, Edward, end
relative Williami Russell, Emeline Witcombe, Edward Russell, William Russell, Walter Russell, Elizabeth Russell, end
relative Leonard Bennett, Beatrice Bennett, Roger Bennett, Williami Russell, Henry Bennett, Lewes Bennett, end
Intermarriage
Now we are going to do something tricky. We are going to marry King Williams fathers brothers daughter to King Williams brother. Huh? Let me rephrase that. We are going to give King Williams uncle Henry Bennet a wife and a child, and marry the child to Edward Russell who is King Williams brother.
henry Bennett will have a wife named Bella and a daughter named Crystina. Here are the entries.
Code:
;Henry Bennetts family
character_record Bella Bennett, female, age 65, alive, never_a_leader
character_record Crystina Bennett, female, age 49, never_a_leader
Code:
relative William Russell, Aldet Neville, Alfred, Agatha, Ambrose, end
relative Alfred Russell, Elizabeth Talbot, Richard Russell, Maria, Julia, Rufus, end
relative Thomas Buttler, Agatha Russell, Edyth, Robin, Phillip, Katherine, end
relative Richard Russell, Margaret Went, Samuel, Matilda, end
relative Laurence Powell, Edyth Buttler, Harold, Edward, end
relative Williami Russell, Emeline Witcombe, Edward Russell, William Russell, Walter Russell, Elizabeth Russell, end
relative Leonard Bennett, Beatrice Bennett, Roger Bennett, Williami Russell, Henry Bennett, Lewes Bennett, end
relative Henry Bennett, Bella Bennett, Crystina Bennett, end
And here is the resulting shot of that side of the tree:
To marry her to the other side of the family, we just add one line:
Code:
relative Edward Russell, Crystina Bennett, end
This moves her from one side of the tree to the other, and then you can give them children too.
Faction Heir
One last little trick, the only time you can select the faction heir is through descr_strat. If you need your heir to change families, this is when you do it. Simply move the heir tag to the member you want to have it. In this case I am going to remove it from Alfred and give it to Laurence Powell.
I have attached the descr_strat I used for this tutorial to the post. The names files I didnt attach as it was only one entry.