No More Backpacks
Created By: Marius
eMail: lordshoel@yahoo.com
Difficulty Scale: Easy


Have you ever played a game of Quake multiplayer where player backpacks were just every where? Did this eventually cause spam? Sick of the elusive 'Mother load'? Well why not fix these problems? It is easy and simple. The following tutorial removes player backpacks, replacing them with the last used weapon of the player. It's really easy to add to any mod and the variables are easy to change to suit your mod.

Step 1.

Firstly download shotgun.zip before you go any further. There is no model for the single barrel shotgun. This zip file contains a mdl.

Step 2.

Open Items.qc
Scroll down to the function: DropBackpack. Find the part as below:

	item.ammo_shells = self.ammo_shells;
	item.ammo_nails = self.ammo_nails;
	item.ammo_rockets = self.ammo_rockets;
	item.ammo_cells = self.ammo_cells;
Ok, found it? If you have then delete it. What it did is set tha ammo contained in the backpack to that of the player the dropped it. With it gone there should nolonger be a ammo filled pack.

When done there go down to the last few lines, it should look something like:

	item.nextthink = time + 120;	// remove after 2 minutes
	item.think = SUB_Remove;
What it does is set the time for it to remain. Change it so it should be as below:

	//Set as you like, between 30-60 secs is good
	item.nextthink = time + 60;
	item.think = SUB_Remove;
Congradulations, the easy part is almost done. Find the following lines in DropBackpack:

	setmodel (item, "progs/backpack.mdl");
	setsize (item, '-16 -16 0', '16 16 56');
Found it? If you have delete the setmodel statement and the setsize. This means we need to add some new models, thats Step 3, save and continue.

Step 3.

Still in Items.qc and the function DropBackpack. Scroll down to the bit in the function that reads:

	item.items = self.weapon;
	if (item.items == IT_AXE)
		item.netname = "Axe";
	else if (item.items == IT_SHOTGUN)
		item.netname = "Shotgun";
	else if (item.items == IT_SUPER_SHOTGUN)
		item.netname = "Double-barrelled Shotgun";
	else if (item.items == IT_NAILGUN)
		item.netname = "Nailgun";
	else if (item.items == IT_SUPER_NAILGUN)
		item.netname = "Super Nailgun";
	else if (item.items == IT_GRENADE_LAUNCHER)
		item.netname = "Grenade Launcher";
	else if (item.items == IT_ROCKET_LAUNCHER)
		item.netname = "Rocket Launcher";
	else if (item.items == IT_LIGHTNING)
		item.netname = "Thunderbolt";
	else
		item.netname = "";
Now that you have found it delete it and replace it with the below code:

	item.items = self.weapon;
	if (item.items == IT_AXE)
	{
		return;		//No point in receiving an Axe ? 
	}
	else if (item.items == IT_SHOTGUN)
	{
		setmodel (item, "progs/shotgun.mdl");
		setsize (item, '-16 -16 0', '16 16 56');
		item.ammo_shells = 10;
		item.netname = "Shotgun";
	}
	else if (item.items == IT_SUPER_SHOTGUN)
	{	
		setmodel (item, "progs/g_shot.mdl");
		setsize (item, '-16 -16 0', '16 16 56');
		item.ammo_shells = 10;
		item.netname = "Double-barrelled Shotgun";
	}
	else if (item.items == IT_NAILGUN)
	{	
		setmodel (item, "progs/g_nail.mdl");
		setsize (item, '-16 -16 0', '16 16 56');	
		item.ammo_nails = 25;
		item.netname = "Nailgun";
	}
	else if (item.items == IT_SUPER_NAILGUN)
	{
		setmodel (item, "progs/g_nail2.mdl");
		setsize (item, '-16 -16 0', '16 16 56');
		item.ammo_nails = 25;
		item.netname = "Super Nailgun";
	}
	else if (item.items == IT_GRENADE_LAUNCHER)
	{	
	
		setmodel (item, "progs/g_rock.mdl");
		setsize (item, '-16 -16 0', '16 16 56');
		item.ammo_rockets = 10;
		item.netname = "Grenade Launcher";
	}
	else if (item.items == IT_ROCKET_LAUNCHER)
	{
		setmodel (item, "progs/g_rock2.mdl");
		setsize (item, '-16 -16 0', '16 16 56');
		item.ammo_rockets = 10;
		item.netname = "Rocket Launcher";
	}
	else if (item.items == IT_LIGHTNING)
	{
		setmodel (item, "progs/g_light.mdl");
		setsize (item, '-16 -16 0', '16 16 56');
		item.ammo_cells = 15;
		item.netname = "Thunderbolt";
	}
Now to explain what it does.

	else if (item.items == IT_LIGHTNING) - If Lightning Gun then do brackets
	{
		setmodel (item, "progs/g_light.mdl"); - Sets model for the Lightning Gun	
		setsize (item, '-16 -16 0', '16 16 56'); - Sets size.
		item.ammo_cells = 15; - Sets ammo of gun, adjust as needed		
		item.netname = "Thunderbolt"; - Sets name for when you pick it up
	}
Save and go to Step 4. The last Step and your home free....

Step 4.

Scroll up to the start of Items.qc, above the function SUB_Regen paste the below code:

void() I_Precache =
{
	precache_model ("progs/shotgun.mdl");
	precache_model ("progs/g_shot.mdl");
	precache_model ("progs/g_nail.mdl");
	precache_model ("progs/g_nail2.mdl");
	precache_model ("progs/g_rock.mdl");
	precache_model ("progs/g_rock2.mdl");
	precache_model ("progs/g_light.mdl");
};
This precaches the models for the backpack. But it needs to be called.
Save and open up World.qc, scroll down to the WorldSpawn function. In it find:

// player precaches	
	W_Precache ();			// get weapon precaches
Below W_Precache(); add I_Precache();.
Save it and your done.

Step 5.

Compile the patch and voila. Weapons rather than Backpacks. Cool or what. Have a fiddle with it and change it in any way you want. If you use it in a mod, please give me credit for it. Have fun and happy gaming...