change weapon damage


(P4nth3r) #1

Ok, simple question (searched on the forum but couldn’t find anything usefull)
How do you change the damage of a weapon.
I want to change the damage that the pistols do but I really suck in c++
I’ve been looking in g_weapon.c but didn’t figure out what to change =(

thnx & Greetz Panther aka Way2Evil


(LION) #2

in g_weapon search for

this


int G_GetWeaponDamage( int weapon ) {

		switch (weapon) {
		default:
			return 1;
		case WP_KNIFE: 
			return 10;
		case WP_STEN: 
			return 14;
		case WP_CARBINE:
		case WP_GARAND:
		case WP_KAR98:
		case WP_K43:
			return 34;
		case WP_FG42: 
			return 15;
		case WP_LUGER:
		case WP_SILENCER:
		case WP_AKIMBO_LUGER:
		case WP_AKIMBO_SILENCEDLUGER:
		case WP_COLT:
		case WP_SILENCED_COLT:
		case WP_AKIMBO_COLT:
		case WP_AKIMBO_SILENCEDCOLT: 
		case WP_THOMPSON: 
		case WP_MP40: 
		case WP_MOBILE_MG42: 
		case WP_MOBILE_MG42_SET:
			return 18;
		case WP_FG42SCOPE: 
			return 30;
		case WP_GARAND_SCOPE: 
		case WP_K43_SCOPE: 
			return 50;
		case WP_SMOKE_MARKER: 
			return 140; // just enough to kill somebody standing on it
		case WP_MAPMORTAR: 
		case WP_GRENADE_LAUNCHER: 
		case WP_GRENADE_PINEAPPLE: 
		case WP_GPG40:
		case WP_M7: 
		case WP_LANDMINE: 
		case WP_SATCHEL:
			return 250;
		case WP_TRIPMINE: 
			return 300;
		case WP_PANZERFAUST: 
		case WP_MORTAR_SET: 
		case WP_DYNAMITE: 
			return 400;
	}
}

(P4nth3r) #3

thnx LION for the fast response.
It got it to work, only how does it work for headshots?

Thnx & Greetz Panther aka Way2Evil


(SCDS_reyalP) #4

look at g_combat.c G_Damage


(P4nth3r) #5

headShot = IsHeadShot(targ, dir, point, mod);
if ( headShot ) {
if( take * 2 < 50 ) // head shots, all weapons, do minimum 50 points damage
take = 50;
else
take *= 2; // sniper rifles can do full-kill (and knock into limbo)

I found this code but I don’t know what to change.
I don’t want all the weapons to have the same headshot damage. =(

Or am I looking at the wrong code part?

Help me =(

Greetz Panther aka Way2Evil


(dvldrmmr) #6

add below that something like:

if(mod==MOD_THOMPSON)
take = 500; // absurd number, but this is just an example

that checks if the person is being damaged by a thompson, and changes the damage amount (take) accordingly to whatever youd like. note: i havent tested this, but it should work.

you could check for the attackers weapon if you like, but that was a little more complicated … also, check out the etpub source, they have variable headshot damage in the same place youre talking about (i think its for all weapons though, but maybe itll help as well)

dvl


(P4nth3r) #7

Thnx dvl,

That should help me.
I’ll check out the source of etpub (if I can find it) =)

Thnx & Greetz Panther


(P4nth3r) #8

I checked the etpub source, but I couldn’t figure out how that works.
I’ll try your way first dvl if it doesn’t work correctly i’ll try etpub stuff again.

Thnx & Greetz Panther aka Way2Evil


(IneQuation) #9

ETPub didn’t change anything in this matter, m8. :wink: Dvl’s given you the right solution, you might just want to put the “other case” code in an else statement:

	if (mod == MOD_CARBINE) {
		take = CARBINE_DAMAGE * 2; // whatever number of damage you want your shotgun headshots to do
	} else {
		if( take * 2 < 50 ) // head shots, all weapons, do minimum 50 points damage
				take = 50;
			else
				take *= 2; // sniper rifles can do full-kill (and knock into limbo)
	}

(P4nth3r) #10

Well, I have more weapons that needs the headshot damage changed =) but thnx Rookie One.
As soon as I come home I’ll implant this is my code and give it a try.

Returned your PM Rookie One. :wink:

Greetz Panther aka Way2Evil


(IneQuation) #11

You can use a switch statement, then, but I’m going to explain this to you on MSN. :wink: