Step 1: Importing your model.Using Milkshape 3D, load/import the model you wish to edit/use for your world model (In some cases, you may need to load/import more than one model, but I'll save that for another time and use a model that I've already set up).
You'll usually want to resize and reposition your model so that it fits to roughly the same size and position as the default model you're replacing, just to avoid any size or positioning related issues with the model. This is up to the discretion of the person working on the world model, but it usually helps to minimize having to come back and fix your model.
Step 2: Duplicating your mesh.Once your model has been fully imported, you'll want to select the magazine model only. Most models will have the magazine listed as a separate entity under the Groups tab; simply double-click on the entity in the list, and the program will select the mesh for you. The selection should appear as follows:
Once the mesh has been selected, simply go to the Edit menu and hit 'Duplicate Selection' option in the menu (or if you don't want to open the Edit menu, simply hit Ctrl+D on your keyboard instead). For an example of where to find this option, see the following image:
Because the duplicate model will be in the same position as the original model, you'll end up seeing what looks like a model that has only its faces selected (seen below); this is normal, as the duplicate is lower in the Groups list than the original model. Both the faces, and the vertex points have are currently selected.
Step 3: Creating and assigning new material, and applying a null .VMT file.-3A-
Now that you have a duplicate model of the magazine, it's almost time to start rigging the model. Unfortunately, the model in its current state will still be rendered when seen in-game due to the duplicate model using the same .VMT file as the original model. In order to avoid this, assigning a dummy file (which I'll provide here) is required. To assign this material, make sure you have the duplicate model selected, and then go to the Materials; you should see a list of currently-available Material groups that were imported with the model (assuming the model had materials assigned to it prior to importing, which we'll assume are included by default for the sake of this tutorial). From there, you'll want to hit the 'New' button (highlighted in the image below) to create a new material group; it will be labeled as "Material01" by default.
After the new material has been made, simply hit the 'Assign' button while the duplicate model is still selected, and the duplicate model should now be reading from this new material group instead of the original material group it was previously assigned to.
Now that the new material group is assigned, you'll need to apply the dummy .VMT file (provided above) to the material group. By applying this dummy .VMT file, the duplicate model will be rendered invisible when this is finally compiled and seen in-game. To apply this .VMT file, simply hit the top '<none>' selection of the new material group to bring up a file browser, and then locate your dummy .VMT file to apply the model. See the examples below for clarification:
Upon applying the .VMT file, you will get a notice saying that there was an error downloading the texture; this is normal, and can be ignored. Milkshape3D isn't capable of reading .VMT files, as they're essentially a glorified .TXT file that the Source engine uses to read multiple .VTF files at once. At this point, your new material group should show the following info, which will now make it so that your model is now ready for rigging:
Step 4: Assigning the bones/joints, and exporting the file.-=This step requires selecting the model and duplicate model, which can be a hassle if the model you imported has a somewhat large amount of model groups. If double-clicking each model group to select each part of the model is something you don't wish to do, you can also hold the Shift key while holding down the left mouse button to select your model; this is simply to ensure that the bones won't be deselected while trying to select the model via the mouse-drag method.=-
Now that your model is fully set up with the dummy texture file and duplicate model, it's time to assign the model to the bones. When assigning the model to the bones, you'll want to select the bone in question before selecting the model, which you can find under the 'Joints' tab. For the first two bones (labeled as "ValveBiped" and "ValveBiped.weapon_bone", which are what you want to assign the model to in that order), you'll want to select the entire model (duplicate magazine model included), which will ensure that the entire model will move with the player model's reload animation for the world model. However, this is simply to ensure that the model isn't completely static or stuck in the player model's crotch (which is a surprisingly common bug when people don't set up the world model properly). To start, we'll first select the "ValveBiped" bone by double-clicking on it, followed by selecting the model (shown below).
Bone and model selected
Once everything has been selected appropriately, simply hit the 'Assign' button under the joints tab, and the model will be assigned to the bone in question. You'll repeat this same process for the "ValveBiped.weapon_bone" selection as well.
Once the model (and duplicate model) have been assigned to the main bones, you'll want to assign the duplicate magazine model to the "ValveBiped.weapon_bone_Clip" bone. Repeating the same process as before (select the bone, select the model, assign), you will instead select the duplicate magazine model while the bone mentioned in this step is still selected, and nothing else. Make sure that the model selected is your duplicate model before hitting the 'Assign' button. Simply finish assigning the last of the bones in a similar process (if you're using the M4A1's world model reference, for the "flash" and "flash_silencer" bones, you'll only want to select a small segment of the end of the model in order to avoid having the muzzleflash be in a weird spot once your model is compiled), and then export the model.
For those not familiar with how to export models in Milkshape 3D, you can do so by going to the File menu, going to the Export list, and then selecting the Half-Life .SMD (after saving the file to the desired location, usually where your .QC file is at, you'll want to make sure that it's saved as a reference file; saving with vertex weights is not required), which can be seen below:
Step 5: Compiling with Crowbar, and placement of the dummy file.Once you've exported the reference file you'll be using for your world model, you'll want to adjust your .QC file so that it reads your new reference file (assuming you gave it a different name) and the required directory for your world model's texture files.
Since world models can use the same .VTF texture files, only the directory of your world model's .VMT files is required. You will designate this information in your .QC file on the line starting with '$cdmaterials' (example: $cdmaterials "models\weapons\w_models\-your model's .VMT files-\"). Once you have your '$cdmaterials' line situated, you'll want to take the dummy .VMT file and drop it into the location designated in your '$cdmaterials' line.
After everything for the texture directory in your .QC and dummy .VMT file placement has been situated, you'll need to adjust the '$bodygroup' and '$collisionmodel' lines in your .QC so that they point to your custom model's reference file, and then use Crowbar to compile the model to the models folder for your skin mod. If everything went accordingly, your world model should now appear to have a static world model, despite actually having the invisible dummy magazine being used for the animation instead.
Minor notes, and Q&A:After compiling your world model, you'll want to make sure to test it in your own server to check for errors (checking the world model when dropped on the ground, as well as checking your own player model in third person); while this should be a fairly obvious thing to do, some folks have a habit of not actually testing their mods before releasing them, and that usually results in them either complaining to me about the mod not working properly or getting complaints from others who use their skin about the model being bugged/broken. If you don't test your mods to make sure they're working 100%, then it's your own fault if things are still broken.
Q: My world model looks like it's going through the player model's head/crotch, and isn't animated at all. What did I do wrong?
A: You forgot to assign the model to the "ValveBiped" and "ValveBiped.weapon_bone" bones/joints. Go through the tutorial again, and make sure you follow the directions.
Q: My world model is all distorted/warped whenever the character moves; it looks like the gun was melted! What the hell happened!?
A: You didn't assign the model properly to the bones pointed out in the tutorial, so the animations are only applying to the parts that the bones did get assigned to. Go back and follow the tutorial again, and make sure you follow the directions this time. Slow down if you need to.
Q: My model is working as intended...but it's too large and/or floating away from my player model. What do?
A: Well, the easiest approach would be to move the model into a proper position and resize it like I mentioned in the first step. The best way to do this is from my experience is to import your custom model before deleting the default model, followed by resizing and re-positioning it to be roughly the same size and in roughly the same position as the default model. After that, just delete the default model and follow the tutorial as you did before.
Q: Can you make a video version of this tutorial?
A: Probably. Doesn't necessarily mean that I will.
Q: Okay then, will you make a video version of this tutorial?
A: Probably not. While I'm more than confident that I could make a video for this tutorial, I'm not keen on making videos where I'm actually speaking, and having subtitles pop up for every step would just clutter up the video.
Q: Can you make this tutorial in x-language-here? English is not my native language, so I can't quite understand what's being said.
A: No, I can't. English is my native tongue, and I really don't know any other languages. I also don't trust Google Translate, because it always seems to butcher any and all translations.
Q: I've seen some of your other work where the world model was held completely different than how it normally would be for x-weapon-slot. How do I make my own world models do the same thing?
A: That involves a bit of weapon script editing and compiling trickery. I'll cover that in a different tutorial some other time.
Q: MY MODEL IS HORRIBLY BROKEN, AND EVERYONE KEEPS COMPLAINING ABOUT IT!!! IT'S ALL YOUR FAULT, YOU JERK!!!
A: Well, first of all, that's more of a statement than a question, and it's a piss-poor statement at that. Second, if you can't slow down and read like a normal person to avoid having problems, that's your own fault. I'm not responsible for your lack of patience and consistent need to skim through long bits of text.
Q: -Unrelated and off-topic thing about a withheld/trashed submission that has nothing to do with this-
A: The Support section is that-a-way, my dude/dudette. My submissions, and my profile, are not the place for things related to site moderation issues, and those types of posts will be removed.
Any related questions not covered in the description? Feel free to ask!