sniper instagib mod


(ignition) #1

Hi all,

only today i saw the source code for ET is released, so i started to work immediately :slight_smile:

to get familiar with the code i want to make a very easy instagib-like mod, sniper only.

in g_client.c i changed the whole spawn code to :

switch( client->sess.sessionTeam ) {
				case TEAM_AXIS:
					AddWeaponToPlayer( client, WP_K43, GetAmmoTableData(WP_K43)->defaultStartingAmmo, GetAmmoTableData(WP_K43)->defaultStartingClip, qtrue );
					AddWeaponToPlayer( client, WP_K43_SCOPE, GetAmmoTableData(WP_K43_SCOPE)->defaultStartingAmmo, GetAmmoTableData(WP_K43_SCOPE)->defaultStartingClip, qfalse );
				break;

				case TEAM_ALLIES:
					AddWeaponToPlayer( client, WP_GARAND, GetAmmoTableData(WP_GARAND)->defaultStartingAmmo, GetAmmoTableData(WP_GARAND)->defaultStartingClip, qtrue );
					AddWeaponToPlayer( client, WP_GARAND_SCOPE, GetAmmoTableData(WP_GARAND_SCOPE)->defaultStartingAmmo, GetAmmoTableData(WP_GARAND_SCOPE)->defaultStartingClip, qfalse );
				break;
	}
	
	client->ps.weaponstate = WEAPON_READY;

so i check the team and add a sniper rifle with some ammo.
i also changed the snipers damage to 140 in g_weapons.c.
compiled fine(duh :)) but when i tested it, i chose an allied medic and still got a thompson :< Is it because a played on a non-decicated server?

greetz ignition

ps. the features i want to implant

  • not unzooming when walking zoomed
  • full accuracy while walking/jumping/in air
  • unlimited ammo
  • leave out the xp system
  • DM/TDM mode
  • no more running, but moving faster with jumping(like Q3)
  • all players spawn with 100 hp

if u know any of these, please reply :slight_smile:


(bacon) #2

That’s not really instagib. Instagib requires quite a bit more code than that.
For instance, you might want only sniper rifles & dynamite to do damage, since you didn’t mention anything about MG42/tank mounted guns. You’ll also want engineers to have dynamite & pliers so they can do objectives.


(Seph64) #3

You also have to edit the weapons in bg_class.c, I had a simular dilema when I wanted the Field Ops to spawn with either the Thompson or MP40 regardless of team. bg_class.c (I hope) has code for what weapons each class spawns with.

Have fun modding!


(bacon) #4

I didn’t have to edit any bg_ files when I did instagib…


(ignition) #5

i know thiat this isnt instagib already…and i dont need to change gun damages because they cant be spawned. every player gets a sniper rifle, nothing else. maybe ET prohibits non cov ops’s to have a sniper rifle, didnt think of that yet. thx in advance

greetz ignition


(bacon) #6

Where’d you put the code? I have no problem having all classes spawn with sniper rifles.


(Seph64) #7

Did you change what weapons each classes started with when you did that?

He edited g_client.c, under setwolfspawnweapons I believe.


(ignition) #8

Did you change what weapons each classes started with when you did that?

He edited g_client.c, under setwolfspawnweapons I believe.[/quote]

yep correct :slight_smile:

thanks for the quick reply’s all of you. pls bacon post ur code…i cant see why mine doesnt work :<

ignition


(ignition) #9

huh, another weird thing

i have commented AddWeaponToPlayer( client, WP_KNIFE, 1, 0, qtrue ); out, but players still spawn with a knife…i think the game uses the standard game dll, instead of mine :confused: i created a dir called etstagib, and use +set fs_game etstagib +sv_pure 0

It’s time for a decent tutorial site ;p

ignition

edit : typo


(SCDS_reyalP) #10

you can see the code I posted for headshot mod if you want true instagib.

It seems like you should be able to do exactly the same thing as g_knifeonly for other weapons…

You don’t need +sv_pure 0 if you have only changed the game.dll (if you change the client you will need to make a .pk3 with the client .dlls in it to run pure)

You can add a modversion cvar (like in the code I posted) to be sure you are loading the right .dll. If the cvar isn’t there after you load the game, then you got the wrong .dll :stuck_out_tongue:


(nUllSkillZ) #11

Hi,

I’ve found another function that checks for weapon use:
File: “bg_misc.c”
Function: “BG_CanUseWeapon”


(telefase) #12

You are right, the game isn’t reading your dlls. I had the same problem and was getting quite frustrated. Than I actually did something silly and read the readme file. :wink: After you compile, are your dll files going into a Debug folder? If they are you just have to fix on thing. After you load up your workspace(ex. wolf.dsw) goto ‘Build’ and choose ‘Set Active Configuration’. Make sure you choose the ‘Win32 Release’ version of all the files (ui, game, cgame). So you have to do it three seperate times. I hope this helps you out. :slight_smile:

-tf


(ignition) #13
  • telefase : thanks…ive compiled it the way u told me, and it works fine now
  • nullskillz : ive changed the whole code to :
switch (teamNum) {
	case TEAM_AXIS :
		if (weapon == WP_K43)
		{
			return qtrue;
		}
		else
		{
			return qfalse;
		}

	break;
	case TEAM_ALLIES :
		if (weapon == WP_GARAND)
		{
			return qtrue;
		}
		else
		{
			return qfalse;
		}
	break;
	}

*reyalP ok, thanks for pointing that out. i will implant a headshot code later on…to let the player(s) know theyve made a headshot, and maybe award 2 points for a headshot :slight_smile:

to the next step :slight_smile:

ignition