Quake DeveLS - Drop It!

Author: Dan
Difficulty: Easy

Drop the weapon NOW punk...

Here's some source code I've been experimenting with. I envisionedcoupling it with some knock-back or freeze code, to enable stealing weapons from an opponent, but my computer is messed up and crashes about 50% of the time I load Quake2, so it's been tedious.

I modified the rail gun, but my original idea was to modify the BFG. I figured if you had enough time to blast someone with the BFG, they ought to pay for it by losing their weapons.

I modified the 3.14 version of the source code.

Open g_weapon.c and add to fire_rail() function...

 
... gitem_t *item;
int index, item_count;

// to make it easier to add items to the list 
char *item_list[] = {"Shotgun", "Super Shotgun", "Machinegun","Chaingun",
	"Grenade Launcher", "Rocket Launcher", "HyperBlaster", "Railgun", "BFG10K"};
item_count = 9;

...

if ((tr.ent != self) && (tr.ent->takedamage)) {
	// if enemy is another player - client is null if computer/monster
	if (tr.ent->client) {
		// switch to blaster
		//Weapon_Blaster(&tr.ent); - couldn't get it to work
		// drop items
		for (index=0;indexclient->pers.inventory[ITEM_INDEX(item)]) {
				// make them drop it
				Drop_General(tr.ent,item);
			}
		}
	}

	T_Damage (tr.ent, self, self, aimdir, tr.endpos, tr.plane.normal,damage, kick, 0, MOD_RAILGUN);
}
...That's it. I couldn't get the code to make a player drop all weapons andswitch to blaster. As it is, the player loses all weapons except the current one and the blaster. If you use this code and make a weapon mod, let me know, so I can download it.

Ed's note ... I think you can make the player change to the blaster by using 'ent->nextweapon = finditem("blaster")' (from memory, sorry didnt have time to test...) else a 'qstuffcmd(ent, "Use Blaster\n");' would work too... - SumFuka

Tutorial by Dan


This site, and all content and graphics displayed on it,
are ©opyrighted to the Quake DeveLS team. All rights received.
Got a suggestion? Comment? Question? Hate mail? Send it to us!
Oh yeah, this site is best viewed in 16 Bit or higher, with the resolution on 800*600.
Thanks to Planet Quake for there great help and support with hosting.
Best viewed with Netscape 4 or IE 3