=========Static world models for Counter-Strike Source (and similar Source games)=========
This one mostly applies to Counter-Strike Source, but it can be applied to other Source games that behave similarly with their world animations for weapons (assuming they use the classic v_model/w_model setup). It’s purely for aesthetic nuts that don’t like to see weapon clipping and are willing to sacrifice part of the visible animations for the world model when reloading the weapon. This method will essentially remove the animation from being visible on weapon world models, but it does help for people that hate seeing the magazine just floating away from where it should be.
As I’m sure most people are aware, the default world models (and even a majority of custom world models) for Counter-Strike Source seem to be a bit buggy with their animations (and by buggy, I mean you end up having the magazine floating out of the magazine well and partially into the barrel when standing idle or running around).
For what modelling programs that actually allow people to assign the .VMT itself to certain model segments (such as Milkshape 3D for the quickest example), you’ll first need to import the .SMD of the model you are wanting to apply this to and duplicate the magazine model so that you have two of them present; this will be necessary for later steps. Once you get around to assigning materials/textures to the model, assign them as you would normally, but assign a dummy .VMT file to the duplicate magazine (I would advise throwing your dummy .VMT file into the same folder that’s in use for your world model’s texture files for the sake of not having to edit your .QC file before compiling). The info inside of the dummy .VMT file should show as follows:
vertexlitgeneric
{
$no_draw 1
}
Those who know what $no_draw does will know what the results will be. As for those who don’t know what $no_draw does, that command will (when active, hence the 1) hide a given segment of a model from being seen in the Source engine when the model is in use. This is required in order to hide the duplicate magazine from being seen.
After you’ve finished assigning your .VMTs to the your model and the duplicate magazine, it’s now time to move on to assigning the model segments to their appropriate bones/joints; for the time being, this will be explained with Milkshape 3D (3DS Max isn’t wanting to work with me atm). Now, Counter-Strike Source isn’t too picky when it comes to assigning bones/joints to the models, so all you really need to work with are the ValveBiped.weapon_bone, ValveBiped.weapon_bone_Clip (for rifles and pistols; shotguns make no use of this and therefore don’t have it present), and ValveBiped.flash (and ValveBiped.flash_silencer when working with the M4A1’s world model) bones/joints. Assign everything appropriately to the aforementioned bones/joints, except for the ValveBiped.weapon_bone_Clip bone/joint; instead of assigning the magazine that you normally would, assign the duplicate magazine with the dummy .VMT file attached to it. After doing all of this, export your .SMD file for your world model, and then compile it as you would normally (making the proper changes to your .QC as necessary).
Once the model is compiled, load up Counter-Strike Source and create a server. Once you’re finally in the game, simply open the console and give yourself the weapon (give weapon_); while the console is open, type in the following command string:
thirdperson; cam_idealdist 60; cam_idealyaw 115
If done correctly, your camera should now be in third-person and facing your character from the side and somewhat to the front. Run around for a moment (you may need to bind ‘record 1; stop’ to a key on your keyboard and hit it a couple times if your character is ‘floating’ or moving in slow-mo when you move), fire the weapon a little, and reload the weapon; if you were successful, the visible magazine should look like it’s staying in place the entire time. If your duplicate/dummy magazine is still visible or is receiving Source’s infamous purple-black checkered texture, or if the dummy magazine and visible magazine are both animated, make sure to go back into your world model’s reference .SMD and fix it up as you would normally by going over everything again and making sure to follow the information accordingly.
=========Cheating w_model consistency in Counter-Strike Source and using ‘appropriate’ w_model animations=========
This one is generally simple and is more-or-less driven by some changes to your .QC and a small change to a specific script for the weapon slot you’re compiling a world model for. You can apply the previous trick to this as well, so they sort of go hand-in-hand with each other.
As I’m sure some people know, there are quite a few old (and current) weapon skins for Counter-Strike Source that either don’t have a world model, or they have a world model included that seems kind of buggy because of the player model’s animations when using certain weapons for a given weapon slot (example: a FAMAS for the AK-47 slot). With this trick, you can at least cheat the game into being a little more lenient with your custom weapon compiles, but with just a tiny little more work to make it functional in-game. To save people the time of having to manually find and convert the weapon scripts though, I will include a link to my default script pack from 2011 (surprisingly, Valve hasn’t changed anything for these scripts since the date mentioned in the title of that submission).
The first thing you’ll want to do is decompile one of the default world models from the game that follows suit with the weapon model you’re using to replace one of the defaults (example: a bullpup weapon like the L85A2 would benefit from using the default FAMAS’s world model rigging). Replace the model as you would normally (possibly even consider doing the previous trick as well for aesthetic reasons), and then export your reference .SMD accordingly. Now, open your .QC file and go to the $modelname line, changing whatever it’s currently set to (in the case of the provided example: $modelname “weapons\w_rif_famas.mdl”) to the slot that you are intending to put the weapon on (for example: $modelname “weapons\w_rif_sg552.mdl” for the SG552 slot). Continue making the appropriate changes to your .QC as necessary (such as changing the $collisionmodel to your reference .SMD file) and compile your weapon model afterwards. After that, open the two scripts that would be necessary for your weapon skin (with the provided examples, you’d need weapon_famas.txt and weapon_sg552.txt) and examine them; both scripts will have a line that says “PlayerAnimationExtension”, followed by the name of the animation. For the script that will go with the weapon you compiled (for this example, weapon_sg552.txt), change the “PlayerAnimationExtension” line from “sg552” to “famas”; this will change the in-game player animation accordingly to use the animations and read the model positioning for the FAMAS by default on the SG552 slot. The final step before testing the model would be to place it in its correct location (considering how the SteamPipe setup works, you’d either place it in ‘Steam\Steamapps\Common\Counter-Strike Source\cstrike\custom<your custom weapon folder name here>\scripts’ for the loose-file format; if you pack it into a .VPK, it’s fairly simple to know where it goes before packing the compiled model, its textures, and the script into a .VPK).
Once you have everything in place for your world model and its associated script, go ahead and launch Counter-Strike Source, then create a server like you did in the previous trick. Either purchase the weapon or use the console to give yourself the weapon that you compiled the model for, and then use the console to go into thirdperson and move the camera around like you did before in the previous trick. Assuming you did everything correctly, you should be able to your character holding the weapon like they would be if you had grabbed the other weapon instead (in this case, you’re holding the SG552 weapon you compiled as if it were the FAMAS instead).
Please note: Some weapon skins have the view model rigged a certain way that might have it appear as left-handed or right-handed by default when viewed outside of Counter-Strike Source or the model viewer, and using these scripts might accidentally mirror them to the other side of the screen; if this happens, simply re-open the modified script for your skin, and change the “BuiltRightHanded” line to the opposite of what it currently shows (if it shows “0”, change it to “1” and vice versa).