UPDATE: Unfortunatelly, this method is compromised because after loading a savegame, the sub-faction trick will lose its effect, the custom general in battlemap will be replaced by a generic one from the owning faction.
--------------------------------------------------------------------------------------------------------------------------------
This tutorial is focused in generals but in case you're aiming at captains, the information you need is all here too, the process is the same.
For each faction, the game allows only one specific animation for battle models of captains, and another one for generals. So you can have many different custom 3D battle models for the generals in a specific faction, but they will all use the same animation.
This will obviously cause problems in case you use different sizes for each custom general model of a single faction (large monsters, small goblins etc). A single animation will not fit for them all.
As a side note, the hardcoded limit of factions is 31, this means you can have 31 custom animations for generals/captains.
So if you have a faction with multiple different 3D battlemodels for generals and want custom animations for each one of them, you must bring the animations from another factions.
In descr_character.txt you have many sections, one of them is for captains. There is another one for generals.
Code:
type named character
In the generals section (type named_character), there is one entry for each faction, and they look like this example:
Code:
faction venice
dictionary 15
strat_model rhun_captain
battle_model rhun_captain
battle_equip gladius, chainmail shirt helmet and rectangular shield
The strat_model value points to descr_model_strat.txt
The battle_model value points to another file called battle_models.modeldb. In this file, search for the battle_model value and you will find the model entry with an animation assigned to it. This is the 3D model of this faction's general, and its assigned animation.
So in descr_character.txt you can set any model linked to a specific animation in battle_models.modeldb, but remember that once you do it, every general in that faction will get this model and animation. However, while spawning a character via script or setting it via descr_strat.txt, you can set an unique 3d model for it, but not a unique animation.
So the trick to achieve the objective presented in this tutorial is to choose a faction that is actually not being used in your mod, and use it as a placeholder for the custom animation you want for a custom general of another faction.
Once you have set the custom model and animation of the placeholder faction by using descr_character.txt and battle_models.modeldb, you can then use this animation for a general of the other faction.
For doing this, the general that will receive the animation must be set via descr_strat.txt, spawning it via campaign_script.txt won't work.
In descr_strat.txt, create an entry like any other to normally set the general of your faction at the beggining of the campaign. This entry must be created inside the section of your faction (descr_strat.txt is divided in faction sections).
It should look something like this example:
Code:
character Sauron, named character, age 22, x 289, y 137, portrait sauron, hero_ability SAURON, label sauron1
traits Sauron 1, NightBattleCapable 1
army
unit Troll_chieftain exp 3 armour 0 weapon_lvl 0
unit Mordor Halberd exp 3 armour 0 weapon_lvl 0
unit Mordor Halberd exp 3 armour 0 weapon_lvl 0
Now comes the trick. Edit the entry you just created, by placing a sub_faction parameter, like this:
Code:
character sub_faction venice, Sauron, named character, age 22, x 289, y 137, portrait sauron, hero_ability SAURON, label sauron1
traits Sauron 1, NightBattleCapable 1
army
unit Troll_chieftain exp 3 armour 0 weapon_lvl 0
unit Mordor Halberd exp 3 armour 0 weapon_lvl 0
unit Mordor Halberd exp 3 armour 0 weapon_lvl 0
The faction in the sub_faction parameter must be the one you used as a placeholder for the animation.
Voila! Now you have a general of your faction with a custom animation that comes from another faction.
THATS ALL!!!
EXTRAS: You can't use this process when spawning generals via campaign_script.txt, despite the fact that there is a sub_faction parameter there too, it won't work.
If you don't want your general to be visible in the campaign at its start, do everything like you read in this tutorial and set the general in descr_strat.txt to some isolated place in the strat map (it must be a place with blocked pathfinding, otherwise he will move around). Then create a script to move him to the corrdinates you want when the time comes.
WARNING: Using send_character_off_map command to get rid of the general at the campaign start and then spawning him again later will break the animation trick so the general will not receive the custom animation from the placeholder faction but actually the one from its own faction. So don't do this if you don't want the entire effort described in this tutorial to fail.
If you're using the same process presented in this tutorial for captains instead of generals, you can set a captain via descr_strat.txt by using general instead of named character, but remember that traits don't work for captains, you can set them and the game won't crash, but they don't really work.