 |
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, the one to notice is the third...
//...which only does 60 damage
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); //Create temporary entity
WriteByte (MSG_BROADCAST, TE_EXPLOSION); //Tell engine that 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"; //if someone is killed by this then they were killed by a 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); //errrmmmm. Don't know but it spins the grenade
// 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 ();
};
|