Rage through 32 single player levels and 6 deathmatch levels of sheer terror and fully immersive sound and lighting. Arm yourself against the cannibalistic Ogre, fiendish Vore and indestructible Schambler using lethal nails, fierce Thunderbolts and abominable Rocket and Grenade Launchers.

Post tutorial Report RSS Semi-auto firing

This tutorial turns your shotty into a auto-shotty where the speed is only limited by the fastest finger.

Posted by on - Basic Server Side Coding

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!

Post comment Comments
leilei Author
leilei - - 5,721 comments

Why is this the most viewed tutorial? Hmm...

Reply Good karma+1 vote
Sajt
Sajt - - 1,641 comments

Because it's been the latest tutorial for a long time :)

Actually the mapping one has more views

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: