[Image]

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

 [Image]Step 1
        This mod will cause the grenades to shot a spray of nails in all
        directions when a grenade explodes creating a nailbomb. First, open
        the file weapons.qc and scroll down to about line 544 which should
        read:

        /*
        ================
        W_FireGrenade
        ================
        */

 [Image]Step 2
        Just above the W_FireGrenade section you will want to add a function like the one below. The
        comments will help you to understand what it is doing. It should be simple to understand.
        Basically, it shoots 40 nails in random directions and then explodes. It will all seem to
        happen at the same time during the game.

        void () NailBombExplode =
        {
                local vector    dir;  // Declares direction spike is to be lauched in
                local float     counter = 0; //Controls the loop
                while (counter < 40) //A loop that executes 40 times launching 40 nails
                        {
                                counter  = counter + 1;
                                dir_x = crandom ();     // Randomizes the X coordinate of dir
                                dir_y = crandom ();     // Randomizes the Y coordinate of dir
                                dir_z=  crandom();      // Randomizes the Z coordinate of dir
                                launch_spike(self.origin, dir);  //Calls the function to launch a spike
                        }
                GrenadeExplode(); //BOOM!
                return; //End of the function, go back to game
        };

 [Image]Step 3
        Now go into the "W_FireGrenade" function, to the section below. You need to change
        the line in blue, so that it uses your function as the next thing it will do after
        2.5 seconds.

                missile.touch = GrenadeTouch;

        // set missile duration
                missile.nextthink = time + 2.5;
                missile.think = GrenadeExplode;  //Change the blue part to NailBombExplode.

 [Image]Step 4
        Almost there. Now you must change another line similar to what you
        did in Step 3. Scroll up a little to the "GrenadeTouch" function. In
        this function there will also be a line that calls "GrenadeExplode."
        Change it to "NailBombExplode" for the same reason as above.

                if (other.takedamage == DAMAGE_AIM)
                {
                        GrenadeExplode();   //Change to NailBombExplode()
                        return;
                }

 [Image]Step 5
        Now go up to the very top. Where you see the code below. Add the line in
        blue. This code for this function is written way down below the grenade
        section. The reason you must add this line is so that when the new function
        you wrote calls it the compiler knows to keep going because it will be
        defined later. I hope you got that. :)

        void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
        void () player_run;
        void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage;
        void(vector org, vector vel, float damage) SpawnBlood;
        void() SuperDamageSound;
        void(vector org, vector dir) launch_spike  //Add this line

 [Image]Step 6
        That's it. Compile it, run it, and have fun. Your grenades now fire a
        spray of forty nails when they explode. These nailbombs and so
        powerful they can take out a shambler in two direct hits. Good luck.
