Useful Flares

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: Marius
eMail: lordshoel@yahoo.com
Difficulty Scale: Easy


Here I will show you how to create a simple Flare which will burn for a varible length of time. I have decided to use 15 seconds though you may wish to change it making it londer or shorter in duration. There is no limit as to how many flares you can have. Also the flare uses one Rocket. First you'll need a flare model. In this case I have knocked up a quick flare in Qme 3, download the zip file flare.zip and place flare.mdl in the progs folder of this mod.

Step 1.

Ok now the most simple step, open up Weapons.qc and find W_Precache function then at the bottom paste the following precache:

	precache_model ("progs/flare.mdl");

Step 2.

Still Weapons.qc, scroll to the ImpulseCommands function. And above that we will add the following code:

/*
============
Flare Code
Spawns a Flare lasting 15 seconds
============
*/
void() Create_Flare =
{
	local entity flare;

	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;	//Uses one rocket

	flare = spawn ();
	flare.owner = self;
	flare.effects = flare.effects | EF_BRIGHTLIGHT;
	flare.movetype = MOVETYPE_NONE;
	flare.solid = SOLID_NOT;
	flare.touch = SUB_Null;
	flare.classname = "flare";
	flare.think = SUB_Remove;
	flare.nextthink = time + 15;			//Duration of Effect. Change as suits.
	setmodel (flare, "progs/flare.mdl");
	setsize (flare, VEC_ORIGIN, VEC_ORIGIN);		
	setorigin (flare, self.origin);
	flare.origin = flare.origin - '0 0 4';
};

Step 3.

Now in the function ImpulseCommands well create an impulse for the use of our Flare. Above the QuadCheat impulse add:

	if (self.impulse == 16)
	{
		if (self.ammo_rockets < 1) return;
		else Create_Flare();
	}
The above impulse first checks if the player has at least a rocket if the player does it creates the flare.
Step 4.

Save and compile. Now that was pretty simple wasn't it? The flare uses the EF_BRIGHTLIGHT effect lasting for 15 seconds.
There are several things that you can change within this tutorial:
* Cost of the Flare. You can change ammo type or completely remove the cost.
* Duration. Currently 15 seconds, can be more or less as suits you.
* Effect used. EF_BRIGHTLIGHT can be changed to EF_MUZZLEFLASH or EF_DIMLIGHT.
Anyway have fun and happy gaming... Marius






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.