Here I want to share my knowledge about the portrait allocator with you and how it can be used to add historical persons with a correct portrait.
1. Create new historical persons in the corresponding DB-files and the script.:
The birth date isn't actually the birth date it's the 20th anniversary after which the historical character can be created (so every historical person is at least 20 years old when recruited).
It's important that the person is available from the start! So if your start date is 1700 the character needs to be available before or in 1700.
2. The Portraits
First the basics: there is one Portrait_Allocator for each culture so you have to add a new culture for the fraction to which the historical character should belong (My culture is "Hannover" and is only used for Hannover).
Let's take a look in the Portrait_Categories in the Portrait_Allocator: (You need to convert the esf file to xml!)
I think everything is explained in the pic. The first number (always 44) is still unknown to me but seems to have no effect.
The 2nd number is the point where the sequence starts (0 means the first number, 1 the second, etc...).
Then we have 4 rows of the portrait sequences.
The first row (starting with 44 8 23...) is for young persons from 20-44 and uses the portraits in the "young" folder.
The 2nd (3 8 23...) for the old persons (45 onwards) and uses the portraits in the "old" folder.
In both cases, the game-engine is using the starting portrait for the first character who is created regardless if he is a historical person or not! This is why it is important that you only add historical person which are available at the start!.
The other 2 are most likely unused.
So finally it is possible to add 2 historical persons to each category with a correct portrait (admiral, gentlemen, general, ministers do not work!) under the condition that one is less than 45 years old and the other is at least 45 years old. Then the game will give them the correct portrait as historical persons are always the first who get recruited.
With this knowledge, you can even create a sequence of historical characters with correct portraits. All you need to is adding an if-and-not combination to the export_historic_characters.lua script.
I marked below how to do it:
This code means that James Harris can be recruited once his spawning window ('Birth', take a look at the first pic) starts. The same is true for Robert Murray Keith. But I added another condition that needs to be fulfilled to be able to recruit Robert Murray Keith
Code:
and not conditions.CanGenerateHistoricalCharacter("James_Harris", context)
This means that Robert Murray Keith can only be recruited if James Harris can't be recruited. This is true when James Harris is already recruited or his spawning window has ended.
As you can see in the picture with this knowledge you can create a row of historical characters like this:
Person A can be recruited, Person B only if Person A is recruited, Person C can only be recruited if Person B is recruited and therefore Person A is recruited, etc.
Knowing this and that the portrait allocation works in the same way as my row of historical characters (linear, take a look at the rules state above) you have to strings which are working like this:
The if now portrait 1 is the first portrait to appear and person A (Harris) is the first person to appear, person A gets always portrait 1. So portrait 1 can be a picture of him. Person B (Keith) is always the 2nd person to appear as well as portrait 2, so portrait 2 can be a portrait of person B, etc.
This enables you to make long rows of historical characters.
As example British scholars:
BTW: This should work for NTW too.
If you have any further questions just ask me.