Auto-translated
Aha, so the number 8 (the number of vanilla factions) is somehow fixed in the game's code? That's why this mess is happening...
Added 5 minutes later
P.S., weren't the buildings changed? I'm talking about this "mage city with elemental hiring"...
You can create a hero with ID TOWN_NO_TYPE, but he will disappear from the map when the game starts because he won't get an army from levels 1, 2, and 3. But if you organize such a hero, for example, using an NCF file, the hero will be almost functional, only the dotted line on the map will need to be adjusted.
If we create a city, we can also create new buildings specifically for it; here, the ID will only affect the location of the building and its properties. Units are recorded separately. Heroes 5 is a bunch of text files referencing other text files. A city is a text file; it contains paths to building files (also text files). In the buildings, it is recorded what kind of building it is and who is hired there. If there is a requirement for construction, it is also recorded as a path to another building's text file