Mapbase/Entities/NPCs/Custom Animations

From Valve Developer Community
< Mapbase‎ | Entities‎ | NPCs
Jump to navigation Jump to search

Mapbase Mapbase adds custom animations to many Half-Life 2 Half-Life 2 NPCs and modifies many existing ones. These changes are intended to increase consistency between NPCs as well as provide additional capabilities for mappers and modders.

Custom weapon animations

[Todo]

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 is known as translating activities, 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.

The following animations have had their activities changed to something else:

combine_soldier_anims.mdl (npc_combine_s)

Note.pngNote:Mentions of "AR1" refer to a new set of intentionally unused weapon animations representing different hand positions. See the Unused weapon activities section for more details.
Sequence Original Activity New Activity Notes
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 for the AR2 in mind.
Icon-Bug.pngBug:Since there is no replacement for default ACT_IDLE_ANGRY, unarmed soldiers may T-pose under specific circumstances.  (tested in: Entropy : Zero 2)

police_animations.mdl (npc_metropolice)

Sequence Original Activity New Activity Notes
batonidle1, batonidle2 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.

Medium cover support

[Todo]

Readiness animations

[Todo]

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:

  • AR1
  • AR3
  • SMG2
  • SMG3
  • HMG1
  • SNIPER_RIFLE
  • DUAL_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.

Optional dynamic interactions

[Todo]