Thunder Grenades

Inside3D
 • Front Page
 • Articles
 • Downloads
 • Forums
 • Hosting
 • Help Wanted
 • Interviews
 • Reviews
 • Staff

 
Allied Sites
 - AI Cafe
 - Bot Epidemic
 - Dark Places
 - Flat Earth
 - FrikBot
 - Ghoulish Art
 - Kilbert3D
 - Quake Info Pool
 - QSG: Quake Standards
 - Rusted Fork
 - Stroggs Gone Mad
 - More...
 
Quake
 - Getting Started
 - QuakeC Specs v1.0
 - QuakeC Tutorials
 - Quake Mod Index
 
Quake II
 - Getting Started
 - dll Sourcecode
 - Coding Tutorials
 
.dll Central
 - Getting Started
 - Learning
 - dll Primer
 - dll in C
 - dll in Delphi
 - Compilers
 
Jedi Knight
 - Getting Started
 - COG Specs
 - Sound Specs
 - Tutorials
 
Level Editing
 - Tutorials/Tips
 
 
Telefragged!!!
Created By: Dr DooMer
eMail: drdoomer@cross-bones.co.uk
Difficulty Scale: Easy


The grenade launcher may not be your favorite weapon right now, and after completing this tutorial it still might not be. But anyway, I'll show you how to make a nice effect that utilises the power of the temporary entities! So, open up weapons.qc and proceed to:

STEP 1:

Scroll down about half way until you find W_FireGrenade. Search for it's "missile.nextthink" line and change it to:

	missile.nextthink = time + 0.1;
And change it's "missile.think" line into:

	missile.think = GrenadeZap;
Now, all we have done here is to tell the grenade that it should next think in 0.1 seconds time, and when it does think, to call the function GrenadeZap.

STEP 2:

Now scroll up a bit and add this function just above W_FireGrenade:

void() GrenadeZap =
{
	local vector	org;

	self.count = self.count + 1;	// This bit is here to count
	if (self.count > 40)		// how long the grenade
	{				// has been lingering.
		GrenadeExplode();	// After forty 1/10 second
		return;			// counts, the grenade
	}				// just goes boom normally

	sound (self.owner, CHAN_VOICE, "weapons/lhit.wav", 1, ATTN_NORM);
	self.nextthink = time + 0.1;
	self.think = GrenadeZap;		// Repeat the function

	org = self.origin + '0 0 3';
	traceline (org, self.owner.origin + '0 0 10', TRUE, self);

	WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
	WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
	WriteEntity (MSG_BROADCAST, self);
	WriteCoord (MSG_BROADCAST, org_x);
	WriteCoord (MSG_BROADCAST, org_y);
	WriteCoord (MSG_BROADCAST, org_z);
	WriteCoord (MSG_BROADCAST, trace_endpos_x);
	WriteCoord (MSG_BROADCAST, trace_endpos_y);
	WriteCoord (MSG_BROADCAST, trace_endpos_z);
// Now, all this complicated bit of code does is draw
// a beam of lightning from one place to another

	LightningDamage (org, trace_endpos + v_forward*5, self.owner, 15);
// This is standard lightning gun code, and 15 the the amount of damage done.
};
Well, that's it! If you've done all that right, compile, run, and have fun! Try shooting grenades over a monster, and if you feel especially nasty, up the damage!






The Inside3D content and design is copyrighted by the Inside3D team, and may not be re-produced or copied without proper consent. All rights reserved. Any work credited to any author not part of InsideQC is copyrighted by that author. If you have any feedback, suggestions or flames please send it in to the author. Inside3D is hosted by telefragged and the design was originated by project-9.