GameBanana shows no ads to members. Sign up now!
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

Adding New Ammo types for Custom Weapons

A Tutorial for Half-Life 2

Adding New Ammo To Custom Weapons

Adding New Ammo types for Custom Weapons Very Basic method Things you will need to know...
  • C++ ( you don't need this, it will help if you know it )
      • valve script
          This tutorial will teach you how to add a new type of Ammo for your custom weapons. This will basicly be useful for modders who don't want to use the Ammo type 'SMG1' all the time. When you add a new type of Ammo you can set it to what you want. For example... modname/scripts/weapon_smg1.txt note: this will work on most other weapon scripts as well the weapon_smg1.txt is the easyest to explain this tutorial on. About line 16- 19 you should find this line of script.
          "default_clip" "45" "default_clip2" "-1" "primary_ammo" "SMG1" "secondary_ammo" "SMG1_Grenade"
          Change that to
          "default_clip" "45" "default_clip2" "-1" "primary_ammo" "WEAPON1" "secondary_ammo" "SMG1_Grenade"
          Therefore not wasting the SMG1 ammo type on all of your guns. == The C++ Part == So lets learn how to do this. first open up your project sln file. (You should get this when you create a mod) Then goto hl2_gamerules.cpp located in the server Goto line 119 an you should be on "ConVar sk_plr_dmg_gun1" Just below that add
          ConVar sk_plr_dmg_weapon1 ( "sk_plr_dmg_weapon1","0", FCVAR_REPLICATED ); ConVar sk_npc_dmg_weapon1 ( "sk_npc_dmg_weapon1","0", FCVAR_REPLICATED); ConVar sk_max_weapon1 ( "sk_max_weapon1","0", FCVAR_REPLICATED);
          This is baiscly telling the game/mod that weapon1 is a type of ammo that we want to use. After that goto line 1697 in the samefile, Just below the line that says def.AddAmmoType("SMG1" ........ Add
          def.AddAmmoType("WEAPON1", DMG_BULLET, TRACER_LINE_AND_WHIZ, "sk_plr_dmg_weapon1", "sk_npc_dmg_weapon1", "sk_max_weapon1", BULLET_IMPULSE(200, 1225), 0 );
          This is basicly defining the script that you put in youmod/cfg/skill.cfg Now to make the ammo come up when you type "impulse 101" into the console. Goto player.cpp then goto line 5446 Add this line of code in after that " // Give the player everything!
          GiveAmmo( 90, "WEAPON1");
          Where my code says "90" put in the amount of bullets that you want the player to have everytime they put in impulse 101 And that is it. Compile your project and your weapon_smg1.txt will have a diffrent type of ammo. Then you can make you own weapons and put your new type of ammo in. To make more types of ammo, just rename weapon1 to weapon2 and so on. Thanks for reading ---- Shunt94
Sign up to access this!
  • L4ngford avatar
    L4ngford Joined 12y ago
    Pros: gets to the point well oriented toward beginners Cons: none that i can really think of.. spelling :P Improvements: could explain a bit about source specific functions you use Notes: thx for the tut
    The Milky Duck Doctor avatar
    The Milky Duck Doctor
    URL to post:
  • IGNORANCE avatar
    IGNORANCE username pic Joined 12y ago
    18,339 points Ranked 325th
    12 medals 1 rare
    • 6 years a member Medal icon
    • Reached 1,000 Points Medal icon
    • Reached 2,500 Points Medal icon
    • Reached 7,500 Points Medal icon
    • 1 post awarded Exemplary Feedback Medal icon
    • 5 posts awarded Exemplary Feedback Medal icon
    Finally!! been looking everywhere for this!
    Made in Belfast. avatar
    Made in Belfast.
    URL to post:
  • shunt94 avatar
    shunt94 Joined 12y ago
    101 points Ranked 74,903rd
    Sure Me and my little team will start ASAP, should be around a week till it will come out on youtube, then il post it here :) Edit: its taking a while longer because our team has a full month of just doing stuff, there are plenty of tutorials on how to do what you want to do though just scan around to find them! Shunt94 FPSModding Admin
    Bananite avatar
    URL to post:
  • Ghost663705 avatar
    Ghost663705 Joined 12y ago
    Good job you think you can make a tutorial explaining how to add new weapons to hl2 with new models
    URL to post:


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


Key Authors


shunt94 avatar
shunt94 Joined 12y ago
101 points Ranked 74,903rd
Sign up to access this!
Sign up to access this!
Sign up to access this!


Sign up to access this!



Difficulty Level



  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 3
  • 12.4k
  • 5
  • 12y
  • 10y

More Scripting Tutorials