Quake 2 Explosions
Author: MariusSource: https://www.insideqc.com/qctut/qctut-62.shtml
Ever played the Quake 2 Demo? Liked the explosions more that normal Quake's? If so this is for you. We'll add to new explosions in sprite form and make it randomized as to which is used. Firstly download explosions.zip, this is two sprites to be placed in the Progs folder.
Step 1.
Create a new file called Explosions.qc into the file past the following code:
/*
==================================================
EXPLOSIONS
==================================================
*/
void() s_explodea1 = [0, s_explodea2] {};
void() s_explodea2 = [1, s_explodea3] {};
void() s_explodea3 = [2, s_explodea4] {};
void() s_explodea4 = [3, s_explodea5] {};
void() s_explodea5 = [4, s_explodea6] {};
void() s_explodea6 = [5, SUB_Remove] {};
void() BecomeExplosion1 =
{
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
self.touch = SUB_Null;
setmodel (self, "progs/s_expl1.spr");
self.solid = SOLID_NOT;
s_explodea1 ();
};
void() s_explodeb1 = [0, s_explodeb2] {};
void() s_explodeb2 = [1, s_explodeb3] {};
void() s_explodeb3 = [2, s_explodeb4] {};
void() s_explodeb4 = [3, s_explodeb5] {};
void() s_explodeb5 = [4, s_explodeb6] {};
void() s_explodeb6 = [5, s_explodeb7] {};
void() s_explodeb7 = [6, s_explodeb8] {};
void() s_explodeb8 = [7, SUB_Remove] {};
void() BecomeExplosion2 =
{
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
self.touch = SUB_Null;
setmodel (self, "progs/s_expl2.spr");
self.solid = SOLID_NOT;
s_explodeb1 ();
};
void() BecomeExplosion =
{
if (random() < 0.4 ) { BecomeExplosion2(); return; }
else { BecomeExplosion2(); return; }
};
Step 2.
Ok open up Weapons.qc and scroll to the BecomeExplosion function above T_MissileTouch. Found it? Ok then delete it.
Once you have deleted BecomeExplosion head up to W_Preacache and add the following to the bottom of the function:
//Explosions
precache_model ("progs/s_expl1.spr");
precache_model ("progs/s_expl2.spr");
Save and go onto Step 3.
Step 3.
Open Ogre.qc. Find the following function OgreGrenadeExplode. Replace the entire function with the code below:
void() OgreGrenadeExplode =
{
T_RadiusDamage (self, self.owner, 40, world);
sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
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);
self.velocity = '0 0 0';
self.touch = SUB_Null;
BecomeExplosion ();
};
This fixes and error as does the step below.Step 4.
Open Shalrath.qc. Find the following function ShalMissileTouch. Replace the entire function with the code below:
void() ShalMissileTouch =
{
if (other == self.owner) return; // don't explode on owner
if (other.classname == "monster_zombie") T_Damage (other, self, self, 110);
T_RadiusDamage (self, self.owner, 40, world);
sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
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);
self.velocity = '0 0 0';
self.touch = SUB_Null;
BecomeExplosion ();
};
Now on to the final step...Step 5.
Open up Progs.src and above Items.qc paste:
Explosions.qc //Quake 2 Explosions
Save it and continue to Step 6.Step 6.
Once you have saved everything compile and voila! Two new Quake 2 explosions. Pretty Cool.... Have fun with this mod and Happy Gaming!
Tags: tutorial, quakec, qc, insideqc, weapon