Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

CS:S Weapon Replacement

A Tutorial for Counter-Strike: Source

No ads for members. Membership is 100% free. Sign up!
by Hl2 world Setting Up Things your going to need for this tutorial. 1. GCFScape (Opens your GCF Files) 2. Cannonfodder's awesome MDL decompiling tool. (version 0.1a for this tutorial. Rotation is broken in 0.2a but if there is a fixed version get that.) 3. Chris Cookson's SMD import script for max. 4. Any SMD exporter that works with your version of max. Install all that stuff as is explained in the instructions that come with them. Getting the MDL Files 2. Open cstrike\_pak\_dir.vpk in your steam/steamapps/common/counter-strike source/cstrike directory. Go to root/models/weapons/ and find an appropriate v\_ model for the weapon you want to replace and export the files into a temporary directory somewhere. It really dosn't matter where. 3. After you export the files make SURE you close GCFScape. Open Steam up and make sure its running fine. If you leave GCFScape open valve thinks the GCF file you have open is corrupt and bad things happen. ;) 4. Open the MDLDecompiler and select the MDL you want to export. Then define the path you want to export the smd's into. I usualy make a directory inside of the directory where the MDL is and call it "source files". Select that directory from the decompiler and click Extract. Setting Up for Compile You should now have the SMD files and a nice little QC generated for you. 1. Create a batch file in your smd folder and call it something like compile.bat. Here's an example batch file.
@"c:\program files (x86)\steam\steamapps\common\counter-strike source\bin\studiomdl.exe" -game "c:\program files (x86)\steam\steamapps\common\counter-strike source\cstrike" mdldecompiler.qc
pause
2. Remember, since we are replacing a weapon in CS:S your animations will be fairly limited. For the tutorial i'm just going to show you how to get your weapon into the animations. Open the mdldecompiler.qc file with notepad in your source directory with all the SMD files. You should see something like this.
$cd "...Path where you exported to..." (remove this)
$modelname "weapons\v\_pist\_deagle.mdl"
$body "studio" "deagle\_reference.smd"
$body "hands" "hands\_reference.smd"
$cdmaterials "models\weapons\V\_models\pist\_deagle\"
$cdmaterials "models\weapons\v\_models\hands\"
$attachment "1" "v\_weapon.Deagle\_Parent" 0.00 2.75 6.50 rotate 0.00 0.00 0.00
$attachment "2" "v\_weapon.Deagle\_Parent" 0.00 2.90 0.00 rotate -10.00 -180.00 0.00
$surfaceprop "default"
$sequence idle1 "idle1" ACT\_VM\_IDLE 1
$sequence shoot1 "shoot1" ACT\_VM\_PRIMARYATTACK 1
$sequence shoot2 "shoot2" ACT\_VM\_PRIMARYATTACK 1
$sequence shoot\_empty "shoot\_empty" ACT\_VM\_DRYFIRE 1
$sequence reload "reload" ACT\_VM\_RELOAD 1
$sequence draw "draw" ACT\_VM\_DRAW 1
3. If during decompilation the QC file looses its "Event triggers". These are the frames that trigger events to happen like a shell flying out or a muzzle flash. Also during recompilation the model gets rotated 90 degrees on the Y axis so we'll have to fix that too. Go back through the $sequence lines and change them to something like this.
$sequence idle1 "idle1" ACT\_VM\_IDLE 1 rotate -90
$sequence shoot1 "shoot1" ACT\_VM\_PRIMARYATTACK 1 rotate -90 { event 5001 1 7 }
$sequence shoot2 "shoot2" ACT\_VM\_PRIMARYATTACK 1 rotate -90 { event 5001 1 5 }
$sequence shoot\_empty "shoot\_empty" ACT\_VM\_DRYFIRE 1 rotate -90
$sequence reload "reload" ACT\_VM\_RELOAD 1 rotate -90
$sequence draw "draw" ACT\_VM\_DRAW 1 rotate -90
1. This rotates all of the animations -90 degrees. { event 5001 1 7 } tells the engine to place a muzzle flash at attachment 1 and draw it from frame 0 to frame 7. However long you think looks best is up to you. The events are the same as hl1 so if you look up the old SDK documentation you'll find a list there I'm sure. (Thanks for the info Prall) 4. You probobly won't want to put your textures in the same place as the original weapons textures since Steampipe so make your own directory in custom and put this directory structure in it models\weapons\v\_models\ then some folder if you feel like it. Make sure you change the $cdmaterials line. Example:
$cdmaterials "models\weapons\V\_models\pist\_myweapon\"
and compile the textures just like you would for a static model. 5. Backup your WeaponName\_Reference.SMD and open 3d studio max. Importing and Exporting the SMD 1. If you install the SMD importer script as told to you by the instructions you should be able to go to the utils tab click on the MAXScript button. Click on Run Script and find where you put the SMD importer script. There will be a drop down box under the "Utilities" text. Click the down arrow, select "Half-Life SMD Importer" and the little window opens up under the drop down box. Click Import SMD and select WeaponName\_Reference.SMD. Don't mess with the hands SMD unless you want to replace them. I wont cover that. 2. You should now have JUST the weapon model and all the bones in max. Click File->Merge and open your model file for the weapon you want to use. Set your model up just like you would a static, textures and everything. Click on the weapon model you are replacing and hit alt-x. This sets the model to a transparent see-through mode. Make sure you have edged faces enabled so its easier to see. Rotate, Scale, and Position your model in the right place according to the old weapon model. Delete the old one once you are sure your new model is just right. Make sure your model is one big object. It can't be in pieces. 3. Apply a physique modifier to your model. Click "attach to node" like you would a static model and assign it to the v\_weapon.*WeaponName*\_Parent bone. If you can't attach the parent bone to your weapon please refer to the section below (Weapon Fixes). When the Physique initialization dialog comes up set "Vertex link assignments" to "Rigid". Then set "Blending between links" to "No blending". Click on Link settings near the top of the window and uncheck "Continuity". If you don't you'll have all these nasty curved bones. Click initialize. 4. If you your weapon has moving parts assign them to the correct bones, just check the names. I'm not going to cover assigning verts to bones in depth here. I may write another tutorial later on. For now click the plus next to Physique in the modify tab. Select the Vertex setting and then select all of the verts on the model. Click assign to link, click on the green +, and click on the parent bone. If you get lost, again, read the static models tutorial. 5. Make sure you have all your textures applied and everything is setup. Also make sure you dont have any hidden objects or something that isn't included in your physiqued model or things will get screwy. Go to file->Export and export as a reference over the same SMD you imported. You backed up your file right? ;) 6. Run the batch file you created eariler. It should compile no problems. If it has errors you probably need to look at your model and make sure your textures are assigned correctly (as a multi/sub-obj) and your model is fully physiqued. 7. Just to check the model open hlmv and select the newly created MDL. Select Options->Viewmodel mode to see how your model is going to look in game. Usually my models are a little further back in hlmv than they will be in hl2. So this is just to test your model slightly to see if its going to show up in game. The true test is accualy loading it into CS:S. Weapon Fixes (ex. p28) Oldfaq pointed out there was a problem while importing the p28. This is caused by the joints not being connected together so max dosn't have a bone to assign the model to. I don't know how many other weapons this affects but here's the fix if you run into the problem. 1. Go to the Create tab, click on the systems button (the icon that looks like gears) and click bones. 2. Click on v\\_weapon.p228\_Parent, drag the bone out untill you get a simple short bone like the one in the picture below, and click again. 3. In the physique modifier click attach to node and click on v\\_weapon.p228\_Parent. Export the SMD and compile. That should fix it! Replacing the old MDL file Go to [dump folder]/models/weapons/ and copy the newly created MDL. It should be named the same as the MDL you want to replace in CS. Go to where you installed steam and put the mdl file in SteamApps\common\counter-strike source\cstrike\custom\\[your custom folder]\Models\weapons put your compiled textures in whatever you changed your $cdmaterials path too. For example: $cdmaterials "models\weapons\V\_models\pist\_myweapon\" so create SteamApps\common\counter-strike source\cstrike\custom\\[your custom folder]\materials\models\weapons\v\_models\pist\_myweapon\ and put your VTF and VMT files there. Load up CS:S and enjoy!
Sign up to access this!
1-10 of 12
1
Pages
  • 1
  • 2
Go to page:
  • martas.tnt avatar
    martas.tnt Joined 10y ago
    Offline
    access_time 10y
    Thank you !! very useful for me
    Bananite
    URL to post:
  • franck2006 avatar
    franck2006 Joined 10y ago
    Offline
    access_time 10y
    Detail: NICE Usefulness: yeah Readability: beatifel
    Bananite
    URL to post:
  • CammieDee666 avatar
    CammieDee666 Joined 12y ago
    Offline
    996 points Ranked 40891st
    access_time 11y
    Pros: Nice And Detailed Cons: Not Enought Pics Improvements: More Pics Notes: Very Useful
    Getting bored with FPSB avatar
    Mantra
    Getting bored with FPSB
    URL to post:
  • Live2bcool avatar
    Live2bcool Joined 12y ago
    Offline
    access_time 12y
    Omg, This seems very hard. XD
    Novint Falcon User
    URL to post:
  • pyinator avatar
    pyinator Joined 12y ago
    Offline
    306 points Ranked 50619th
    access_time 12y
    That suxs...u can only do it w/ 3d max
    Drink the red koolaid or jump
    URL to post:
  • Chriiiiss avatar
    Chriiiiss Joined 13y ago
    Offline
    access_time 12y
    Http://www.afreedll.com/ for finding that dll file ,,, when u got that and putted it in ur system32 folder which is located in the windows folder it works, NOT u need to a´dd 1 more file, u get the name on it when u try start up mdldecompiler again
    Bananite
    URL to post:
  • Dead_Dude avatar
    Dead_Dude Joined 13y ago
    Offline
    279 points Ranked 51694th
    access_time 13y
    Posted by Nijobes Some1 help me, everytime i start up mdldecompiler.exe an error pops up and it says "This application has failed to start because vstdlib.dll was not found. Re-installing the application may fix this problem."
    Same problem please how do you fix?
    Speedball is for chumps. avatar
    Mantra
    Speedball is for chumps.
    URL to post:
  • Weeeeeeee avatar
    Weeeeeeee Joined 13y ago
    Offline
    143 points Ranked 61504th
    2 medals 1 rare
    • Submitted 100 Sprays Medal icon
    • Submitted 20 Sprays Medal icon
    access_time 13y
    Maaaaaaaaan its really complete
    URL to post:
  • pixtyle avatar
    pixtyle Joined 14y ago
    Offline
    3,111 points Ranked 3051st
    access_time 13y
    Some1 help me, everytime i start up mdldecompiler.exe an error pops up and it says "This application has failed to start because vstdlib.dll was not found. Re-installing the application may fix this problem."
    n/a
    URL to post:
  • maxdamage68 avatar
    maxdamage68 Joined 14y ago
    Offline
    1,182 points Ranked 23084th
    access_time 13y
    This is seriously detailed and very helpful only tut out there that really takes u step by step from beginning to end. gj
    Bananite avatar
    Mantra
    Bananite
    URL to post:

Embed

menu
Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

Key Authors
BigDog avatar
BigDog username pic Joined 15y ago
Offline
13,443 points Ranked 434th
24 medals 3 legendary 4 rare
  • Achieved Admin clearance Medal icon
  • 10 years a member Medal icon
  • Submitted 50 Maps Medal icon
  • 6 years a member Medal icon
  • Submitted 20 Maps Medal icon
  • Submitted 20 Gamefiles Medal icon
Author

Submitter

BigDog avatar
BigDog username pic Joined 15y ago
Offline
13,443 points Ranked 434th
24 medals 3 legendary 4 rare
  • Achieved Admin clearance Medal icon
  • 10 years a member Medal icon
  • Submitted 50 Maps Medal icon
  • 6 years a member Medal icon
  • Submitted 20 Maps Medal icon
  • Submitted 20 Gamefiles Medal icon
BigDog avatar
BigDog

Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Details

Difficulty Level
Intermediate

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 5
  • 44.0k
  • 12
  • 14y
  • 6y

More from Submitter

menu

WiPs by Submitter

menu

More Skinning Tutorials