Changing weapon's clip size


(kewl) #1

Hello,

Does anyone know how to change weapon’s clip size? I wanted to mod the sniper rifle so its clip size would be 1, to make it more realistic.

Thanks in advance,


(kamikazee) #2

This means you’ll have to edit the weapon data table found in the game code.

Got any experience with C and compiling binaries?


(kewl) #3

Yes I do.


(kamikazee) #4

Ok, in the mean time I fetched the location of the code you are interested in.

It’s in bg_misc.c, all set in the ammoTableMP variable. (It should be around line 200.)
Normally you should only need to change the MAX CLIP column, but do note that there is the Kar 98 and Carabine ( for engineers) and K43, Garand, K43-scoped and Garand-scoped. (for covert ops.)

Just change the lines you want to modify, compile and distribute both client and server files to test.


(kewl) #5

It’s not working.
Just to make a test I’ve edited Scoped Kar 43

{	1,				1,		1,		1,		1,		2500,	0,				400,	0,		0,		MOD_K43_SCOPE

It still has 10 shots clip and 20 ammo in game, while it should have 1 shot, 1 ammo.


(Elite) #6

After you compile, make sure you set fs_game to your mod directory…


(kewl) #7

I did change the fs_game.


(kamikazee) #8

As I said, there are different weapons of which a few overlap.

A covert ops gets a K43 AND a K43_SCOPED, so both ammotable entries play a role.

Oh, and I would change it more to something like this:

{ 30, 1, 1, 20, 1, 2500, DELAY_LOW, 400, 0, 0, MOD_K43_SCOPE },

	// WP_K43_SCOPE				// 40		K43

Otherwise, your ammo supply is also 1 bullet. I think snipers were equipped with more than just one bullet, no?

Also think of the waiting queues this would cause at an ammo stand…


(nUllSkillZ) #9

As far as I remember theres some info about the weapon and clips in the playerspawn source.

You could also search the whole source for “K43_SCOPE”.


(kewl) #10

:smiley: I know, but it was just a test.

Canged K43 to:

{	20,				1,		1,		30,		1,		2500,	DELAY_LOW,		400,	0,		0,		MOD_K43	

and K43 Scoped to:

{	20,				1,		1,		30,		1,		2500,	0,				400,	0,		0,		MOD_K43_SCOPE

But Covert Ops still has his 10 shots, 20 ammo rifle.

Maybe I’m doing something wrong with the pk3 files in mod directory?

I have my ‘snipermod’ directory and inside: snipermod_bin.pk3 (cgame_mp_x86.dll inside) and cgame_mp_x86.dll outside the pack.


(kamikazee) #11

Do you mean qagame is outside the package, or do you have cgame twice?

cgame -> client game code, should be in a pk3.
qagame -> server game code, should be in the mod folder.

Since this change is in bg_misc.c, both games can be affected which means you need both binaries as well. (The bg_ prefix stands for Both Games.)


(kewl) #12

That was it. I had cgame twice. Now it’s working, thanks for the help.


(C4nNoN f0dD3r) #13

Hi

Im trying to edit the same thing but whats the best programme to use
Ive tried c++ but it wont open it
Ive tried pe explorer

I am new to this!

Thanks


(BaronBlabla) #14

I’m actually interested in changing weapons and setting of weapons. Any tutorials on firing speed, damage, path of the models, ammo and more?

Baron


(BaronBlabla) #15

Anyone?