I guess this should be in gameing but only a technophle would even bother attempting it soo... Here is a brief tutorial i wrote for a HL2 site on the subject. I only started creating new guns this morning so there are still a few issues but its pretty good fun once you get used to how everything works.
Importing new guns to HL2 - Rough guide
Required tools
Visual studio .NET 2003
GFCScape (or however it spelt) - Everyone knows about this already.
Required reading.
http://www.valve-erc.com/srcsdk/MyFirstMod.htm - Information on compileing CPP files and basic use of VS .NET
http://collective.valve-erc.com/inde...38409-05843300 - This is the most important thing to read. If followed correctly you should have no trouble creating new guns.
However one or two tips when it comes to reading ^ that tutorial.
1. ONLY CHANGE THE BITS IT SAYS. For example do not change every single mention of "PISTOL". When finding and replaceing in VS .NET it is good to have case sensitive ticked, and match whole word only. This will help you to not change the wrong bits.
2. C++ IS CASE SENSITIVE. Do not mix up your names. e.g dont call one but "weapon_pistol2" and another in the same file "weapon_Pistol2" or it will cause problems.
3. Dont change the top bit of c_weapon__stubs_hl2.cpp, only add to the list at the bottom. Under HL2DM, i believe its called.
------------------------------------------------------------------------------------------------------
Ok so now, if all has gone to plan you have a new weapon set up.. but wait its just like the pistol in every respect. Well this is where we need a new model (and to change some of the settings and whatnot yadda yadda, you should be able to see what can be changed by yourselves).
So in a series of reasonably vauge steps...
* Rip model out of CSS GFC file with GFCscrape. Get all of the bits just to be on the safe side.
* Recreate the GFC's folder structure to the models folder... for example "Modname\models\weapons" and put the model files into this folder.
* Open the script file of the weapon you just created and change this bit to the path of your model. So it will look something like this...
"viewmodel" "models/weapons/v_rif_ak47.mdl"
"playermodel" "models/weapons/w_rif_ak47.mdl"
* Rip the relevant textures out of the CSS .GCF and copy the folder structure of materials also. (i.e. \materials\models\weapons\v_models)
----------------------------------------------------------------------------------------------------
At this stage you will probably want to test the model out, to see wether its working. Go right ahead.....
.
.
.
.
.
.
.
.
hmm that was kind of dissapointing wasn't it? its just the pistol with a new model and really dodgey animations.
Fear not a new sound should add a bi tto the coolness factor..
-------------------------------------------------------------------------------------------------
Custom sounds are very easy to add.
* First you need to rip a few sounds from somewhere. CSS, old CS .WAVs.. whatever you want.
* Create a folder called 'sound' in you root DIR and then put a folder in it called 'weapons'.
* Now, put the sounds into the weapons folder.
* Next you need to find the script file named 'game_sounds_weapons.txt' open it up and you should see whats going on.
You need to add some more sound types.. .for example
//weapon_mp5.txt -Comment. this just tells you where the script your using the sound in is.
"weapon_mp5.single" -Name you will use to 'request' the sound in the weapon's script.
{ -Start of sub
"channel" "CHAN_WEAPON" -i left this as it was
"volume" "0.7" -change this if you want.
"soundlevel" "SNDLVL_NORM" -not sure about this
"wave" "weapons/mp5/mp5-1.wav" the location of you sound.
} -end sub
This is all quite self explanitry when you are actually doing it.
* Now thats done, change the weapon's script file to use the sounds.
For example i would put in my MP5's script file.....
"reload" "Weapon_SMG1.Reload"
"reload_npc" "Weapon_SMG1.NPC_Reload"
"empty" "Weapon_SMG1.Empty"
"single_shot" "weapon_mp5.single"
"single_shot_npc" "weapon_mp5.single"
"special1" "Weapon_SMG1.Special1"
"special2" "Weapon_SMG1.Special2"
"double_shot" "weapon_mp5.single"
"burst" "Weapon_SMG1.single"
I left the special and empty alone. The default sound will do for now.
Thats that done... go test it.
----------------------------------------------------------------------------------------------------
Right now. RSI is stating to set in so im going to have to end it there.
If you thought something in this tutorial didn't make sence, chances are i wrote it wierd. i have not slept in a day or so, so please dont follow this to the letter. It was just a few things i would have liked to have been told this morning when i was doing it.
Feel free to ask questions and il try and answer them from my limited experience. But i dont ant to hear any "i am getting X ammounts of errors when i compile my code. whats up?" type questions. It is most likley caused by the stuff i mentioned up there ^^^^^^^^^^^^.
good luck, and hopefully someone can enlighten me as to how to get the damn models the right way round.
Have fun.