Introduction
You have probably played Counter-Strike and fired the pistol, where you have to keep clicking rapidly to continue firing rather than simply holding down the trigger. Well today we're going to make the shotgun in Quake fire like that pistol. It's that easy to turn the shotgun into a trustworthy riotgun.
Step 1 - Defining the variable
First break into DEFS.QC, drop down to the bottom edge of the file, hit enter several times, then type in:
.float semi; // CHP - Semiauto
Save and close DEFS.QC.
Step 2 - Hooking it up to the shotgun
Open WEAPONS.QC.
Go to W_Attack function
find:
else if (self.weapon == IT_SHOTGUN)
{
player_shot1 ();
W_FireShotgun ();
self.attack_finished = time + 0.5;
}
change to:
else if (self.weapon == IT_SHOTGUN)
{
if(!self.semi){
player_shot1 ();
W_FireShotgun ();
self.semi = 1; // chpsemiauto
self.attack_finished = time + 0.1; // faster
}
}
What you see above is the place where once you hold the trigger, it fires once. Pretty much the same way ID did to stop the Quake guy from pogo-stick jumping.
Step 3 - The Final Step - resetting the trigger]
Scroll down to W_WeaponFrame, at this part of the function:
// check for attack
if (self.button0)
{
SuperDamageSound ();
W_Attack ();
}
Above the first line, add:
// CHP - Semi Auto Tutorial
if (!self.button0)
self.semi = 0; // CHP - Semi Auto Trigger
Save, compile and run. Now pump them with pellets. Repeatedly. Until you get your carpal tunnel syndrome. Enjoy.
Written in February 2002. ANCIENT AGAIN!
Why is this the most viewed tutorial? Hmm...
Because it's been the latest tutorial for a long time :)
Actually the mapping one has more views