Here is the entire Beatdown Alley code, which must be the code you're talking about since I don't use the flashlight in RQP.
This rune was created using the Nighttime Tutorial, the Flare tutorial and the Flashlight tutorial.
Code:
void ()
Rune_LightsActivate =
{
local entity head;
local entity flare;
flare = spawn ();
flare.owner = self;
flare.effects = flare.effects | EF_BRIGHTLIGHT;
flare.movetype = MOVETYPE_TOSS;
//MOVETYPE_NONE;
flare.solid = SOLID_NOT;
flare.touch = SUB_Null;
flare.classname = "flareX";
flare.think = SUB_Remove;
flare.nextthink = time + 2; //Duration of Effect. Change as suits.
setmodel (flare, "progs/flame.mdl");
setsize (flare, VEC_ORIGIN, VEC_ORIGIN);
setorigin (flare, self.origin);
flare.origin = flare.origin + '0 0 10';
flare.velocity = aim (self, 10000);
flare.velocity = flare.velocity * 800;
};
void ()
Rune_Lights =
{
if (!self.runevar)
{
local entity head;
head = findradius(self.origin, 10000);
while (head)
{
if (head.classname == "player")
{
stuffcmd (head, "r_dynamic 1\n");
if (head.runetype == RN_LIGHTS && head != self)
{
self.impulse = 98;
return;
}
else if (!head.runetype)
head.runetype = RN_FLASH;
}
head = head.chain;
}
lightstyle (0, "b");
lightstyle (1, "e");
lightstyle (2, "e");
lightstyle (3, "e");
lightstyle (4, "e");
lightstyle (5, "e");
lightstyle (6, "e");
lightstyle (7, "e");
lightstyle (8, "e");
lightstyle (9, "e");
lightstyle (10, "e");
lightstyle (11, "e");
lightstyle (63, "e");
local entity lighter;
lighter = spawn ();
lighter.owner = self;
lighter.movetype = MOVETYPE_FLY;
lighter.solid = SOLID_NOT;
setorigin (lighter, self.origin);
setsize (lighter, '0 0 0', '10 10 10');
lighter.classname = "lighter";
setmodel (lighter, string_null);
lighter.think = Lights_Think;
lighter.nextthink = time;
self.runevar = 1;
bprint (self.netname);
bprint (" just picked up the Rune of Darkness\n");
}
};
void ()
Lights_Think =
{
if (self.owner.runetype == RN_LIGHTS)
{
local entity head;
head = findradius(self.origin, 10000);
while (head)
{
if (head.classname == "player")
stuffcmd (head, "r_dynamic 1\n");
if (head.classname == "weapon_lightning" || head.classname == "weapon_rocketlauncher" || head.classname == "weapon_grenadelauncher" || head.classname == "weapon_supernailgun" || head.classname == "weapon_nailgun" || head.classname == "weapon_supershotgun")
head.effects = EF_DIMLIGHT;
head = head.chain;
}
}
//If you drop the rune or die
else if (self.owner.runetype != RN_LIGHTS)
{
Lights_Clean ();
lightstyle (0, "m");
lightstyle (1, "m");
lightstyle (2, "m");
lightstyle (3, "m");
lightstyle (4, "m");
lightstyle (5, "m");
lightstyle (6, "m");
lightstyle (7, "m");
lightstyle (8, "m");
lightstyle (9, "m");
lightstyle (10, "m");
lightstyle (11, "m");
lightstyle (63, "m");
remove (self); //Stop checking for lighting
}
self.think = Lights_Think;
self.nextthink = time + 1;
};
//Remove the glowing effect from the weapons:
void ()
Lights_Clean =
{
local entity head;
head = findradius(self.owner.origin, 10000);
while (head)
{
if (head.classname == "weapon_lightning" || head.classname == "weapon_rocketlauncher" || head.classname == "weapon_grenadelauncher" || head.classname == "weapon_supernailgun" || head.classname == "weapon_nailgun" || head.classname == "weapon_supershotgun")
{
head.effects = 0;
}
head = head.chain;
}
return;
};
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!FLASH LIGHT!!!!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
void ()
W_SetCurrentAmmo;
void ()
flash_update =
{
if (self.owner.runetype != RN_FLASH)
remove (self);
if (self.owner.deadflag != DEAD_NO)
self.effects = 0;
// The Player is alive so turn On the Flashlight
else
self.effects = EF_DIMLIGHT;
// Find out which direction player facing
makevectors (self.owner.v_angle);
// Check if there is any things infront of the flashlight
traceline (self.owner.origin , (self.owner.origin+(v_forward * 500)) , FALSE , self);
// Set the Flashlight's position
setorigin (self, trace_endpos + (v_forward * -5));
// Repeat it in 0.02 seconds...
self.nextthink = time + 0.02;
};
void ()
flash_on =
{
// Make a new entity to hold the Flashlight
local entity myflash;
// spawn flash
myflash = spawn ();
myflash.movetype = MOVETYPE_NONE;
myflash.solid = SOLID_NOT;
// this uses the s_bubble.spr, if you want it to be completly
// invisible you need to create a one pixel trancparent spirit
// and use it here...
setmodel (myflash, "progs/s_bubble.spr");
setsize (myflash, '0 0 0', '0 0 0');
// Wire Player And Flashlight Together
myflash.owner = self;
self.flash = myflash;
// give the flash a Name And Make It Glow
myflash.classname = "flash";
myflash.effects = EF_DIMLIGHT;
// Set Start Position
makevectors (self.v_angle);
traceline (self.origin , (self.origin+(v_forward * 500)) , FALSE , self);
setorigin (myflash, trace_endpos);
// Start Flashlight Update
myflash.think = flash_update;
myflash.nextthink = time + 0.02;
};
void () flash_toggle =
{
// If Off, Turn On
if (self.flash_flag == FALSE)
{
self.runevar = 1;
self.flash_flag = TRUE;
flash_on();
}
// If On, Turn Off
else
{
self.runevar = 0;
self.flash_flag = FALSE;
W_SetCurrentAmmo ();
self.flash.think = SUB_Remove;
self.flash.nextthink = time + 0.1;
}
};