Inside3D tutorials.

Inside3D
 • Front Page
 • Articles
 • Downloads
 • Forums
 • Hosting
 • Help Wanted
 • Interviews
 • Reviews
 • Staff

 
Allied Sites
 - AI Cafe
 - Bot Epidemic
 - Dark Places
 - Flat Earth
 - FrikBot
 - Ghoulish Art
 - Kilbert3D
 - Quake Info Pool
 - QSG: Quake Standards
 - Rusted Fork
 - Stroggs Gone Mad
 - More...
 
Quake
 - Getting Started
 - QuakeC Specs v1.0
 - QuakeC Tutorials
 - Quake Mod Index
 
Quake II
 - Getting Started
 - dll Sourcecode
 - Coding Tutorials
 
.dll Central
 - Getting Started
 - Learning
 - dll Primer
 - dll in C
 - dll in Delphi
 - Compilers
 
Jedi Knight
 - Getting Started
 - COG Specs
 - Sound Specs
 - Tutorials
 
Level Editing
 - Tutorials/Tips
 
 
Telefragged!!!
Created By: SHaDoW.STaLKeR (Evan)
eMail: evan@patriot.net
Difficulty Scale: Easy


Step 1
From this tutorial you will learn how to turn the grenades from the grenade launcher into detonatable pipebombs. Pretty kewl, huh? Alrighty then, open the file weapons.qc and scroll down to about line 518 which should read:
void() GrenadeExplode =

Step 2
Directly above the "GrenadeExplode" function, you will want to add a new function, let's call it "Detonate." This part would be difficult to figure out on yourself, so I've given you the code below. The comments will help you to better understand what does what.. ok?
void() Detonate =
{
        local entity    missile; //Declares the float missile

        missile = findradius (self.origin, 10000); //Finds everything within a 10000 radius
        while(missile) //Loops through everything put in the missile entity
        {
                if((missile.classname == "grenade") && (missile.owner == self)) //Checks owner
                        missile.nextthink = time; //sends the message that it is time to react
                missile = missile.chain; //links every grenade found so they all go BOOM!
        }
};


Step 3
About now you're probably thinking, "what the hell just happened?" Well.. ok.. here is what that function is used for. Scroll down into the function "W_FireGrenade" and find the code below. The line in blue must be removed for the function "Detonate" to work. Notice that the line says "missile.nextthink" just like the line in "Detonate." Is it becoming any clearer, no? Well, you see by leaving the ".nextthink" out you have prevented the grenades from making the decision to blow up after 2.5 seconds, and by putting the line into the new function you have told the grenades to make the decision when that function is called.
	missile.touch = GrenadeTouch;
	
// set missile duration
	missile.nextthink = time + 2.5;  // Remove this line
	missile.think = GrenadeExplode;


Step 4
Wait, your not done yet. Now that you have a pipebomb laucher, you need a way to detonate the bombs. You must now go down to the section called *Impulse Commands*. This section is near the bottom of weapons.qc. In this function add the following lines:
        if (self.impulse == 63)  //Calls "detonate" when impulse 63 is entered
                Detonate ();


Step 5
That's it. Compile it, run it, and have fun. Your grenades now detonate when IMPULSE 63 is typed in the console. You can also BIND it to a key. For example, typing BIND Q "IMPULSE 63" at the console to make it so that pressing Q will detonate the grenades.






The Inside3D content and design is copyrighted by the Inside3D team, and may not be re-produced or copied without proper consent. All rights reserved. Any work credited to any author not part of InsideQC is copyrighted by that author. If you have any feedback, suggestions or flames please send it in to the author. Inside3D is hosted by telefragged and the design was originated by project-9.