Here is how it works. It's pretty simple:
1) In the class "btl_init", the array "model_id" contains the list of the player character's models:
Code: [Select]
Code:
Zidane (2 of them),Vivi,Dagger (4 of them),Steiner (2 of them),Quina,Eiko (2 of them),Freya,Amarant,Cinna,Marcus,Blank (2 of them),Beatrix,Zidane Trance (that's the 20th, at index 19 and there are 2 of them just like the regular),Vivi Trance,etc...up to Amarant Trance.
Which makes a list of size 19 (regular) + 14 (trance) = 33 models.
These are different model names but I think that they mostly use the same mesh files and the different names are meant to link to different animations (but I'm not sure, that's what I remember about). Anyway, the duplicates are because of the different fighting stances when using, for example, thief daggers or thief swords. Dagger also has her long/short hair versions.
About Steiner, I think the difference has to do with a flag that can be activated in the "Battle" and "BattleEx" script codes, but it's a dummied feature and never actually used.
2) The methods "BattlePlayerCharacter::CreateTranceModel" and "btl_init::SetBattleModel" setup the models at the start of the battle. They create both a regular and a trance model/skin for those who have it and hide the trance version. The condition is simply "if ((int)(serialNumber + 19) < btl_init.model_id.Length) // add a trance version" for both methods.
Note that there is a duplicate of the regular model list, "BattlePlayerCharacter:

layerModelFileName" for some impractical reason. The lists used are thus:
- "BattlePlayerCharacter:

layerModelFileName" for the regular model and "btl_init::model_id" for its skin (geotexanim),
- "btl_init::model_id" for the trance model and its skin.
3) When creating a trance model, the animations are entirely taken from the regular model so you don't need to care about it (but the trance model has to have exactly the same bone hierarchy as the regular one). I suppose that there is no problem in taking the same "geotexanim" as the regular one or even don't use geotexanim at all (I don't really see a texture animation on battle models, except the trance glowing but that's handled automatically elsewhere).
4) In HW's "Party -> Stats" panel, there's some setting to do in order to have a proper trance command.
5) Characters have a trance gauge if they are not setup with category "temporary character" in the script code initializing them ("SetCharacterData"). Also, trance gauge is disabled early game and for Dagger when she's depressed.
6) Also, another array must be extended for Beatrix. In the method "btl_stat::SetStatusVfx", which mostly takes care of glowing effects (and floating/confused but we don't care there), you can find an array like that
Code: [Select]
Code:
byte[][] array = new byte[][]new byte[] { 255, 96, 96 },// etc...
These are RGB color factors for the glowing effect of the trance. You must extend the array with one entry (of 3 bytes) corresponding to Beatrix's glowing effect when she turns to trance. The default color factor is 128, which means that "{ 128, 128, 128 }" will not display any glowing at all. Personally, I used the following in my mod:
Code: [Select]
Code:
new byte[] { 255, 160, 128 }
In conclusion
In order to add a properly working trance to Blank, Cinna, Marcus or Beatrix, you need to do 3 things:
• In HW, setup a trance command for the character (define it in the panel "Party -> Commands" and give it to the character "Party -> Stats"; remind that Beatrix has 2 ability sets),
• In HW, remove the "Temporary Character" category of the character(s) you want to give trance to. It's in the "Environment -> Fields" scripts, when the characters join the team, there are lines "SetCharacterData" to tweak a bit. For instance, Beatrix's character data is initialized twice:
-- in the script "A. Castle/Queen’s Chamber" (one of them anyway, there are several ones... the good one has "Bandersnatch" functions in its script), whithin the function "Beatrix_Loop", there's a line "SetCharacterData( 8, 1, 11, 22, 14 )" near 4/5 of the function.
-- in the script "Alexandria/Square" (the one at night), whithin the function "Steiner_Init", there's a line "SetCharacterData( 8, 1, 13, 22, 15 )". In both cases, the change should be replacing the argument "22" by a "6" to remove the "Temporary Character" category.
• In dnSpy, append 5 lines to "btl_init::model_id" by giving trance models.
-- Either use the exact same models as the regulars (ie. append "GEO_MAIN_B0_013", "GEO_MAIN_B0_014", "GEO_MAIN_B0_015", "GEO_MAIN_B0_016" and "GEO_MAIN_B0_017" to the list): the only difference will be the glowing,
-- Or use another existing model and the same bone hierarchy (the correspondances between "model name" and "model numerical ID" is in the dictionary "FF9BattleDB::GEO"),
-- Or find a way to import a workable new model with the right bone hierarchy and register it in both "FF9BattleDB::GEO" and "btl_init::model_id". I have been unsuccessful to import a workable model, as the files added to the archives require a lot of registering and linkage and I apparently miss some (I don't remember if I successfully imported a new texture with the Unity Assets Viewer...).
• Still in dnSpy, append 1 entry to the local array that can be found around the middle of "btl_stat::SetStatusVfx".