||James "Drywall" Layman
Well, this is a fairly simple lesson which changes the
grenade launcher into a flare launcher, which is very
useful for lighting up those dark rooms. After a
variable amount of time, it will blow up and the light
will be gone again.
Now open up weapons.qc and scroll down to the line
where you see:
void() GrenadeExplode =
T_RadiusDamage (self, self.owner, 120, world) //Change to "0"
Now, since we don't want the flare to do any damage, change the blue part, to "0"
Now, find the "void W_FireGrenade" part in weapons.qc. Since this isn't a grenade anymore, we
have to add a light function. The added part is in blue.
missile.classname = "grenade";
missile.effects = missile.effects | EF_BRIGHTLIGHT; //Add this line
Now when the grenade shoots out, the bright light
effects will be applied to it. EF_DIMLIGHT can
be used as well.
Now for the final edit, you probably don't want the
flare to stay for the default of 2.5 seconds, so you
might wanna change that. :) So scroll further in
W_FireGrenade, until you see:
missile.nextthink = time + 2.5; //Change to as long as you want the grenade to light
Now, change the blue part, to how many seconds you want
the flare to light up. 15 is a good number here.
And that's all folks, just compile and run. Select the Granade launcher and fire it, to launch a flare.