Add Anim Data: Modding Tutorial
-- How to Apply Unique Animations to Your Follower --
* Created by GomaPudding - Feb 03, 2018
Sep 09, 2018 - added "Advanced Tutorial 1"
This tutorial will show you how to use Add Anim Data for applying unique animations to your follower.
Basic Tutorial: apply unique animations to your follower
Here is an example of applying unique 1hm_equip.hkx and 1hm_unequip.hkx animations to your female follower.
Thank you very much for reading. Honestly, I think that it is the most difficult to explain how to use the tool.
Advanced Tutorial 1: control the coordinate moving of your follower during animation
I don't know whether the term "coordinate moving/movement" is appropriate, but here I will express the movement behavior of character's position in 3D space with that term.
For example, the forward power attack does not accept control by a player while the animation is valid, but player character automatically moves forward according to predefined coordinate movement information, which is separated from hkx animation files and is defined in "animationdatasinglefile.txt". For such animations, you can modify their coordinate movement behavior by using my tool. Before the concrete explanation, I will explain how the coordinate movement is defined in vanilla.
The coordinate movement information in animationdatasinglefile.txt file
First of all, I will explain the contents of "animationdatasinglefile.txt" in vanilla. You can also find the vanilla file from my tool folder. That is GPT01_AddAnimData_010\vanilla\meshes\animationdatasinglefile.txt. This file contains data of approximately 170,000 rows in total. Here, I will explain the contents while indicating the place of description by line number. So I recommend reading this explanation while actually checking the file with a text editor that can display line numbers. Also, please note that the following description is based on the result of trial and error, so it may contain incorrect information.
Lines 1 to 430 are like a list of animation definition groups. The number 429 on line 1 indicates the number of these groups. (Or I should say that it indicates how many lines of information are written in this list section.)
Below line 430, the animation definitions are described in the order of these groups. For example, there are the name of "DefaultFemale" in line 10 and "DefaultMale" in line 11, which mean the animation difinition group name for female and male respectively. The actual definition of DefaulFemale is described in lines 8732 to 46491. In the same way, that of DefaultMale is described in lines 46492 to 84279. Both DefaultFemale and DefaultMale have almost the same contents, so I will explain about DefaultFemale.
The animation definition section of DefaultFemale shown in lines 8732 to 46491 is roughly divided into two parts. The number 25054 on line 8732 indicates how many lines the first half part has. That is, the last line of the first half part is line 33786 (8732 + 25054), so the second half part starts from line 33787. The coordinate movement information is described in the second half part, but since all the information on this part is described by row of numbers, it is impossible to catch the relationship between each animation and its corresponding coordinate movement information even by checking only this part. In order to know which information is described, it is necessary to confirm the corresponding ID number from the information of the first half part. So, I will explain the contents described in the first half part by giving examples.
In the first half part, for example, the information of the forward power attack for one-handed swords is described in lines 25318 to 25331. Line 25318, that is "1HM_AttackPowerFwdUncropped" in the first line of this information is the definition name of the animation. (About this definition name, you can probably guess from the hkx animation file name, 1hm_attackpowerfwd.hkx.) The line just below it, the number 8 in line 25319 is the ID number of the coordinate movement information. The other information below shows the occurrence time of system events related to this animation. Looking at this, you can see that HitFrame is 0.733 seconds, for example. Please note that changing the occurrence time of the system event will not be reflected in the game. Probably this information is only shown as a result and is assumed to be not loaded at startup. And one more thing, there is another animation definition name of 1 HM_AttackPowerFwd_Outro on line 25332, which also has the same ID number. The details will be described later, but my tool gets the ID number of the coordinate movement information from the animation definition name, so even if we use either definition name the result is the same.
Now, as we know the ID number of the coordinate movement information corresponding to 1HM_AttackPowerFwd, let's move to the explanation of the second half part. The coordinate movement information of ID number 8 is described in lines 33856 to 33874. The first line, that is, the number 8 on line 33856 indicates the ID number. In this second half part, since the information is almost arranged in order of ID number, I think it is relatively easy to find the desired information. The number just below the ID number, that is, 1.5 on line 33857 indicates the playback time of the animation. (The unit is "sec".) The actual coordinate movement data is described in lines 33859 to 33872. Here, four numbers are arranged per a line, and these are considered as one data set. This data set indicates time (sec), X coordinate, Y coordinate and Z coordinate in order from the left. The number 14 on line 33858 indicates how many lines this data set is. Looking at a series of data, you can see that only the value of Y coordinate increases with time. That is, this coordinate movement information shows that it is only moving forward. With the similar description rule, the information of the coordinate axes rotation is also described from lines 33873 to 33874, but since it is rarely used, its explanation is omitted here. (That Data is described with quaternion.)
The description rules for the coordinate movement modification in lis file
Actually, the most important explanation has already been finished above. Continue to use 1HM_AttackPowerFwd as an example, I will explain how to modify the coordinate movement of this animation with the tool.
To modify the coordinate movement information, add the description to the lis file (before the ".end" line) like the following. (Please refer to this video for the actual animation.)
"1HM_AttackPowerFwdUncropped" in the first line corresponds to the animation definition name as described above. The lines other than the first and last lines match the description rule of the part excluding the ID number of the coordinate movement information described above. It is necessary to carefully check if there are no mistakes in the number of lines of the coordinate movement data set (20 in this case) or the contents of the data set. If you make a mistake, the entire animation may not work properly or the game itself may not start.
When modifying coordinate movement especially for power attacks, there are some points to note. First, you can not modify the time when HitFrame event occurs with my tool and also can not apply additional HitFrame. (Although it is possible to show pseudo multiple attacks by using some scripts together, I will not explain the way here.) Second, in the case of NPC, the coordinate at HitFrame time are related to the factors that determine whether to attack. For example, if NPC is moving backward far away from the initial position at HitFrame time, NPC can probably not use that power attack because an enemy almost never come to that position. Finally, especially when NPC moves forward, if NPC hits an enemy (or obstacle) on the half way of the coordinate movement, NPC can not move to the desired coordinate. There are several ways to avoid this, but the details will be explained in the next tutorial.
By the way, the animation playback time of the above forward power attack is 4.833333 sec, which is considerably longer than 1.5 sec in vanilla. Other animations will not be played while the coordinate movement is controlled, so it is also possible to apply longer animation than vanilla. However, it is supposed that animation processing must be completed at the playback time specified by vanilla in terms of internal processing. So note that this trick actually works well but it is not a formal modification method.
Advanced Tutorial 2: how to make attractive power attack animations with scripts