Tutorial for Adding Custom Unit Animations to SIDE instead of COMMON

Started by Phobos, November 01, 2014, 09:58:46 AM

Previous topic - Next topic
Tutorial for Adding Custom Unit Animations to SIDE instead of COMMON
Written by Phobos, thanks to Sereja and MileHighGuy for their efforts in this area of modding.

I have recently discovered a way to add custom unit animation support directly to the side.lvl instead of having to use a custom common.lvl for mod maps. I was able to add "zombie hunch" from BF2 wampa animations like Sereja did on Polar express without modding the common. I plan on adding animation munger support to the new side builders for toolbox v5, but for now this tutorial can be used. If you are specifically modding zombie sides and want to skip steps 1-10, I have included the "Zombie Hunch" animation assets used in Night Of The Living Dead (and I think they are the same as used in Polar Express) in an attachment to this thread.

1) Download this tool, the yoda animation munger by MileHighGuy
http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=1140

2) I also followed most steps in this tutorial by Sereja, however I could not get the animation files to munge in BFBuilder or using a 64bit PC. Read this for reference
http://www.swbfgamers.com/index.php?topic=8089

3) Now that you have the yoda animation munger you need to extract it (directly to C:\BFBuilder is best) and go to this folder
C:\BFBuilder\Bf1_yoda_v2_milehighguy\Common\Animations\yoda

4) Now look for the file "human_gam_stand_shoot.msh" and delete it. You will be replacing this with another file which you need to obtain from the BF2 mod assets which you can obtain here
http://www.swbfgamers.com/index.php?action=downloads;sa=view;down=541

5) Look in this folder for a bunch of different animation subfolders which you can experiment with. I have only tested a few animations in BF1 so far.
C:\BFBuilder\BF2_ModTools\assets\Animations\SoldierAnimationBank

6) Pick the MSH file you want to use, in the case of Polar Express and NOTLD we used this file
C:\BFBuilder\BF2_ModTools\assets\Animations\SoldierAnimationBank\wampa\wampa_sabre_stand_dashattack_full.msh

7) Rename the "wampa_sabre_stand_dashattack_full.msh" to "human_gam_stand_shoot.msh" and paste into the Yoda folder.

8) You can exclude these other 3 files Sereja mentions in his tutorial if you're replacing just Melee Weapon Animation, but if you plan on replacing Unit Animations completely you need to copy and replace these too:
human_gam_stand_idle_emote.msh
human_gam_stand_walkforward.msh
human_gam_stand_runforward.msh

Quote from: MileHighGuy on November 01, 2014, 10:35:59 AM
The game does recognize all replacements, just when you put animations only on a secondary weapon, the custom animations only play when you fire it. If it was a primary weapon they would be active all the time. Yoda has many replaced animations.

9) Before you click munge.bat (in the yoda folder), you want to Edit the Batch file in Notepad to save the file as GAM instead of YODA. You can change it to anything you want it doesn't have to be GAM.
Here is what it says:  @call ..\munge_animation.bat "/keepframe0 /dest yoda.zaf /comp_debug 0 /debug" ..\..\..\Sides\mhg
Change it to say this: @call ..\munge_animation.bat "/keepframe0 /dest gam.zaf /comp_debug 0 /debug" ..\..\..\Sides\mhg

10) Click the munge.bat and when its finished navigate to this folder
C:\BFBuilder\Bf1_yoda_v2_milehighguy\Sides\mhg\munged

11) Now you should see two new files: GAM.zaabin and GAM.zafbin. If you do not see these files the munger did not work on your PC, you must try again on 32-bit. Copy these files directly into your custom side builder's munged folder, for example
C:\BFBuilder\DataNLD\Sides\NLD\munged

12) So far so good, the next step was only discovered to work through trial and error based on ideas mentioned by MileHighGuy. This will essentially trick the game into allowing a custom animation bank to be referenced from the SIDE instead of COMMON. Although you can only load one custom bank this way, you can store as many as you want in the munged folder for storage and testing. Now go into the ODF folder of your side builder.

13) One unit called upon by the LUA must contain new lines in the ODF to call on the animation. This should NOT be the unit(s) that will be using the new unit animations. I am not sure if the chosen unit actually has to spawn in the map or not, in my case I used the Wavespawner Warlock who dies within 15 seconds, but you might be able to add it to a Hero ODF instead. It will distort the looks of the unit in game severely, so you have to test it to see what works and what doesn't. You need to null the snowtrooper line and add all 4 of these lines to the chosen unit ODF or it won't work
//AnimationName = "all_inf_snowtrooper"
AnimationName = "gam"
AnimationLowRes = "gam"
SkeletonName            = "gam"
SkeletonLowRes          = "gam"


14) Now you will need to edit the weapon ODFs for each weapon you want to have the new animation. Units will only use this new animation when the weapon that calls on it is being used. So for zombies I gave them their own set of melee ODFs, and changed the AnimationBank line from "lightsabre" to "gam".
AnimationBank       = "gam" // "lightsabre" // "grenade"

15) Now you munge the side.lvl and test to make sure it works. Congrats, you have now added a custom unit animation bank to the BF1 side without having to touch the common! I have not tested other converted BF2 animations with melee weapons yet, just the wampa animations on zombies. Let me know if you find any that are as good or better than Wampa Dash Attack.