Named Game of the Year by over 50 publications, Valve's début title blends action and adventure with award-winning technology to create a frighteningly realistic world where players must think to survive. Also includes an exciting multiplayer mode that allows you to play against friends and enemies around the world.

Report article Modding Weapons (Ammo, Weight etc)

This tutorial will teach you how to edit the ammo per clip, how fast you walk with a weapon and much more! Check it out... For Half-life 1

Posted by Davik on Dec 7th, 2005 digg this super bookmark
Basic Client Side Coding.


[page=Introduction]
Okay Just click on a chapter/Subject you want to Change
also you are working in the weapon.h the whole tutorial
[page=Weapon Capacities]
open weapons.h and go to line 108

There you will see:

  1. code:
  1. // weapon clip/carry ammo capacities
  2. #define URANIUM_MAX_CARRY 100
  3. #define _9MM_MAX_CARRY 200
  4. #define _357_MAX_CARRY 36
  5. #define BUCKSHOT_MAX_CARRY 125
  6. #define BOLT_MAX_CARRY 50
  7. #define ROCKET_MAX_CARRY 5
  8. #define HANDGRENADE_MAX_CARRY 10
  9. #define SATCHEL_MAX_CARRY 5
  10. #define TRIPMINE_MAX_CARRY 5
  11. #define SNARK_MAX_CARRY 15
  12. #define HORNET_MAX_CARRY 100
  13. #define M203_GRENADE_MAX_CARRY 10
  14.  

**Remember, This is how much you can carry on you at a time for a reload. lets say you get a glock 7/200 <<< thats the number your changing

[page=Weight Factors(how fast you run with weapon etc)]

Okay, Line 92, search it... in the Weapon.h.

now you should see this...

  1. code:
  1. // weap&#111;n weight fact&#111;rs &#40;f&#111;r aut&#111;-switching&#41;   &#40;-1 = n&#111;switch&#41;
  2. #define CROWBAR_WEIGHT    0
  3. #define GLOCK_WEIGHT    10
  4. #define PYTHON_WEIGHT   15
  5. #define MP5_WEIGHT      15
  6. #define SHOTGUN_WEIGHT    15
  7. #define CROSSBOW_WEIGHT   10
  8. #define RPG_WEIGHT      20
  9. #define GAUSS_WEIGHT    20
  10. #define EGON_WEIGHT     20
  11. #define HORNETGUN_WEIGHT  10
  12. #define HANDGRENADE_WEIGHT  5
  13. #define SNARK_WEIGHT    5
  14. #define SATCHEL_WEIGHT    -10
  15. #define TRIPMINE_WEIGHT   -10
  16.  

Explanation: 0 = Normal Speed of running, the higher it gets the slower the player runs... if you go below zero -10 for say, you run faster then normal... So change it on your accord. 20 is the heaviest in this case.

[page=Ammo in a Clip]
This is abit easy all the Value changes are under each other heres the next one

  1. code:
  1. // the maximum am&#111;unt &#111;f amm&#111; each weap&#111;n&#39;s clip can h&#111;ld
  2. #define WEAPON_NOCLIP     -1
  3.  
  4. //#define CROWBAR_MAX_CLIP    WEAPON_NOCLIP
  5. #define GLOCK_MAX_CLIP      17
  6. #define PYTHON_MAX_CLIP     6
  7. #define MP5_MAX_CLIP      50
  8. #define MP5_DEFAULT_AMMO    25
  9. #define SHOTGUN_MAX_CLIP    8
  10. #define CROSSBOW_MAX_CLIP   5
  11. #define RPG_MAX_CLIP      1
  12. #define GAUSS_MAX_CLIP      WEAPON_NOCLIP
  13. #define EGON_MAX_CLIP     WEAPON_NOCLIP
  14. #define HORNETGUN_MAX_CLIP    WEAPON_NOCLIP
  15. #define HANDGRENADE_MAX_CLIP  WEAPON_NOCLIP
  16. #define SATCHEL_MAX_CLIP    WEAPON_NOCLIP
  17. #define TRIPMINE_MAX_CLIP   WEAPON_NOCLIP
  18. #define SNARK_MAX_CLIP      WEAPON_NOCLIP
  19.  

Okay well simply Change the Glock to like a 7 so now it has 7 bullets per clip :P so change the number, unless you want it to have no clip there for you would use the Value WEAPON_NOCLIP

