Inside3D tutorials.
Created By: Smoke2Much
eMail: smoke2much@Geocities.com
Difficulty Scale: Medium


Step 1
It's Cluster Bomb Time !!!! Find the gap between the end of the lightning damage code and the start of the GrenadeExplode code in weapons.qc. Now you need to create the following in that gap:-
void() ClusterExplode =
{
    T_RadiusDamage (self, self.owner, 60, world);    //Damage Variables, notice the third..
                                                     //...which only does 60 damage
    WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);    //Create temporary entity
    WriteByte (MSG_BROADCAST, TE_EXPLOSION);    //Tell engine the temp entity is an explosion
    WriteCoord (MSG_BROADCAST, self.origin_x);    //x coordinate of explosion
    WriteCoord (MSG_BROADCAST, self.origin_y);    //y coordinate of explosion
    WriteCoord (MSG_BROADCAST, self.origin_z);    //z coordinate of explosion
    BecomeExplosion ();    //Create explosion
};

void() GrenadeExplode =
{
    local float cluster=0;    //create a variable called cluster that equals zero
    local entity missile;    //create an entity called missile

    while (cluster < 5)    //while cluster is less than 5
    {
        cluster=cluster+1;    //add one to cluster
        missile = spawn ();    //spawn a missile
        missile.owner = self;    //missiles owner is player
        missile.movetype = MOVETYPE_BOUNCE;    //the missile will bounce
        missile.solid = SOLID_BBOX;     //the missile IS solid
        missile.classname = "grenade";

        // set missile speed

        missile.velocity_z = 500;    //missiles upward speed=500
        missile.velocity_x = -100 + (random() * 200);    //missiles x and y velocitys..
        missile.velocity_y = -100 + (random() * 200);    //are randomish
        missile.avelocity = '300 300 300';    //missiles rotating velocity
        missile.angles = vectoangles(missile.velocity);

        // set missile duration

        missile.nextthink = time + 1.5;    //Time before clusters go off
        missile.think = ClusterExplode;    //Where to go after time's up
        missile.touch = ClusterExplode;    //If touched then explode
        setmodel (missile, "progs/grenade.mdl");    //Missile model
        setsize (missile, '0 0 0', '0 0 0');    //Missile model size
        setorigin (missile, self.origin);    //Where the missile will appear
    }   //End of while loop

    T_RadiusDamage (self, self.owner, 20, world);    //This code and below destroys
                                   //The original grenade in a small explosion
    WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
    WriteByte (MSG_BROADCAST, TE_EXPLOSION);
    WriteCoord (MSG_BROADCAST, self.origin_x);
    WriteCoord (MSG_BROADCAST, self.origin_y);
    WriteCoord (MSG_BROADCAST, self.origin_z);

    BecomeExplosion ();
};


void() GrenadeExplode =
{
    T_RadiusDamage (self, self.owner, 120, world);

    WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
    WriteByte (MSG_BROADCAST, TE_EXPLOSION);    // Delete everything in BLUE!!!
    WriteCoord (MSG_BROADCAST, self.origin_x);
    WriteCoord (MSG_BROADCAST, self.origin_y);
    WriteCoord (MSG_BROADCAST, self.origin_z);

    BecomeExplosion ();
};



Step 2
That's the long boring part done. Now DELETE (!!!) the section called = GrenadeTouch. Final section now. Editing the section called W_FireGrenade. Simply change the following:-
    self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;    //Change 1 to be a 3
                                     //This means that each cluster bomb will cost 3 rockets
    missile.touch = GrenadeTouch;    //change the GrenadeTouch to read GrenadeExplode so that
                                     //the bomb explodes if touched

Step 3
And that's it... Compile it, and load it up the usual way. Try using the grenade launcher now !! (Funn as hell :)