Experience Half-Life 2 like never before. Return to City 17, held within the iron grip of the Combine and the Consul. Reunite with old friends, and enemies. Traverse vicious canals, make new allies, and brave the horrors of the Quarrytown. Immerse yourself in a revitalised combat system featuring old arsenals made new again, with added features to raise the bar in gameplay. You've been waiting for quite some time, now. It's time to climb aboard.

Report RSS Modding RTBR: Weapon Viewmodel Features

Guide to the features added to RTBR's weapon viewmodels over HL2.

Posted by on - Intermediate Weapons Modelling

This guide will teach you some of the additional fundamentals added to RTBR's weapon viewmodels so that if you're creating your own weapon replacement, you know what features you need to take into account. It assumes you're already familiar with all the functions of weapon replacements in HL2, so we'll only be discussing what's new to RTBR specifically. This guide will also not detail weapon-specific features (such as secondary fires present in some weapons) as those are a case-by-case basis.

First-Time Pickups & Idles

RTBR introduces two new aesthetic animation sets that are generally consistent across all weapons - pickups for the first time a weapon is added to a player's inventory (which notably means it will play every time the player's inventory is emptied out and a weapon reacquired), and idle animations (which typically play after 5-10 seconds of inactivity). Every weapon eventually should have a first-time pickup animation and two idle animations.

hammershortcutaddress3

First-time pickup animations


hammershortcutaddress3

Idle animations


In the .qc of a given viewmodel, the first-time pickups are listed under ACT_VM_FIRSTDRAW:

$sequence "drawfirst" {
"v_Pistol_anims\drawfirst.smd"
activity "ACT_VM_FIRSTDRAW" 1
{ event AE_CL_PLAYSOUND 85 "Weapon_Pistol.Slide_Release" }
{ event AE_CL_PLAYSOUND 118 "Weapon_Pistol.Mag_In" }
{ event AE_CL_PLAYSOUND 126 "Weapon_Pistol.Slide_Release" }
fadein 0.2
fadeout 0.2
node "Ready"
snap
fps 36
}

Meanwhile, in the .qc, idles are listed under ACT_VM_FIDGET. Both idles should use the same activity, just different sequences/names for the animation SMD:

$sequence "idle_fidget2" {
"v_Pistol_anims\idle_fidget2.smd"
activity "ACT_VM_FIDGET" 1
fadein 0.2
fadeout 0.2
fps 60
}

How you choose to execute these animations is ultimately up to you. On RTBR, first-time pickups are intended to showcase all the important visual elements of a weapon and do something fancy that teases its functionality. Idles are generally one simple action (e.g. examining the gun briefly or a small hand movement) and one complicated action (e.g. checking the chamber, examining the gun, or interacting with a notable function).

Reload & Draw Frames

Reload and draw frames are both functions which denote a weapon's firing readiness prior to when the animation actually allows you to fire. For draw frames this will allow you to fire more quickly after drawing the weapon, if the player wants to skip the draw animation, at a time when it makes sense (i.e. weapon pointing forward). For reload frames, the animation can't be interrupted with a left click, but the magazine will refill at a specific frame which will allow a player to quick switch and have a refilled weapon. Both allow you to put detail into your draw and reload animations, but put the choice in the player's hands if they'd like to play quicker.

hammershortcutaddress3


In the .qc, the draw frame animation event is denoted with AE_WPN_DRAWN, with the number being the frame it activates:

$sequence "draw" {
"v_Pistol_anims\draw.smd"
activity "ACT_VM_DRAW" 1
{ event AE_WPN_DRAWN 12 "" }
fadein 0.2
fadeout 0.2
node "0"
snap
fps 33
}

In the .qc, the reload frame animation event is denoted with AE_WPN_RELOAD, with the number being the frame it activates:

$sequence "reload" {
"v_Pistol_anims\reload.smd"
activity "ACT_VM_RELOAD" 5
{ event AE_CL_PLAYSOUND 15 "Weapon_Pistol.Mag_Release" }
{ event AE_CL_PLAYSOUND 27 "Weapon_Pistol.Mag_Out" }
{ event AE_CL_PLAYSOUND 34 "Weapon_Pistol.Mag_Futz" }
{ event AE_CL_PLAYSOUND 58 "Weapon_Pistol.Mag_In" }
{ event AE_CL_PLAYSOUND 77 "Weapon_Pistol.Slide_Release" }
{ event AE_WPN_THROWMAG 34 "Pistol 2" }
{ event AE_WPN_RELOAD 68 "" }
fadein 0.1
fadeout 0.2
node "0"
fps 60
}

For draw frames, you should probably pick when the weapon has already settled in its movement and is now pointing forwards. For reload frames, we tended to pick the first frame a magazine is fully inserted (so not the first frame it touches the gun).

Magazine Drops

Magazine drops are a feature that started as being derived from shell ejections (and behave similarly), but are now debris physics objects. They are ejected from the player and give a little bit of extra manual detail to weaponry.

hammershortcutaddress3

Ejected magazine


Magazine drops are defined code-side and as a result can not be added to weapons .qc side that don't already have them, but our end goal is for all relevant weapons to have this functionality so as long as the weapon you're replacing currently does this, you'll have no problems. In the future we may look into adding dummy entries into the code for the purposes of less-conventional weapon replacements.

In addition, the model name for a given magazine ejection is also defined in code, so your replacement model name must be the same as the original. If you replaced the AKM magazine for example, the model should go in models/weapons/akm/m_akm.mdl.

Assuming a weapon has the code for it, the animation event is AE_WPN_THROWMAG, with the number denoting the frame the magazine ejects and the name being the entry as defined in code. You should keep your name the same as a result:

$sequence "reload" {
"v_Pistol_anims\reload.smd"
activity "ACT_VM_RELOAD" 5
{ event AE_CL_PLAYSOUND 15 "Weapon_Pistol.Mag_Release" }
{ event AE_CL_PLAYSOUND 27 "Weapon_Pistol.Mag_Out" }
{ event AE_CL_PLAYSOUND 34 "Weapon_Pistol.Mag_Futz" }
{ event AE_CL_PLAYSOUND 58 "Weapon_Pistol.Mag_In" }
{ event AE_CL_PLAYSOUND 77 "Weapon_Pistol.Slide_Release" }
{ event AE_WPN_THROWMAG 34 "Pistol 2" }
{ event AE_WPN_RELOAD 68 "" }
fadein 0.1
fadeout 0.2
node "0"
fps 60
}

Magazines also technically have support for custom drop sounds seeing as the model can be given a unique surface property and some magazines already have them.

Conclusion

Following this tutorial, your weapon replacement will be able to leverage all of the features we've added to RTBR to be as comprehensive as possible. More info may be added here in the future if any other broad-spectrum changes are made to weapon functionality. Enjoy!

Post comment Comments
dgn
dgn - - 734 comments

Very interesting !
Cheers.

Reply Good karma Bad karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: