Garry's Mod

Garry's Mod

Not enough ratings
Half Life 2 Animation Fix: How It Works, and How To Take Advantage Of It
By Mmmmm Chicken Leg
Greetings! This is a guide explaining how the Half Life 2 Animation Fix works, which can be found here! This is primarily used for model makers who wish to make their own model replacements for NPCs, but if you're just a bit curious as to how it works, feel free to read up on it!
   
Award
Favorite
Favorited
Unfavorite
How It Works
How this addon works is actually pretty simple. It contains the animations, gestures, and postures that I recompiled and separated from all three games. Then I modified the final model's .QC files and compiled them to use the animations through the use of the $includemodel command.

The addon's separated animation files using the Alyx model as an example


From the original Alyx.QC file


The addon's Alyx.QC file


...and that's it, really. Sure, it was a lot of work to go through pretty much all the models and separate their animations from all three games, but it was a whole lot better than having to deal with LUA scripting (which was a good thing for me since I barely know how to code).

Though one IMPORTANT thing to note that I would like to mention is the naming convention I chose for the separate animation files:



The "unedited" files are actually the EXACT files from the Half Life 2: Episode 2 directory. I chose this particular loading order solely because of one key detail regarding the $includemodel statement:



  • "Animations and sequences are processed in-order, so subsequent animations/sequences that have name conflicts will be ignored, and any references to .mdl local entry by the same name will be overwritten with the reference to a first one declared."

Basically, what this means is that if there are two conflicting animations, the one that is included first will take priority, while the rest is skipped. Although this isn't a problem for MOST NPCs, one in particular that is affected by this is the Vortigaunts.

This following example is the Vortigaunt model with its .QC file loading the BASE Half Life 2 animations first:



The result

Notice how the Vortigaunt can still use its AOE attack and perform its Dynamic Interactions, while simultaneously having the slow attack speed and lack of a "battle stance" from the base game.

Here is a comparison between the two different load orders. In this example, only the normal vortigaunt model has the BASE Half Life 2 animations loaded first, whereas Uriah loaded with the Episode 2 animations:


Notice the difference between postures, attack speed, and battle stance.

It is because of this reason that I have compiled all of the models with the following structure for consistency:
  • Episode 2 Animations, Postures, and Gestures
  • Episode 1 Animations, Postures, and Gestures
  • BASE Half Life 2 Animations, Postures, and Gestures

As for why I kept the Episode 2 animation files names as-is, there were two reasons:
  • Models would still function even if the Animation Fix addon is NOT installed. It would simply revert to using the base HL2 animations instead.
  • Crowbar complains about an "overflowed g_numsources" error when I attempt to recompile, which from my guess is just Crowbar/StudioMDL saying: "Too many things to process. Just gonna give up. K bye."
Load Order
In contrary belief, Garry's Mod DOES have a load order regarding the way it mounts its addons. I'm not entirely sure of the intricacies of it, but for the most part it mounts addons in sequential order, from top to bottom.

What this means is that if you are using an animation fix compatible model replacement, you should load it AFTER the animation fix, like so:



If this is not done properly, your model replacements WILL NOT work; the game will end up using the default models included in the animation fix.

