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.

Post tutorial Report RSS 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 on - 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:

// weapon clip/carry ammo capacities
#define URANIUM_MAX_CARRY 100
#define _9MM_MAX_CARRY 200
#define _357_MAX_CARRY 36
#define BUCKSHOT_MAX_CARRY 125
#define BOLT_MAX_CARRY 50
#define ROCKET_MAX_CARRY 5
#define HANDGRENADE_MAX_CARRY 10
#define SATCHEL_MAX_CARRY 5
#define TRIPMINE_MAX_CARRY 5
#define SNARK_MAX_CARRY 15
#define HORNET_MAX_CARRY 100
#define M203_GRENADE_MAX_CARRY 10

**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...

// weap&#111;n weight fact&#111;rs &#40;f&#111;r aut&#111;-switching&#41;   &#40;-1 = n&#111;switch&#41;
#define CROWBAR_WEIGHT		0
#define GLOCK_WEIGHT		10
#define PYTHON_WEIGHT		15
#define MP5_WEIGHT			15
#define SHOTGUN_WEIGHT		15
#define CROSSBOW_WEIGHT		10
#define RPG_WEIGHT			20
#define GAUSS_WEIGHT		20
#define EGON_WEIGHT			20
#define HORNETGUN_WEIGHT	10
#define HANDGRENADE_WEIGHT	5
#define SNARK_WEIGHT		5
#define SATCHEL_WEIGHT		-10
#define TRIPMINE_WEIGHT		-10

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

// the maximum am&#111;unt &#111;f amm&#111; each weap&#111;n&#39;s clip can h&#111;ld
#define WEAPON_NOCLIP			-1

//#define CROWBAR_MAX_CLIP		WEAPON_NOCLIP
#define GLOCK_MAX_CLIP			17
#define PYTHON_MAX_CLIP			6
#define MP5_MAX_CLIP			50
#define MP5_DEFAULT_AMMO		25
#define SHOTGUN_MAX_CLIP		8
#define CROSSBOW_MAX_CLIP		5
#define RPG_MAX_CLIP			1
#define GAUSS_MAX_CLIP			WEAPON_NOCLIP
#define EGON_MAX_CLIP			WEAPON_NOCLIP
#define HORNETGUN_MAX_CLIP		WEAPON_NOCLIP
#define HANDGRENADE_MAX_CLIP	WEAPON_NOCLIP
#define SATCHEL_MAX_CLIP		WEAPON_NOCLIP
#define TRIPMINE_MAX_CLIP		WEAPON_NOCLIP
#define SNARK_MAX_CLIP			WEAPON_NOCLIP

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]

// the default am&#111;unt &#111;f amm&#111; that c&#111;mes with each gun when it spawns
#define GLOCK_DEFAULT_GIVE			17
#define PYTHON_DEFAULT_GIVE			6
#define MP5_DEFAULT_GIVE			25
#define MP5_DEFAULT_AMMO			25
#define MP5_M203_DEFAULT_GIVE		0
#define SHOTGUN_DEFAULT_GIVE		12
#define CROSSBOW_DEFAULT_GIVE		5
#define RPG_DEFAULT_GIVE			1
#define GAUSS_DEFAULT_GIVE			20
#define EGON_DEFAULT_GIVE			20
#define HANDGRENADE_DEFAULT_GIVE	5
#define SATCHEL_DEFAULT_GIVE		1
#define TRIPMINE_DEFAULT_GIVE		1
#define SNARK_DEFAULT_GIVE			5
#define HIVEHAND_DEFAULT_GIVE		8

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]

// The am&#111;unt &#111;f amm&#111; given t&#111; a player by an amm&#111; item.
#define AMMO_URANIUMBOX_GIVE	20
#define AMMO_GLOCKCLIP_GIVE		GLOCK_MAX_CLIP
#define AMMO_357BOX_GIVE		PYTHON_MAX_CLIP
#define AMMO_MP5CLIP_GIVE		MP5_MAX_CLIP
#define AMMO_CHAINBOX_GIVE		200
#define AMMO_M203BOX_GIVE		2
#define AMMO_BUCKSHOTBOX_GIVE	12
#define AMMO_CROSSBOWCLIP_GIVE	CROSSBOW_MAX_CLIP
#define AMMO_RPGCLIP_GIVE		RPG_MAX_CLIP
#define AMMO_URANIUMBOX_GIVE	20
#define AMMO_SNARKBOX_GIVE		5

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!

//First line t&#111; edit t&#111; disable weap&#111;n
//default is 5 im changing it t&#111; 0
#define ROCKET_MAX_CARRY 0  

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

#define RPG_WEIGHT			90

that i just defined is practically, well not moving

and the last code to change...

#define RPG_MAX_CLIP			1 

change t&#111;

#define RPG_MAX_CLIP			0

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  (0 - 50 of 65)
Kiith-Somtaaw
Kiith-Somtaaw

(buried)

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.

Reply Good karma Bad karma-27 votes
:Jack
:Jack

u r really sily, u ******.

Reply Good karma Bad karma+4 votes
djjonastybe
djjonastybe

retarded...

Reply Good karma Bad karma+4 votes
deathparadeNL
deathparadeNL

hey says if you CAN read for half-life 1

Reply Good karma Bad karma+5 votes
Admer456
Admer456

Alright, i will do the man's job.
This is meant for the game Half Life (not 2).
You must use a piece of C++ programming language software which can compile dll files. Therefore, it's not useless, unless you don't have a C++ software (like Dev-C++), or Half Life (which i'm assuming, you have).
And the guy above me said you can't read, but if you wrote that comment, it makes no sense, because anybody who can read, can write, and the opposite, and the negative (who can't read, can't write, but i'm not sure).

