[Tutorial] Absolute beginners guide to weapon creation.
This is a discussion on [Tutorial] Absolute beginners guide to weapon creation. within the HL2 Modding, Mapping and Editing forums, part of the Half-Life 2 category; Your right, I had it set wrong. I just went back into my weapon_killer.cpp and changed it to DT_WeaponKiller, compiled ...
| HL2 Modding, Mapping and Editing Want more info about a Mod? Making a Mod? Looking for Modders, Mappers, Skinners, etc.? This is your Spot! |
![]() |
| | LinkBack | Thread Tools | Rating: | Display Modes |
|
#11
| |||
| |||
| Your right, I had it set wrong. I just went back into my weapon_killer.cpp and changed it to DT_WeaponKiller, compiled it and it works fine now. I must have missed that somehow. Thank You for your help |
|
#12
| |||
| |||
| Does anyone also know how I can change the icons when selecting a weapon to ones from CS:S? I tried putting a CS:S weapon into HL2, and it works, but I want to change the icon from the usp match to the m249. And do I need to do anything special to see the muzzle flash of the weapon? |
|
#13
| |||
| |||
| I had problems with that too. I have not as yet worked out where the muzzle flash is stored. Strange thing is when i made the HL2 smg use the crossbow code it still kept the crossbow muzzleflash and in the right place :/ As for the icon, they are taken from a font file. All the icons in HL2 and CSS are letters. So you might be able to take the .TTF out of the CSS file and then use it in some way. |
|
#14
| |||
| |||
| I believe Ive figured out the weapon icons. The ttf files for HL2 linked to a file called ClientScheme.res in your mymod/resource folder. You can edit that file using Notepad to include the cs.ttf file after you extract it from counter-strike source shared.gcf using GCFScape. You'll need to look for the WeaponIcons line in the ClientScheme file and add the cs font as shown: } WeaponIcons { "1" { "name" "HalfLife2" "tall" "64" "weight" "0" "antialias" "1" "additive" "1" "custom" "1" } } WeaponIconsSelected { "1" { "name" "HalfLife2" "tall" "64" "weight" "0" "antialias" "1" "blur" "5" "scanlines" "2" "additive" "1" "custom" "1" } } CSWeaponIcons { "1" { "name" "cs" "tall" "64" "weight" "0" "antialias" "1" "additive" "1" "custom" "1" } } CSWeaponSelect { "1" { "name" "cs" "tall" "64" "weight" "0" "antialias" "1" "blur" "5" "scanlines" "2" "additive" "1" "custom" "1" } } Crosshairs I used CSWeaponIcons and CSWeaponSelect, but you can name it whatever you want. Then at the bottom, under Custom Font Files, add "cs" to the list, like this: //////////////////////// CUSTOM FONT FILES ///////////////////////////// // // specifies all the custom (non-system) font files that need to be loaded to service the above described fonts CustomFontFiles { "1" "resource/HALFLIFE2.ttf" "2" "resource/HL2crosshairs.ttf" "3" "resource/cs.ttf" } Once thats done, save the file, and open your weapon_name.txt script in your mymod/scripts folder. You need to edit the lines telling it what font file and weapon letter to use. The "font" has to be named exactly the same as you named it in the ClientScheme.res file. "weapon" { "font" "CSWeaponIcons" "character" "m" } "weapon_s" { "font" "CSWeaponSelect" "character" "m" Depending on which weapon your using, the "character" letter will be different. The cs.ttf file lists all the weapon pictures, 26 of them, in the top row under the Valve copyright. Simply count over to the weapon picture you want, and then add that letter to your script file. For instance, the p90 is the 13th picture over, therefore it is the letter m, the 13th letter of the aphabet. Others are: ak47 is the letter b, m249 is the letter z, and so on. Last edited by DeathGiver; January 8th, 2005 at 05:28 PM.. |
|
#15
| |||
| |||
| This is cool, i have been hopeing for someone else to add some input to the weapon making process. Tomorrow il take a look at the stuff you are talking about and if it works well il add a section to the tutorial. |
|
#16
| |||
| |||
| Glad I could help, let me know how it goes, or if you need me to explain something in more detail |
|
#17
| |||
| |||
| I also discovered how you can change the accuracy of a weapon. Very simple really, simply open up your weapon_name.cpp file, and find the text called GetBulletSpread (use Quick Find to make it easier). You should then see something like this: virtual const Vector& GetBulletSpread( void ) { // Handle NPCs first static Vector npcCone = VECTOR_CONE_5DEGREES; if ( GetOwner() && GetOwner()->IsNPC() ) return npcCone; static Vector cone; if ( pistol_use_new_accuracy.GetBool() ) { float ramp = RemapValClamped( m_flAccuracyPenalty, 0.0f, PISTOL_ACCURACY_MAXIMUM_PENALTY_TIME, 0.0f, 1.0f ); We lerp from very accurate to inaccurate over time VectorLerp( VECTOR_CONE_1DEGREES, VECTOR_CONE_6DEGREES, ramp, cone ); } else { // Old value cone = VECTOR_CONE_4DEGREES; } return cone; } This is what you want to change: // We lerp from very accurate to inaccurate over time VectorLerp( VECTOR_CONE_1DEGREES, VECTOR_CONE_6DEGREES, ramp, cone ); Simply change the VECTOR_CONE_#DEGREES entries to whatever degree you desire. The lower the numbers, the more accurate the weapon shoots. For a static vector cone, the process is only slightly different: virtualconst Vector& GetBulletSpread( void ) { staticconst Vector cone = VECTOR_CONE_5DEGREES; return cone; } Just change the VECTOR_CONE_#DEGREES to whatever you want. Again, the lower the number, the more accurate it shoots. |
|
#18
| |||
| |||
| Good stuff. Il add it to the main tutorial. (still have not had a chance to look at the weapon icons bit but il do that soon too) |
|
#19
| |||
| |||
| Cool Next I'll see if I can just figure out how to restore the muzzle flashes, create new ammo types, and brass eject sequences. Of course if someone already knows that would be a big help |
|
#20
| |||
| |||
| Its a shame there aren't more people into this stuff on this forum or we would get it all worked out alot quicker. I really need to work on it some more. I have not done anything since the RPG. I found this site -> http://www.hl2coding.com/ Which you might find useful but it seems to be more aimed at the hardcore-total conversion-writeing all their own code type people. |
![]() |
| Bookmarks |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | Rate This Thread |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Beginners Guide to Modding | Tally | CoD2 Modding, Mapping and Editing | 5 | June 24th, 2009 09:25 AM |
| MySQL: The beginners guide | {james} | Web-Code Help and Discussion | 3 | March 7th, 2006 09:14 AM |
| Guide to mapping for beginners and useful websites | Rich19 | CnC Modding, Mapping and Editing | 3 | April 22nd, 2005 03:44 PM |
| Orb's Beginners Guide to Skinning in JK2 & JA | orbitius | SW:JK3 Modding, Mapping and Editing | 0 | March 3rd, 2004 08:25 PM |
| Lightray3d Easy Absolute Beginners Tutorials? | Silent_Death427 | MoH Mapping, Modeling and Skinning | 0 | July 13th, 2003 07:02 PM |
All times are GMT -7.







Linear Mode