[page=Ammo in gun at pickup]

  1. code:
  1. // the default am&#111;unt &#111;f amm&#111; that c&#111;mes with each gun when it spawns
  2. #define GLOCK_DEFAULT_GIVE      17
  3. #define PYTHON_DEFAULT_GIVE     6
  4. #define MP5_DEFAULT_GIVE      25
  5. #define MP5_DEFAULT_AMMO      25
  6. #define MP5_M203_DEFAULT_GIVE   0
  7. #define SHOTGUN_DEFAULT_GIVE    12
  8. #define CROSSBOW_DEFAULT_GIVE   5
  9. #define RPG_DEFAULT_GIVE      1
  10. #define GAUSS_DEFAULT_GIVE      20
  11. #define EGON_DEFAULT_GIVE     20
  12. #define HANDGRENADE_DEFAULT_GIVE  5
  13. #define SATCHEL_DEFAULT_GIVE    1
  14. #define TRIPMINE_DEFAULT_GIVE   1
  15. #define SNARK_DEFAULT_GIVE      5
  16. #define HIVEHAND_DEFAULT_GIVE   8
  17.  

okay this is the next line, this just shows or repersents how much ammo is given with the gun when you first pick it up. this can be changed, by simply changing the numbers.

[page=Ammo Box Pick ups]

  1. code:
  1. // The am&#111;unt &#111;f amm&#111; given t&#111; a player by an amm&#111; item.
  2. #define AMMO_URANIUMBOX_GIVE  20
  3. #define AMMO_GLOCKCLIP_GIVE   GLOCK_MAX_CLIP
  4. #define AMMO_357BOX_GIVE    PYTHON_MAX_CLIP
  5. #define AMMO_MP5CLIP_GIVE   MP5_MAX_CLIP
  6. #define AMMO_CHAINBOX_GIVE    200
  7. #define AMMO_M203BOX_GIVE   2
  8. #define AMMO_BUCKSHOTBOX_GIVE 12
  9. #define AMMO_CROSSBOWCLIP_GIVE  CROSSBOW_MAX_CLIP
  10. #define AMMO_RPGCLIP_GIVE   RPG_MAX_CLIP
  11. #define AMMO_URANIUMBOX_GIVE  20
  12. #define AMMO_SNARKBOX_GIVE    5
  13.  

Okay this is the last one. but it speaks for itself, you pick up bullets or a box of bullets and it adds the amount that you have typed in here

[page=Disabling Weapons you dont want used]
Okay this is a quick explanation how you can stop a weapon from being used. ill use some codes from here and ill disable the RPG ill do them in according chapter order to!

  1. code:
  1. //First line t&#111; edit t&#111; disable weap&#111;n
  2. //default is 5 im changing it t&#111; 0
  3. #define ROCKET_MAX_CARRY 0  
  4.  

heres a little punishment for those people who use amx and make the rocket accesible

  1. code:
  1. #define RPG_WEIGHT      90
  2.  

that i just defined is practically, well not moving

and the last code to change...

  1. code:
  1. #define RPG_MAX_CLIP      1
  2.  
  3. change t&#111;
  4.  
  5. #define RPG_MAX_CLIP      0
  6.  

Now your done when they get the weapon it will show up
but they cannot pull it out or use it. and if amx modders get by that. they have to worry about weight issues, you wont be able to walk. but thats something i pulled on my friend, he tried to fix the rpg weight for days, then i told him :D

ANYWAYS HOPE YOU ENJOYED IT its easy as hell a newb could understand this.

Comments
Kiith-Somtaaw
Kiith-Somtaaw Dec 24 2005, 2:40pm says:

Hmm... its a good enough tut. HOWEVER you did not specify what game it is (I assume Half-Life 2?) and what editor you are using to make it (Hammer?) and because of that, this is useless.

-1 votes     reply to comment
Maggot4ever
Maggot4ever Mar 8 2009, 7:54pm replied:

u r really sily, u faggot.

+1 vote     reply to comment
djjonastybe
djjonastybe Apr 13 2009, 7:51am replied:

retarded...

+2 votes     reply to comment
joeypc1
joeypc1 May 4 2009, 6:39am replied:

hey says if you CAN read for half-life 1

+1 vote     reply to comment
Chunky
Chunky Dec 25 2005, 11:23am says:

Why do you think there's a big Half-Life 1 logo in front of the title :P

+1 vote     reply to comment
l0d1z
l0d1z Jan 20 2006, 8:25am says:

how about adding new weapons then?

+1 vote     reply to comment
sbc_hs520
sbc_hs520 Apr 21 2006, 2:58pm says:

i have steam and can't find the "weapon.h" file

+1 vote     reply to comment
YodaLife
YodaLife May 31 2006, 3:23pm says:

SBC, the weapon.h file is in the half life sdk. Just google "half life sdk 2.3." You'll also have to get a c++ compiler.

