quick 'n dirty headshot only mod for ET


(SCDS_reyalP) #1

This was somewhat popular in RTCW, so here it is for ET:


diff -c ../../WET_Source1.02_orig/src/game/g_combat.c game/g_combat.c
*** ../../WET_Source1.02_orig/src/game/g_combat.c	Tue Jul 22 18:05:56 2003
--- game/g_combat.c	Fri Jan 30 17:11:54 2004
***************
*** 1460,1465 ****
--- 1460,1503 ----
  			trap_SendServerCommand( attacker-g_entities, "print \"Body Shot
\"
");
  		}
  	}
+ //-- reyalP
+ //  headshot mode. If not headshot, and both sides are players and the target is
+ //  not down waiting for a med
+ //  simple version
+ /*
+ 	if ( rmg_headShot.integer && 
+ 		 !headShot && 
+ 		 attacker->client &&
+ 		 targ->client &&
+ 		 targ->client->ps.pm_type != PM_DEAD) {
+ 		take = 0; 
+ 	}
+ */	
+ //-- reyalP
+ // headshot mode enabled
+ 	if ( rmg_headShot.integer & RMOD_HS_ENABLE) {
+ 		// if not a headshot, we might still want to hurt some things
+ 		if( !headShot) {
+ 			// if the attacker is not a player, check if it should be able to give damage
+ 			if( !attacker->client && (rmg_headShot.integer & RMOD_HS_NPENOGIVEDAM)) {
+ 				take = 0;
+ 			}
+ 			// if the victim is not a player, check if it should be able to take damage
+ 			if( !targ->client && (rmg_headShot.integer & RMOD_HS_NPENOTAKEDAM)) {
+ 				take = 0;
+ 			}
+ 			// if the attacker and victim are a players, only damage them if they are dead,
+ 			// so we can send them on to limbo. Note this means that if NPENOGIVE is on then
+ 			// falling corpses never gib
+ 			if ( attacker->client && targ->client && targ->client->ps.pm_type != PM_DEAD) {
+ 				take = 0;
+ 			}
+ 	    }
+ 		// if this is a headshot, see if we should really really hurt them
+ 		else if (rmg_headShot.integer & RMOD_HS_INSTAGIB) {
+ 			take = 200;
+ 		}
+ 	}
  
  #ifndef DEBUG_STATS
  	if ( g_debugDamage.integer )
diff -c ../../WET_Source1.02_orig/src/game/g_local.h game/g_local.h
*** ../../WET_Source1.02_orig/src/game/g_local.h	Tue Sep  2 16:50:26 2003
--- game/g_local.h	Fri Jan 30 16:21:02 2004
***************
*** 12,18 ****
  
  // the "gameversion" client command will print this plus compile date
  #ifndef PRE_RELEASE_DEMO
! #define GAMEVERSION			"etmain"
  #else
  //#define GAMEVERSION			"You look like you need a monkey!"
  #define GAMEVERSION			"ettest"
--- 12,20 ----
  
  // the "gameversion" client command will print this plus compile date
  #ifndef PRE_RELEASE_DEMO
! // -- reyalp mod
! #define GAMEVERSION			"rmod"
! #define RMODVERSION			"0.1 alpha"
  #else
  //#define GAMEVERSION			"You look like you need a monkey!"
  #define GAMEVERSION			"ettest"
***************
*** 1777,1782 ****
--- 1779,1787 ----
  
  extern vmCvar_t		g_disableComplaints;
  
+ // -- reyalP
+ extern vmCvar_t		rmg_headShot;
+ 
  extern vmCvar_t	bot_debug;					// if set, draw "thought bubbles" for crosshair-selected bot
  extern vmCvar_t	bot_debug_curAINode;		// the text of the current ainode for the bot begin debugged
  extern vmCvar_t	bot_debug_alertState;		// alert state of the bot being debugged
***************
*** 2246,2251 ****
--- 2251,2266 ----
  #define AA_STATSTEAM	0x02	// Client AutoAction: Dump TEAM player stats
  
  
