furrycat's 3D Studio MAX weapon modding tutorial
Exporting the model
Now we'll save the model in .gsm format ready for SWAT to use. SAVE THE SCENE BEFORE YOU DO THIS, as 3D Studio MAX likes to crash, especially when working with GSM files.
There are certain conditions which must be met before the model can be exported. If you've been following along you'll see that these conditions have been satisfied for the model we've been making but you need to know them when you're starting from scratch.
Your scene must have at least one closed mesh, ie a solid object. The exporter will not let you export a mesh that isn't complete. This implies that the simplest object you can export is a prism with four faces.
The mesh must be textured using Standard or Multi/Sub-Object materials. With the exception of those "special" polygons, MUZZLE and FLASHLIGHT, all faces in the mesh must have textures applied to them if you want them to show up. The game will not display untextured faces even if you assign a coloured material to them.
At least one bone must be present and it must be physiqued to a mesh. You must enter "SkeletonRoot=BONE_NAME" in the user-defined properties of the mesh to which you physiqued the bone (or biped), where BONE_NAME is the name assigned to the bone's root node. When you create a new bone, MAX gives you two nodes, called Bone01 and Bone02 unless you already had bones with those names. BONE_NAME in that case would be Bone01. It is recommended you rename Bone01 to Rifle_Root but that isn't necessary as long as the SkeletonRoot property matches.
IF you want to have grips on your gun or grippers on your character (and you do) you must align the purple gripper templates in the right place and add "CreateGrip" lines to the mesh's user-defined properties. More on this later.
I'm serious. The GSM exporter often crashes. It will nearly always crash if you missed one of the conditions above but sometimes it will crash even if you did everything right. I recommend expecting the export to fail and saving the scene before exporting. If MAX crashes, you should restart it and try again. Only after repeated crashes should you assume you did something wrong. If you were just unlucky, you'll find that the reloaded scene (without any modifications from before the last crash) will export correctly.
To save a GSM, choose Export from the File menu and select "GSkinMesh File" in the Save as type box. Assuming your model satisfies the conditions above, you'll get a box like the one below where you can choose which mesh to export. If you only have one physiqued model in the scene (as is the case in this example) there will only be one choice available but it's possible to export one of several objects in a scene, and if you were doing that you'd choose between them here.
If it works, you'll get a whole load of debugging output from the exporter, ending with "Done." If not, you'll soon know about it!
Of course, just because the mesh exported correctly doesn't mean it will look any good in the game. To test it without the hassle of making a proper mod, save the GSM as M4.GSM in your SWAT3 directory and choose the M4 in-game. Make sure you delete the file once you've tested it, or you will get data file mismatch errors when playing online.