+1 vote     reply to comment
bobby0415
bobby0415 Jun 2 2006, 5:33pm says:

this is probly the most easy mod there is on the face of the world..... if you cannot do this mod... you are clearly a dumb*** lol

0 votes     reply to comment
bobby0415
bobby0415 Jun 2 2006, 5:34pm says:

Need a C++ Compiler? Get "DevC++" (Google it. It is free and it has one of the best c++ environments..... and yes this compiler can open .h files :) and .cpp and many more...... and also very easy to use..... :)

+1 vote     reply to comment
bobby0415
bobby0415 Jun 2 2006, 5:39pm says:

No... in order to add weapons your gonna need some knowledge in DX.... if you need help on that kind of subject, check this page out. This page does not tell you about DX it just basicaly talks about a guy wanted to creat a mod for hl and ppl are telling him what is what...... Halflife2.net

that page is only helpful to find y u need DX :)

+1 vote     reply to comment
bobby0415
bobby0415 Jul 7 2006, 10:31pm says:

Please, do not get the "Dev C++" It does not compile the source code... (and no, I don't mean source as in hl2 or cs:s, source as in the source code "sc" like in SDK) Just download or buy Microsoft Visual C++ ....works like a charm..

And great guide!!!! Helped soo much.....

+1 vote     reply to comment
DeadlyContagion
DeadlyContagion Jul 20 2006, 7:43pm says:

you could use codeblocks, search for it on the VERC forums

+1 vote     reply to comment
Chuto
Chuto Sep 5 2006, 8:58pm says:

nice, but i can't find weapon.h, the closest thing to it is skill.cfg...

+1 vote     reply to comment
Kiith-Somtaaw
Kiith-Somtaaw Jul 8 2007, 2:59pm says:

Whoo, Jesus I sounded like an idiot back then, eh?
(No comments on "lol u always sound leik an idiot")

Good tut now that I actually came to need it, by the way.

+2 votes     reply to comment
hlnerd
hlnerd Apr 21 2008, 8:17am says:

i have won version of half-life. but i can not find Weapons.h file

+1 vote     reply to comment
juniez
juniez Jun 8 2008, 6:05pm replied:

you need the HL source code at: Articles.thewavelength.net
and visual studio 2003 (google it) (not free)

+1 vote     reply to comment
joeypc1
joeypc1 Jul 6 2008, 7:29am replied:

i can get it free

0 votes     reply to comment
Guillermo123
Guillermo123 Jun 19 2009, 5:14pm replied:

thx i can get Free ;)

+1 vote     reply to comment
hlnerd
hlnerd Jun 4 2008, 12:35pm says:

i know how to change weapon damage in half-life. My glock makes more damage than the shotgun

+1 vote     reply to comment
juniez
juniez Jun 8 2008, 6:03pm says:

This tutorial helped me, but is there a tutorial for adding weapons in half-life

+1 vote     reply to comment
joeypc1
joeypc1 Jun 23 2008, 12:35pm says:

this can be done too in skill.cfg but than you can make enemy's bad etc.

+1 vote     reply to comment
hlnerd
hlnerd Sep 3 2008, 10:54am says:

i have edited the file with notepad. and what the hell should i do now? where should i put the damn file?

+1 vote     reply to comment
joeypc1
joeypc1 Jan 26 2009, 11:01am says:

hl1 tut but were is weapons.h located.

+1 vote     reply to comment
crazyb2000
crazyb2000 Mar 12 2009, 4:21pm says: Online

hey can someone help me with my coding problem. I have the source code of half-life and I really want to code. but without doing anything to it I compiled it and it had about 200 errors, so it failed. any suggestions

+1 vote     reply to comment
m82sniper
m82sniper Aug 14 2009, 10:35pm replied: Online

A better compiler.

+1 vote     reply to comment
EDOC32
EDOC32 Apr 8 2009, 8:45pm says:

Hello. as is called the file??? greetings

+1 vote     reply to comment
hlnerd
hlnerd Jun 6 2009, 12:18pm says:

i now have the c++ compiler but in wich file format should i save it?

+1 vote     reply to comment
Post a Comment

Only registered members can share their thoughts. So come on! Join the community today (totally free) and do things you never thought possible.

Track this game Profile
Icon
Half-Life
Platforms
PC, PS2
Developer & Publisher
Valve
Engine
GoldSource
Contact
Send Message
Release Date
Released Oct 26, 1998
Game Watch
Track this game
Bookmark
Digg Super bookmark
Tutorial
Browse
Tutorials
Report Abuse
Report article
Bookmark
Digg Super bookmark
Related Games
Half-Life
Half-Life
Single & Multiplayer First Person Shooter