[Image]

 Created By:                                        SHaDoW.STaLKeR (Evan)
 eMail                                              evan@patriot.net
 Difficulty Scale                                   Easy

 [Image]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 =

 [Image]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 to see if the grenades are yours
                                missile.nextthink = time; //sends the message that it is time to react
                        missile = missile.chain; //links every grenade found so they all go BOOM!
                }
        };

 [Image]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;

 [Image]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 function "detonate" when impulse 63 is entered at the console
                        Detonate ();

 [Image]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.