(You can ignore the other mods I have. Those are just model replacements I've been testing with the fix to see if they work).
$Includemodel Reference
Here are the $includemodel lines that will enable the models to use these animations. All you have to do is simply copy and paste the corresponding $includemodel commands into your .QC file and compile it. Theoretically speaking, you CAN add these animations to other models so long as their skeletons are the same, i.e. citizens can have alyx's animations so they can perform her Dynamic Interactions.

Advisor
The Episode 2 Advisor model, although offset from the monitor screens, work just fine in the previous games. Therefore, I recommend using that as the base for your model replacements.

Alyx
Alyx has numerous models that are used in certain parts of the Half Life 2 campaign and Episodes. Therefore, if you want your model replacements to properly work for all levels, be sure to replace the following:
  • Alyx.mdl - the model used all throughout the base HL2 game, Episode 1, and the very beginning of Episode 2 (before she is attacked by the Hunter).
  • Alyx_Intro.mdl - the model used at the very beginning intro sequence of Episode 1 (where you and Alyx get rescued by the Vortigaunts). It's really nothing special other than having specific animations for that sequence.
  • Alyx_Interior.mdl - the model used in Episode 2 during the Victory Mine/antlion colony portion. It is the model that is lying on the table while the Vortigaunts are healing her, as well as during the healing sequence when her muscles/body interior are shown.
  • Alyx_Ep2.mdl - the injured model used in Episode 2 AFTER Alyx is healed. From that point onward, it is used for the rest of the Episode 2 campaign.

$IncludeModel "alyx_animations.mdl"
$IncludeModel "alyx_postures.mdl"
$IncludeModel "alyx_gestures.mdl"
$IncludeModel "alyx_animations_ep1.mdl"
$IncludeModel "alyx_postures_ep1.mdl"
$IncludeModel "alyx_gestures_ep1.mdl"
$IncludeModel "alyx_animations_hlu.mdl"
$IncludeModel "alyx_postures_hlu.mdl"
$IncludeModel "alyx_gestures_hlu.mdl"
$IncludeModel "humans/female_shared.mdl"
$IncludeModel "humans/female_ss.mdl"

Antlion
The Episode 2 model contains all of the animations for all three games (and exclusively contains the Dynamic Interactions for it), so I HIGHLY recommend using that as the base for your model replacement.

Antlion Guard
The Episode 2 model contains all of the animations for all three games (and exclusively contains the Antlion Guardian skin), so I HIGHLY recommend using that as the base for your model replacement.

Barney
The Episode 1 model contains all of the animations for all three games, so I recommend using that as the base for your model replacement.

Blackout
This is the "wake-up" sequence the player camera goes through in certain parts of the campaign (when you first meet Alyx in the base game, the beginning of Episode 1 when Dog digs you out of the rubble). I believe this also contains the animations for the Advisor sequence at the end of Episode 2 (where you and Alyx are pinned to the wall). There's no point, really, in messing around with it, so only do so if you're curious.

Combine Dropship
The Episode 2 Dropship model contains all of the animations for all three games, so I recommend using that as the base for your model replacement.

Combine Strider
The Episode 2 Strider model contains all of the animations for all three games, so I recommend using that as the base for your model replacement.

Combine Turret
These are the turrets that you can pick up and place throughout the campaign. This was included so that it contains the Episode 2 skins found in the Antlion Colony holdout level. If you want to make a replacement for them, I recommend using the Episode 2 model as the base for your replacement.

Dog
$IncludeModel "dog_gestures.mdl"
$IncludeModel "dog_postures.mdl"
$IncludeModel "dog_animations.mdl"
$IncludeModel "dog_gestures_ep1.mdl"
$IncludeModel "dog_postures_ep1.mdl"
$IncludeModel "dog_animations_ep1.mdl"
$IncludeModel "dog_gestures_hlu.mdl"
$IncludeModel "dog_postures_hlu.mdl"
$IncludeModel "dog_animations_hlu.mdl"

Eli
One important thing to note about the Eli model is that the Episode 2 variant has a specific bone/joint for the pipe he picks up at the end of Episode 2. Therefore, I HIGHLY recommend using the Episode 2 model as the base for your model replacement, otherwise Eli WILL NOT pick up that pipe.

$IncludeModel "eli_anims.mdl"
$IncludeModel "eli_postures.mdl"
$IncludeModel "eli_gestures.mdl"
$IncludeModel "eli_anims_ep1.mdl"
$IncludeModel "eli_postures_ep1.mdl"
$IncludeModel "eli_gestures_ep1.mdl"
$IncludeModel "eli_anims_hlu.mdl"
$IncludeModel "eli_postures_hlu.mdl"
$IncludeModel "eli_gestures_hlu.mdl"
$IncludeModel "humans/male_shared.mdl"
$IncludeModel "humans/male_ss.mdl"

Fast Zombie
The Episode 2 Fast Zombie model contains all of the animations for all three games (and has exclusive wake-up animations found in Episode 2), so I HIGHLY recommend using that as the base for your model replacement.

Fast Zombie (Torso)
The Episode 2 Fast Zombie (Torso) model contains all of the animations for all three games, so I recommend using that as the base for your model replacement.

Gman
$IncludeModel "Humans/male_shared.mdl"
$IncludeModel "breen_anims.mdl"
$IncludeModel "gman_gestures.mdl"
$IncludeModel "gman_postures.mdl"
$IncludeModel "gman_animations.mdl"
$IncludeModel "gman_gestures_ep1.mdl"
$IncludeModel "gman_postures_ep1.mdl"
$IncludeModel "gman_animations_ep1.mdl"
$IncludeModel "gman_gestures_hlu.mdl"
$IncludeModel "gman_postures_hlu.mdl"
$IncludeModel "gman_animations_hlu.mdl"

Kleiner
The Episode 2 Kleiner animations, postures, and gestures files contain all of the animations for all three games. Theoretically speaking, it doesn't matter which Half Life 2 model version to use, but I recommend using the Episode 2 variant as a base since it's the more updated one.

Lamarr
The Episode 2 Lamarr model contains all of the animations for all three games. Therefore, I HIGHLY recommend using it as the base for your model replacement.

Mossman
The Episode 1 Mossman model contains all of the animations for all three games, so I recommend using that as the base for your model replacement.

Roller (the rollermines)
The Episode 1 Roller model contains all of the animations for all three games. This was included so that the yellow skin shows up when Alyx converts it. If you want to make a replacement for it, I HIGHLY recommend using that as the base for your model replacement.

Vortigaunt/Vortigaunt Blue/Vortigaunt Doctor/Vortigaunt Slave
One important thing to note here is the Vortigaunt_Blue model. In Episode 1, it is used in the intro sequence where they teleport you and Alyx out, as well as keep Gman away.

In Episode 2, interestingly, it is used all throughout the Victory Mine/Antlion Colony level instead of the base Vortigaunt model. This is because of the Alyx healing sequence where the blue effect gradually replaces their textures. It is also because of this that the Episode 1 intro sequence is still borked (however it is currently FIXED in the 64-bit beta branch as of 6/27/2024).

$IncludeModel "vortigaunt_anims.mdl"
$IncludeModel "vortigaunt_gestures.mdl"
$IncludeModel "vortigaunt_postures.mdl"
$IncludeModel "vortigaunt_anims_ep1.mdl"
$IncludeModel "vortigaunt_gestures_ep1.mdl"
$IncludeModel "vortigaunt_postures_ep1.mdl"
$IncludeModel "vortigaunt_anims_hlu.mdl"
$IncludeModel "vortigaunt_gestures_hlu.mdl"
$IncludeModel "vortigaunt_postures_hlu.mdl"

Zombie
The Episode 2 zombie model contains all of the animations for all three games as well as Dynamic Interactions, so I recommend using that as the base for your model replacement.

Zombine
The Episode 2 zombine model contains all of the animations for all three games, so I recommend using that as the base for your model replacement.
Why Make This Guide?
The purpose of this guide is to, essentially, prove that model replacements are actually possible in Garry's Mod. In fact, even though I've been procrastinating on making this guide for almost a year, I actually HAVE been playing the game with model replacements. With all three games. From start to finish. Within Garry's mod.

Want proof? THEN BEHOLD:

We're looking at, POTENTIALLY, a new era of GMOD workshop addons full of model replacements similar to Left 4 Dead 2!
Other Stuff To Improve Your Campaign Experience
This section covers some tidbits I discovered while I tested and replayed the Half Life 2 campaign and its episodes. Feel free to use these to make your experience better!

Half Life 2 Save Menu
Did you know that you can still access the old Half Life 2 save menu in Garry's Mod? Simply use the following commands:

gamemenucommand opensavegamedialog (opens the save menu)
gamemenucommand openloadgamedialog (opens the load menu)

I found the save system to be surprisingly stable, even with addons that are a bit heavy on scripts. These work for custom maps as well (though I haven't tested this in Multiplayer)!

One thing I have noted is that save files tend to become more unstable/prone to crashes if an addon is updated/added/removed, but if that happens simply delete all saves and autosaves in the GarrysMod/garrysmod/save folder.

Half Life 2: Update Mount
You can also mount the Half Life 2: Update version into Garry's Mod, though you will have to do it manually. To do so, go to your GarrysMod/garrysmod/cfg folder, open mount.cfg, then add the installation path to your Half Life 2: Update. It to look something like this (the file path to YOUR installation of HL2: Update will look different than mine, so don't just copy/paste!):

"mountcfg"
{
// "cstrike" "C:\steamcmd\steamapps\common\Counter-Strike Source Dedicated Server\cstrike"
// "tf" "C:\mytf2server\tf"
"hl2" "D:\SteamLibrary\steamapps\common\Half-Life 2 Update\hl2"
}

Afterwards, be sure to UNMOUNT the original Half Life 2 game in Garry's Mod, otherwise it will override the changes.



I highly recommend doing this because not only does it have better lighting, map HDR fixes, and other tidbits (for example, Breen actually being animated during the Kleiner lab teleport sequence)!






NOTE: certain particles from HL2: Update will not properly mount onto Garry's Mod, but I made a fix just for that HERE! You're welcome!
FAQ
Yay, the FAQ! If anything else important comes up I'll update this page.

Q: Does my model need the Animation Fix Addon to work?
A: NOPE! Through testing, it seems that the source engine ignores $includemodel statements that lead to a missing .mdl file; it doesn't even throw any errors! Which means that without the animation fix, the model will work just fine but will only contain the animations for the base HL2 game (so long as you use the same naming convention I did).

Also because of this, you can just slap "Animation Fix Compatible" or something like that at the title of your addon and you're good to go.

Q: Why aren't my model replacements working?!
A: It is most likely an addon conflict. To troubleshoot, I would check the following:
  • Did you restart your game AFTER downloading and installing the fix?
  • Have you tried disabling/uninstalling all addons, and keeping the animation fix and model replacement enabled?
  • Is your load order correct? (Basically, is your model replacement addon loaded AFTER the animation fix?)
If you tried all of that, then most likely it is an addon conflict of some sort, and at that point you will have to find which addon is causing it and disable/uninstall it.

Why do the base Half Life 2 animations end with _hlu?
A: I decided to recompile the files used in the Half Life 2: Update version instead of the ones from the original. I figured that it's the more up-to-date version, so why not?
4 Comments
player9 17 May @ 8:27am 
Thx bro. finally someone made a good explanation about animation of episode 1,2
LandfallGhost 6 Dec, 2024 @ 8:49pm 
will this guide be updated with the new anniversary update?
Mmmmm Chicken Leg  [author] 8 Jul, 2024 @ 12:22pm 
@cc123 Great! Let me know if it was a success. I would love to have a confirmation that it works for someone else.
cc123 8 Jul, 2024 @ 5:35am 
Would definitely use this for my HLA Dog replacement. Thanks!