Reply Good karma Bad karma+2 votes
Chunky
Chunky

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

Reply Good karma Bad karma+4 votes
l0d1z
l0d1z

how about adding new weapons then?

Reply Good karma Bad karma+1 vote
sbc_hs520
sbc_hs520

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

Reply Good karma Bad karma0 votes
Ian50028
Ian50028

You need to download the Half Life Source SDK 1.3

Reply Good karma Bad karma-3 votes
YodaLife
YodaLife

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.

Reply Good karma Bad karma0 votes
bobby0415
bobby0415

(buried)

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

Reply Good karma Bad karma-6 votes
bobby0415
bobby0415

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..... :)

Reply Good karma Bad karma0 votes
bobby0415
bobby0415

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 :)

Reply Good karma Bad karma0 votes
bobby0415
bobby0415

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.....

Reply Good karma Bad karma0 votes
DeadlyContagion
DeadlyContagion

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

Reply Good karma Bad karma0 votes
Chuto
Chuto

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

Reply Good karma Bad karma+1 vote
Kiith-Somtaaw
Kiith-Somtaaw

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.

Reply Good karma Bad karma0 votes
Minekiller33
Minekiller33

yes, yes you did.

Reply Good karma Bad karma+1 vote
hlnerd
hlnerd

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

Reply Good karma Bad karma0 votes
Juniez
Juniez

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

Reply Good karma Bad karma0 votes
deathparadeNL
deathparadeNL

i can get it free

Reply Good karma Bad karma-2 votes
NinjaBlack1337
NinjaBlack1337

thx i can get Free ;)

Reply Good karma Bad karma-1 votes
Admer456
Admer456

Anybody can get Visual Studio 2003, using TORR€NTS

Reply Good karma Bad karma+1 vote
Minekiller33
Minekiller33

.

Reply Good karma Bad karma+1 vote
hlnerd
hlnerd

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

Reply Good karma Bad karma0 votes
Admer456
Admer456

Let me guess, you edited the skill.cfg file?

Reply Good karma Bad karma+1 vote
Juniez
Juniez

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

Reply Good karma Bad karma0 votes
deathparadeNL
deathparadeNL

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

Reply Good karma Bad karma0 votes
hlnerd
hlnerd

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

Reply Good karma Bad karma-1 votes
deathparadeNL
deathparadeNL

hl1 tut but were is weapons.h located.

Reply Good karma Bad karma0 votes
Admer456
Admer456

You have to download half life sdk first, then go to it, find a folder named Single-Player Source, and then go into a folder called dlls, and find weapons.h

Reply Good karma Bad karma+1 vote
crazyb2000
crazyb2000

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

Reply Good karma Bad karma0 votes
m82sniper
m82sniper

A better compiler.

Reply Good karma Bad karma+2 votes
EDOC32
EDOC32

Hello. as is called the file??? greetings

Reply Good karma Bad karma0 votes
hlnerd
hlnerd

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

Reply Good karma Bad karma0 votes
Admer456
Admer456

Well, the weapon.h is an ".h" file, so you should compile the same thing.

Reply Good karma Bad karma+1 vote
PeterHat
PeterHat

does enyone know how to add custom weapons to half-life?

Reply Good karma Bad karma0 votes
Admer456
Admer456

twhl.info/articulator.php?art=31

I think this is what you're looking for.
Also add http stuff at the beginning.

Reply Good karma Bad karma+2 votes
Wazza999111
Wazza999111

Anyone who wants to know where the weapon.h is?U have to download hl sdk v2.3.

Reply Good karma Bad karma0 votes
X-LAyer2
X-LAyer2

So i got the sdk i modified what i wanted in weapons.h but now where do I put it do i leave it where it is or put it into half-life's dlls folder

Reply Good karma Bad karma0 votes
X-LAyer2
X-LAyer2

Do I need WON Half-life

Reply Good karma Bad karma0 votes
Timm64
Timm64

where do we put weapons.h when we finish coding?

Reply Good karma Bad karma0 votes
masquedios
masquedios

thanks

Reply Good karma Bad karma0 votes
TheUnbeholden
TheUnbeholden

What about weapon damage? In particular, increasing the headshot damage some of them can do?

Reply Good karma Bad karma0 votes
siftheadz
siftheadz

You can modify the damage from the skill file in the folder. This includes hits to various parts of the enemy body, such as head, chest, arms, etc...

Reply Good karma Bad karma0 votes
siftheadz
siftheadz

Is there anyway I can modify the accuracy of a certain weapon? I think the mp5 is way too inaccurate. I've been looking for ways to change that, but in vain. If you know how, please, please reply. Any help appreciated.

Reply Good karma Bad karma0 votes
GamingEVOlut1on
GamingEVOlut1on

Ahhhh....when i compile it gives me errors im using msvc 2008 c++ but i have the proper fixed sdk for msvc 2008.

Reply Good karma Bad karma0 votes
Blackvory
Blackvory

weapon.h ? where the hell that file placed?

Reply Good karma Bad karma+2 votes
portalfan39
portalfan39

as it does to create a weapon from copying another?
I did, but then I can not select, and also changed something and did not appear the shot

I need help!

sorry for my bad English

Reply Good karma Bad karma+1 vote
Guest
Guest

This comment is currently awaiting admin approval, join now to view.

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Icon
Half-Life
Platforms
Windows, Mac, Linux, PS2
Developer
Valve
Engine
GoldSource
Contact
Send Message
Release date
Game watch
Follow
Tutorial
Browse
Tutorials
Report
Report
Share
Related Games
Half-Life
Half-Life First Person Shooter
Related Engines
GoldSource
GoldSource Commercial
Related Groups
Sierra Entertainment
Sierra Entertainment Developer & Publisher
Valve
Valve Developer & Publisher