I promised three QC issues with my mod ... so here's the last
Issue #3 - QuadDrop Feature GlitchedThe Reinc mod has a feature for power up drops (like runequake). However, the implementation doesn't work. When you pick up a dropped powerup (quad for example) your damage doesn't go up to 4x levels and you get stuck with the quad effect. Ugh. Below I think is the relevant code from gen_misc.qc:
Code:
void(entity e) DropPowerup =
{
local entity ring, quad;
if((gamestatus & G_BERSERKMODE) || (e.state & S_BERSERK)) //That would be some dropped quads too much =)
return;
if(e.quadtime > time)
{
quad = spawn();
quad.origin = e.origin - '0 0 24';
quad.netname = "Quad Damage";
quad.classname = "item_artifact_super_damage";
quad.health = (e.quadtime - time) + 1;
quad.velocity_z = 300;
quad.velocity_x = -100 + (random() * 200);
quad.velocity_y = -100 + (random() * 200);
quad.flags = FL_ITEM;
quad.solid = SOLID_TRIGGER;
quad.movetype = MOVETYPE_TOSS;
quad.noise = "items/damage.wav";
quad.items = IT_QUAD;
setsize (quad, '-16 -16 -24', '16 16 32');
setmodel (quad, "progs/quaddama.mdl");
quad.touch = powerup_touch;
quad.state = S_DROPPED;
quad.classname = "tossedquad";
quad.nextthink = time + quad.health * 2; // remove after a certain time
quad.think = SUB_Remove;
}
if(e.ringtime > time)
{
ring = spawn();
ring.origin = e.origin - '0 0 24';
ring.netname = "Ring of Shadows";
ring.classname = "item_artifact_invisibility";
ring.health = (e.ringtime - time) + 1;
ring.velocity_z = 300;
ring.velocity_x = -100 + (random() * 200);
ring.velocity_y = -100 + (random() * 200);
ring.flags = FL_ITEM;
ring.solid = SOLID_TRIGGER;
ring.movetype = MOVETYPE_TOSS;
ring.noise = "items/inv1.wav";
ring.items = IT_INVISIBILITY;
setsize (ring, '-16 -16 -24', '16 16 32');
setmodel (ring, "progs/invisibl.mdl");
ring.touch = powerup_touch;
ring.state = S_DROPPED;
ring.classname = "tossedring";
ring.nextthink = time + ring.health * 2; // remove after a certain time
ring.think = SUB_Remove;
}
};
It might also dovetail with this code in items.qc:
Code:
void() item_artifact_super_damage =
{
// < GeN
saved1 = cvar("saved1");
if(saved1 & SK_NOQUAD)
{
remove(self);
return;
}
self.health = 30;
// GeN >
self.touch = powerup_touch;
precache_model ("progs/quaddama.mdl");
precache_sound ("items/damage.wav");
precache_sound ("items/damage2.wav");
precache_sound ("items/damage3.wav");
self.noise = "items/damage.wav";
setmodel (self, "progs/quaddama.mdl");
self.netname = "Quad Damage";
self.items = IT_QUAD;
setsize (self, '-16 -16 -24', '16 16 32');
StartItem ();
};
Power_Up Touch Section
Code:
/*
===============================================================================
POWERUPS
===============================================================================
*/
void() powerup_touch;
void() powerup_touch =
{
local entity stemp;
local float best;
if (other.classname != "player")
return;
if (other.health <= 0)
return;
// < GeN
if(!temp1 & T_NOMESSAGES)
{
// GeN >
sprint (other, "You got the ");
// < GeN
if((self.netname == "Quad Damage") && (deathmatch & D_OCTADAMAGE))
sprint (other, "Octa Damage");
else
// GeN >
sprint (other, self.netname);
sprint (other,"\n");
// < GeN
}
if (!self.state & S_DROPPED) //was not dropped by a player
// GeN >
{
self.mdl = self.model;
if ((self.classname == "item_artifact_invulnerability") ||
(self.classname == "item_artifact_invisibility"))
self.nextthink = time + 60*5;
else
self.nextthink = time + 60;
self.think = SUB_regen;
}
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
stuffcmd (other, "bf\n");
self.solid = SOLID_NOT;
other.items = other.items | self.items;
self.model = string_null;
// do the apropriate action
if (self.classname == "item_artifact_envirosuit")
{
other.rad_time = 1;
other.radsuit_finished = time + 30;
}
if (self.classname == "item_artifact_invulnerability")
{
other.invincible_time = 1;
// < GeN
other.invincible_finished = time + self.health;
// GeN >
}
if (self.classname == "item_artifact_invisibility")
{
other.invisible_time = 1;
// < GeN
other.invisible_finished = time + self.health;
// GeN >
}
if (self.classname == "item_artifact_super_damage")
{
other.super_time = 1;
// < GeN
other.super_damage_finished = time + self.health;
// GeN >
}
activator = other;
SUB_UseTargets(); // fire all targets / killtargets
// < GeN
if(self.state & S_DROPPED)
remove(self);
// GeN >
};
/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
Player is invulnerable for 30 seconds
*/
void() item_artifact_invulnerability =
{
// < GeN
saved1 = cvar("saved1");
if(saved1 & SK_NOPENT)
{
remove(self);
return;
}
self.health = 30;
// GeN >
self.touch = powerup_touch;
precache_model ("progs/invulner.mdl");
precache_sound ("items/protect.wav");
// < GeN
// precache_sound ("items/protect2.wav");
// precache_sound ("items/protect3.wav");
// GeN >
self.noise = "items/protect.wav";
setmodel (self, "progs/invulner.mdl");
self.netname = "Pentagram of Protection";
self.items = IT_INVULNERABILITY;
setsize (self, '-16 -16 -24', '16 16 32');
StartItem ();
};
/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
Player takes no damage from water or slime for 30 seconds
*/
void() item_artifact_envirosuit =
{
self.touch = powerup_touch;
precache_model ("progs/suit.mdl");
precache_sound ("items/suit.wav");
precache_sound ("items/suit2.wav");
self.noise = "items/suit.wav";
setmodel (self, "progs/suit.mdl");
self.netname = "Biosuit";
self.items = IT_SUIT;
setsize (self, '-16 -16 -24', '16 16 32');
StartItem ();
};
/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
Player is invisible for 30 seconds
*/
void() item_artifact_invisibility =
{
// < GeN
saved1 = cvar("saved1");
if(saved1 & SK_NORING)
{
remove(self);
return;
}
self.health = 30;
// GeN >
self.touch = powerup_touch;
precache_model ("progs/invisibl.mdl"); //drop powerups
precache_sound ("items/inv1.wav");
precache_sound ("items/inv2.wav");
precache_sound ("items/inv3.wav");
self.noise = "items/inv1.wav";
setmodel (self, "progs/invisibl.mdl");
self.netname = "Ring of Shadows";
self.items = IT_INVISIBILITY;
setsize (self, '-16 -16 -24', '16 16 32');
StartItem ();
};
/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
The next attack from the player will do 4x damage
*/
void() item_artifact_super_damage =
{
// < GeN
saved1 = cvar("saved1");
if(saved1 & SK_NOQUAD)
{
remove(self);
return;
}
self.health = 30;
// GeN >
self.touch = powerup_touch;
precache_model ("progs/quaddama.mdl");
precache_sound ("items/damage.wav");
precache_sound ("items/damage2.wav");
precache_sound ("items/damage3.wav");
self.noise = "items/damage.wav";
setmodel (self, "progs/quaddama.mdl");
self.netname = "Quad Damage";
self.items = IT_QUAD;
setsize (self, '-16 -16 -24', '16 16 32');
StartItem ();
};
/*