That's not a hard fix, but for those who haven't found a way yet, here's my solution:
Code: Select all
.float multi_damage;
void() ClearMultiDamage =
{
local entity e;
e = nextent(world);
while (e)
{
e.multi_damage = 0;
e = nextent(e);
}
};
void() ApplyMultiDamage =
{
local entity e;
e = nextent(world);
while (e)
{
if (e.multi_damage > 0)
T_Damage (e, self, self, e.multi_damage);
e = nextent(e);
}
};
/*
================
TraceAttack
================
*/
void(float damage, vector dir) TraceAttack =
{
local vector vel, org;
vel = normalize(dir + v_up*crandom() + v_right*crandom());
vel = vel + 2*trace_plane_normal;
vel = vel * 200;
org = trace_endpos - dir*4;
if (trace_ent.takedamage)
{
SpawnBlood (org, vel*0.2, damage);
trace_ent.multi_damage = trace_ent.multi_damage + damage;
}
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}
};
TraceAttack() will now add the multi damage to individual trace_ents. FireBullets() remains unchanged, so I didn't need to post it here. ClearMultiDamage() simply cycles through all entites in the world and resets their .multi_damage value to zero. ApplyMultiDamage() is called in FireBullets() after the while() loop, which also cycles through all entites, checks if there are entities with .multi_damage > 0, and applies the damage accordingly.
That worked well for me.