+ // --reyalP
+ // headshot mode flags
+ #define RMOD_HS_ENABLE		0x1
+ // non player entities don't give damage
+ #define RMOD_HS_NPENOGIVEDAM	0x2
+ // non player entities take damage
+ #define RMOD_HS_NPENOTAKEDAM	0x4
+ // headshots instagib
+ #define RMOD_HS_INSTAGIB		0x8
+ 
  // "Delayed Print" ent enumerations
  typedef enum {
  	DP_PAUSEINFO,		// Print current pause info
diff -c ../../WET_Source1.02_orig/src/game/g_main.c game/g_main.c
*** ../../WET_Source1.02_orig/src/game/g_main.c	Tue Sep  2 16:50:26 2003
--- game/g_main.c	Fri Jan 30 16:20:57 2004
***************
*** 203,208 ****
--- 203,210 ----
  
  vmCvar_t		g_disableComplaints;
  
+ // -- reyalP 
+ vmCvar_t		rmg_headShot;
  
  cvarTable_t		gameCvarTable[] = {
  	// don't override the cheat state set by the system
***************
*** 422,427 ****
--- 424,437 ----
  	{ &g_nextcampaign, "nextcampaign", "", CVAR_TEMP },
  
  	{ &g_disableComplaints, "g_disableComplaints", "0", CVAR_ARCHIVE },
+ // -- reyalP headshot mod. Should be SERVERINFO, but there are if there are too many SERVERINFOs
+ // enable change announcement
+ // 1: headshot mode
+ // + 2: non-players do not give damage (falling, barbwire)
+ // + 4: non-players do not take damage (tanks, bridges, doesn't include primary objectives)
+ // + 8: headshots instagib
+ 	{ &rmg_headShot, "rmg_headShot", "0", CVAR_SERVERINFO , 0, qtrue },
+  	{ NULL, "rmodversion", RMODVERSION , CVAR_SERVERINFO | CVAR_ROM },
  };
  
  // bk001129 - made static to avoid aliasing



(Fusen) #2

any chance this can be used on a euro server? as I played it on a server where my ping was 140 I still got in top 3 but the shot lag I got was just too much for my real uber skill to show through lol joking =X


Medical Marijuana Patients


(H.Potter) #3

Lol,

i did the same yesterday.

—Edit2 start—
Removed my code. I merged my code and the code of reyalP and i looks much cleaner now. I put some of the weapon fixes in and put the new version up on the server below.

Next to do: A vote for instant gib (on / off). :slight_smile:
—Edit end—

Try out (today): UNITED_ET-Headshot Trainingcenter (212.6.108.236:27960) or look in TASE after headshot_mod.

Have to tune it a little bit more, but it works quite well for now. Just was a quick and dirty hack like yours.

Edit: Ha, had a closer look to your code and you have some features, i didn’t put in… I go tweaking :slight_smile:

Greets
H. Potter


(sniser) #4

Don’t forget to turn off the flamer (it can make headshots too)!

Another nice option would be a PF with lots of ammo and little charge bar cost - I’d like to practice PF headshots, but I think I’m alone with that so nevermind :stuck_out_tongue:


(H.Potter) #5

PF is no HEADshot weapon, so you can’t practice that …: :smiley:


qboolean IsHeadShotWeapon (int mod) {
        // players are allowed headshots from these weapons
        if (    mod == MOD_LUGER ||
                        mod == MOD_COLT ||
                        mod == MOD_AKIMBO_COLT ||
                        mod == MOD_AKIMBO_LUGER ||
                        mod == MOD_AKIMBO_SILENCEDCOLT ||
                        mod == MOD_AKIMBO_SILENCEDLUGER ||
                        mod == MOD_MP40 ||
                        mod == MOD_THOMPSON ||
                        mod == MOD_STEN ||
                        mod == MOD_GARAND

                        || mod == MOD_KAR98
                        || mod == MOD_K43
                        || mod == MOD_K43_SCOPE
                        || mod == MOD_CARBINE
                        || mod == MOD_GARAND
                        || mod == MOD_GARAND_SCOPE
                        || mod == MOD_SILENCER
                        || mod == MOD_SILENCED_COLT
                        || mod == MOD_FG42
                        || mod == MOD_FG42SCOPE
                        )
                return qtrue;

        return qfalse;
}

Greets
H. Potter


(sniser) #6

Well, yeah, I wasn’t that serious about the PF… but if only Headshots did any damage with a PF, that would require good aim, so maybe it would be fun.

Anyway, regarding the flamer, it CAN do headshots. I don’t know the place in the code right now (looking for it, will post it when I found it), but I saw something - So I tried it out, and sure enough, when I was on your server running the headshot mod I could kill people with the flamethrower, so… :smiley:

I know it doesn’t make any sense since the IsHeadShot function immediately returns false if the check you posted above fails… as I said, I will post what I saw when I come across it again.


(H.Potter) #7

You could kill persons with a flawer, because i enabled one point of dmg for NONE headshots. The flamer makes much none headshot dmg this way… But i deactivated that also. Now the server behaves the same way as reyalP does, only that instant gib is deactivated atm.

Greets
H. Potter


(sniser) #8

Yeah… I was just looking at the code again, and couldn’t find it… I guess I had this “odd find” (either a leftover or a hallucination of mine) in the back of my head, so I automatically assumed that was the cause for being able to kill with the flamer whoops :banana:


(knuckles) #9

This is how we run it on the [NW] ET HeadShot Only Mod Server:

In ET shortcut add this to load mod:
+set fs_game rmod

In server config add these lines:
rmg_headshot set to 9 or 11 (or headshot will not be on, my server is set to 11)
set g_userAxisRespawnTime 2 (2 sec respawn)
set g_userAlliedRespawnTime 2

also, turned HeavyWeapon Restriction to 0, so panzers etc are off and people will not get mad cuz they don’t work on headshot.


(herf) #10

Help.

I like this mod, but I am basically totally clueless on how to get it up and running.
What do I do with that text? What file do I name it as? I assume from knuckles I name it
rmod? (from his +set fs_game rmod ).

Also If I ran it on an etPRO server would it work?
Also is it easily undoable, or would I have to reboot the server?
Thanks, and nice work with mod.

Herf rotators


(SCDS_reyalP) #11

The text is the changes to the source code. Unless you have the source and a C compiler, it won’t help you.

You need the compiled game .dll (or .so on linux) to run it. You cannot run it with ETpro, because that would overwrite the etpro .dll. Putting it in your ETPro directory will fuck things up. If you want headshot in ETPro, you have to convince bani to put that option in ETPro.

You can download the .dll here: http://www.cyberonic.net/~gdevault/rfm/rmod-0.1.zip
That includes a readme, the windows .dll and the the source patch listed above. It doesn’t include a linux .so, because I haven’t gotten around to making one yet.

I hope to come out with a new version that includes a linux build, a couple of improvements, and some etmain bugfixes soon.

To set it up.
Unzip the zip into your et directory (NOT YOUR ETMAIN OR ETPRO). This will create new directory called rmod. Inside it will be the .dll etc.
To run the mod, start the game with
et +set fs_game rmod
and whatever other options you want to start your server with. In you server configuration, you also need to set
rmg_headshot
to some value, or the mod will behave exactly like etmain.
The values of rmg_headshot are a bit field, meaning that you add the numbers together to get the desired options (I think voteflags work the same way…)
1: enable headshot mode. If this is not set, mod plays like etmain.
2: non-players do not give damage. If set, players will not take damage from falling, drowning, construction, or anything that is not a bullet to the head.
4: non-players do not take damage. If set, constructables, vehicles and breakables will not be damaged. However, dynamite objectives can still be completed.
8: instagib. It takes only a single headshot to kill and gib. If this is NOT set, then headshot damage is the same as ETmain, and players can be revived.

examples:
rmg_headshot 1 //just turn on headshot. Everything else is normal.
rmg_headshot 9 // headshot (1) + instagib (8) = 9
rmg_headshot 11 // headshot (1) + non players do not give damage (2) + instagib (8) = 11


(kriterium) #12

Can you make it for Linux ? :???:


([2GR]edhiltir.fr) #13

Hi,

I’m edhiltir from the 2GR clan, and I’ve compiled a linux version of your HeadShot mod.

It has been compiled on debian woody with gcc 2.95 and works fine on our server (81:91.66.189:27950 pass: rousse)

I’ve packaged it with your windows version, your txt and the .diff file. You can download it here : http://jpau.free.fr/rmod.zip

regards


(H.Potter) #14

Hi,

my version of the headshot mod, which i released in a 0.4 version today, is also available in a linux and a windows version.

You can download it here, including the following features:

// Headshot Mode (0.4):
// 1 : enable headshot mode
// + 2 : non-players do not give damage (falling, barbwire)
// + 4 : non-players do not take damage (tanks, bridges, doesn’t include primary objectives)
// + 8 : enable self damage of grenades, panzer, etc
// +16 : instant gib headshots
// +32 : 10 extra healthpoints for attacker on headshot
// +64 : Flip back panzer damage (needs +8 to work)
// +128 : Play sound on hit (sound/misc/headshot.wav, has to be in a pk3 file, [22khz,1channel, mono])
set g_headshot_mode 153

A sample pk3 is included in the downloadable file.

Added rcon Commands:

  • cancelvote (to cancel the current vote)
  • cp (Print in the center of the screen of all clients)
  • chat (display the text in the chat window of all clients)
  • echo (display the text in the upper text-window of all clients, doesn’t work atm)

See here:
http://www.gamesunited.de/ib/index.php?showtopic=7821

Download here:
http://www.et.gamesunited.de/files.html

Greets
H. Potter


(nUllSkillZ) #15

I just played a few minutes headshot mod on Fueldump in a campaign.
It doesn’t make sence when instagib is activated.
You don’t need Medics and Covert Ops.
You never get in by sneaking. Because Cov Op can not get Uniform.
And also the option that tanks could be damaged was on.
Very hard.
There should be another mode to play ET.
Deathmatch and teamdeathmatch for example.


(H.Potter) #16

Yes, fueldump is horror, when everybody goes fieldop and covert…

On goldrush (the next map in the cycle), there were more engies and most people also tried to fullfill the objectives. It’s real hard to tell people, that objectives are a goal too. Everyone wants to do headshots :bored: …

But if you don’t want instant gib on your server, then don’t activate it. You can configure it the way u want.

btw. forget to mention, that i included the fixes for that sound bug and some other fixes in my release.

Greets
H. Potter


(pgh) #17

If your gonna change summit and ‘release it’. Mind and a/ Should post the new updated code here, or what has been changed. b/ Creds to the Original Creator of the code and c/ Release it proper under someone sort of Public License. If someone comes along and bump bumps it then theres nothing you can do.


(nUllSkillZ) #18

Hi,

I’ve found another table with information according to headshots:
File: “bg_misc.c”
Table: “aWeaponInfo”: // Weapon full names + headshot capability


(guerilla) #19

crap, does anyone have another dl location for rmod? broken link for the linux binaries above.


(SCDS_reyalP) #20

try here: http://www.pcgamemods.com/4879/
note that the included linux binary will only work if you have a recent glibc.

You might also consider just running etpro3 in headshot mode instead.