Jaming Shotguns

1996-06-22 InsideQC tutorials kleskby 0 116
Author: The Devil
Source: https://www.insideqc.com/qctut/lesson-31.shtml

Step 1
This will make it so that your Shotgun will occasionaly jam. When it jams you will lose a shell and it will take 5 seconds before you can fire it again. First, open up WEAPONS.QC and find the lines that read:

	else if (self.weapon == IT_SHOTGUN)
	{
		player_shot1 ();
		W_FireShotgun ();
		self.attack_finished = time + 0.5;
	}

Change it to this:

	else if (self.weapon == IT_SHOTGUN)
	{
		local float r; // Makes a new float
		r = random ();  // sets r to a random number

		player_shot1 ();
		if (r < 0.03)  //gives it a 1 in 50 chance of jamming
		{
			W_FireShotJam ();   //make it jam
			self.attack_finished = time + 5; // make them wait 5 seconds  	
		}
		else
		{
			W_FireShotgun ();  // Business as usual
			self.attack_finished = time + 0.5;
		}
	}


Step 2
Now, Go up to just under the W_FireShotGun function and add this..

void() W_FireShotJam =
{
	self.currentammo = self.ammo_shells = self.ammo_shells - 1;   // Take Away a Shell	
	centerprint (self, "Damn, It Jammed\n");    // Tell them it jammed
};


Step 3
Coolio, eh?? Compile and have fun!

Tags: tutorial, quakec, qc, insideqc, weapon
Owned by kleskby#1837
Telegram
Close

You have no new notifications.


You have no new messages.