And here's the original version I created back when I didn't know what I was really doing:
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;
};