Custom Animations
Mapbase makes several changes to the animation sets used by HL2 NPCs. These changes mainly apply to human NPCs, including npc_citizen, npc_combine_s, npc_metropolice, and other NPCs that share their animations (e.g. npc_alyx).
Weapons
Fix missing weapon animations
In default HL2, some NPCs cannot use certain weapons because they are missing the animations needed to support them. For example, npc_combine_s is not capable of using weapon_pistol in default HL2 without T-posing. Mapbase approaches this issue in two ways:
- By directly adding full animation sets for several weapons. For example,
npc_combine_snow has a full animation set forweapon_pistol. - By using a new “backup activity” system which allows NPCs to fall back to the nearest approximate weapon animation instead of T-posing. For example, a NPC with a
weapon_rpgthat has no RPG animations will fall back toweapon_smg1animations.
Custom weapon animations
Mapbase adds completely custom animations for the following weapons:
weapon_crossbowweapon_357weapon_annabelle
Every NPC has custom aiming, firing, and/or reloading animations for the above weapons. They otherwise fall back to the aforementioned backup activity system.
Unused weapon activities
Mapbase optionally comes with a bunch of unused weapon activity sets intended for use by mods. Many of these weapons exist or are mentioned in the SDK, but are not integrated into mods by default. This includes the following:
AR1AR3SMG2SMG3HMG1SNIPER_RIFLEDUAL_PISTOLS
In order to use these animation sets, they must be enabled in the code. Go to ai_activity.h and set EXPANDED_HL2_UNUSED_WEAPON_ACTIVITIES to 1 if you want to use them.
Regardless of whether these are enabled in code, Mapbase comes with custom animations for some of these weapon sets. For example, Combine soldiers have an animation set for the AR1 which uses a hand position more closely resembling that of a “traditional” assault rifle as opposed to the AR2.
Cover nodes
Low cover fixes
Mapbase fixes hint nodes set to the Crouch Cover Low type so that NPCs can use them outside of standoffs.
Medium cover support
Mapbase adds proper support for medium cover nodes, as well as support for medium cover in standoffs.
In default HL2, medium cover is an unfinished feature that mainly manifests with the Crouch Medium Cover hint node. By default, this hint can only be used by Combine soldiers, although they have no unique medium cover animation.
Mapbase converges the concept of medium cover with another problem: While soldiers and citizens in low cover use crouching animations, metrocops in low cover use unique, half-crouching animations when aiming/shooting. This causes inconsistencies in standoffs, as standoff behavior assumes low attack animations allow NPCs to see over cover while the regular low cover animation is “safely in cover”.
Mapbase adds dedicated medium cover attack activities that are analogous to the low cover activities. Using the backup activity system, most NPCs will default to low cover animations when selecting a medium cover activity, but the metrocops have been given dedicated crouching animations to replace their half-crouched animations, while the latter have been remapped to use medium activity names.
These are used in two ways:
- In standoffs, NPCs use either low cover, medium cover, or standing animations when shooting, depending on which one gives them LOS. Metrocops are mostly unaffected, but citizens and soldiers will now properly stand up to shoot when peeking out of cover that they normally would not be able to peek from with regular low cover animations.
- While using medium crouch nodes, NPCs will either use medium cover animations or fall back to low cover animations.
Remapped activities
Many existing animations have had their Activity changed in order to be more consistent across different NPCs and work as would be expected from the base activity definitions.
For example, in stock Half-Life 2, if you place a npc_citizen with no weapon, it will use a generic unarmed idle animation called ACT_IDLE. When the citizen is holding a weapon, it will use a weapon-specific animation with its own suffix, such as ACT_IDLE_SMG1. This process is known as activity translation, and all NPCs with weapons do it automatically.
However, even though all NPCs translate activities, not all NPCs have activities which match up with what the game expects. For example, npc_combine_s’s base ACT_IDLE actually holds a weapon. Its unarmed idle animation uses a separate ACT_IDLE_UNARMED, which does not exist in any other NPC and can only be translated by custom code. This is why spawning a Combine soldier with no weapon causes them to still look like they’re holding one in most games.
Mapbase changes the activities on these animations to be more consistent with the base implementation, and thus work as expected with their weapon state. For example, by changing the soldiers’ unarmed activity to ACT_IDLE, Combine soldiers will now look and act unarmed when they have no weapon. This does not affect them when they hold weapons because the weapons already translate it to their respective animations.
The following animations have had their activities changed to something else:
combine_soldier_anims.mdl (npc_combine_s)
| Sequence | Original Activity | New Activity | Reason |
|---|---|---|---|
Idle1 |
ACT_IDLE |
ACT_IDLE_AR1 |
This animation involves holding an assault rifle. "AR1" is the closest approximation given the hand position. |
Walk_all |
ACT_WALK |
ACT_WALK_AR1 |
This animation involves holding an assault rifle. "AR1" is the closest approximation given the hand position. |
RunALL |
ACT_RUN |
ACT_RUN_AR1 |
This animation involves holding an assault rifle. "AR1" is the closest approximation given the hand position. |
Idle_Unarmed |
ACT_IDLE_UNARMED |
ACT_IDLE |
This is a "true" unarmed idle animation. In order to retain support for code which calls ACT_IDLE_UNARMED, the ACT_IDLE variant is a separate hidden sequence rather than a direct replacement. |
WalkUnarmed_all |
ACT_WALK_UNARMED |
ACT_WALK |
This is a "true" unarmed walking animation. In order to retain support for code which calls ACT_WALK_UNARMED, the ACT_WALK variant is a separate hidden sequence rather than a direct replacement. |
CombatIdle1 |
ACT_IDLE_ANGRY |
ACT_IDLE_ANGRY_AR2 |
This animation was created with the AR2 in mind. |
police_animations.mdl (npc_metropolice)
| Sequence | Original Activity | New Activity | Reason |
|---|---|---|---|
batonidle1 |
ACT_IDLE |
ACT_IDLE_MELEE |
ACT_IDLE is normally used for unarmed animations and then translated to weapon counterparts. |
walk_all |
ACT_WALK |
ACT_WALK_MELEE |
ACT_WALK is normally used for unarmed animations and then translated to weapon counterparts. |
run_all |
ACT_RUN |
ACT_RUN_MELEE |
ACT_RUN is normally used for unarmed animations and then translated to weapon counterparts. |
lowcover_shoot_pistol |
ACT_RANGE_ATTACK_PISTOL_LOW |
ACT_RANGE_ATTACK_PISTOL_MED |
Part of the support added for "medium" cover. To be more consistent with other NPCs, there is a custom crouch animation which takes the place of this one. |
lowcover_aim_pistol |
ACT_RANGE_AIM_PISTOL_LOW |
ACT_RANGE_AIM_PISTOL_MED |
Part of the support added for "medium" cover. To be more consistent with other NPCs, there is a custom crouch animation which takes the place of this one. |
lowcover_shoot_smg1 |
ACT_RANGE_ATTACK_SMG1_LOW |
ACT_RANGE_ATTACK_SMG1_MED |
Part of the support added for "medium" cover. To be more consistent with other NPCs, there is a custom crouch animation which takes the place of this one. |
lowcover_aim_smg1 |
ACT_RANGE_AIM_SMG1_LOW |
ACT_RANGE_AIM_SMG1_MED |
Part of the support added for "medium" cover. To be more consistent with other NPCs, there is a custom crouch animation which takes the place of this one. |
Supplementary features
Mapbase adds several optional, sometimes specialized features.
Dynamic interactions
Mapbase ports Alyx’s dynamic interactions with zombies to all human NPCs except npc_combine_s. They can be controlled using a new “Dynamic interactions enabled” keyvalue on NPCs.
