Weird issues with LightningDamage()
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
Weird issues with LightningDamage()
Hi people, I always asked myself why the hell does the lightning gun checks for damageable entities in a different way not like the axe or the shotguns.
On an attempt to figure out what LightningDamage() does, I put a TE_LIGHTNING2 effect on each traceline() of that function. I have some screenshots.
The result was lightnings coming from the wall, or from yourself but pointing to the sides, or even backwards!
When I saw that phenomenon, I thought 'WTF?!? Was that Id's FAIL attempt on making the lightning gun a shoot-through weapon, or even a hitscan weapon that the lightning ricochets walls?'
For me the LG is meant to be a simple hitscan weapon, no shoot-throughs like q2 railgun, nor "reflecting" lightnings on walls.
I alwas replace that LightningDamage() line to this:
Real simple. No more than 5 lines of code.
See the screenshots:
http://img231.imageshack.us/gal.php?g=wtf4.jpg
If you see the screenshots, you'll notice that any entity between these flying lightning beams *will* get damaged! I also get myself caught damaging 2 monsters at the same time. (w/o this modification).
On an attempt to figure out what LightningDamage() does, I put a TE_LIGHTNING2 effect on each traceline() of that function. I have some screenshots.
The result was lightnings coming from the wall, or from yourself but pointing to the sides, or even backwards!
When I saw that phenomenon, I thought 'WTF?!? Was that Id's FAIL attempt on making the lightning gun a shoot-through weapon, or even a hitscan weapon that the lightning ricochets walls?'
For me the LG is meant to be a simple hitscan weapon, no shoot-throughs like q2 railgun, nor "reflecting" lightnings on walls.
I alwas replace that LightningDamage() line to this:
- Code: Select all
if (trace_ent.takedamage)
{
particle (trace_endpos, '0 0 100', 225, 120);
T_Damage (trace_ent, self, self, 30);
}
Real simple. No more than 5 lines of code.
See the screenshots:
http://img231.imageshack.us/gal.php?g=wtf4.jpg
If you see the screenshots, you'll notice that any entity between these flying lightning beams *will* get damaged! I also get myself caught damaging 2 monsters at the same time. (w/o this modification).
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
due to trace_ent / other mixups in the quakeworld qc code, when you stand on the secret door on dm6 then shoot it, the door goes flying upwards! great fun... and fundamentally fubar.
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
This is both an issue with the lightning gun code and with the engine-side implementation of TE_LIGHTNING2.
What the lightning gun is actually doing, is shooting 2 beams parallel to the original beam. There is a page on SDA that documents where it goes wrong, but the fail starts when f is normalized but the value isn't put back into f.
TE_LIGHTNING2 ignores the start co-ordinates of the beam, and instead will use the origin of the entity specified as the start point of the beam. Which is why the beams look as if they fly at strange angles. Also, some engines will only display 1 beam per entity. So the correct way to make them all display is to have 2 additional entities for the 2 beams.
But yes, the easiest thing of all is to just remove the extra beams...
What the lightning gun is actually doing, is shooting 2 beams parallel to the original beam. There is a page on SDA that documents where it goes wrong, but the fail starts when f is normalized but the value isn't put back into f.
TE_LIGHTNING2 ignores the start co-ordinates of the beam, and instead will use the origin of the entity specified as the start point of the beam. Which is why the beams look as if they fly at strange angles. Also, some engines will only display 1 beam per entity. So the correct way to make them all display is to have 2 additional entities for the 2 beams.
But yes, the easiest thing of all is to just remove the extra beams...
Roaming status: Testing and documentation
-

Lardarse - Posts: 266
- Joined: Sat Nov 05, 2005 1:58 pm
- Location: Bristol, UK
http://speeddemosarchive.com/quake/misc/lbug/
HTH. HAND.
- Code: Select all
f = p2 - p1;
// Supa LG fix begin: kids, this is why you need to stay in school and pay attention in Maths class
f = normalize (f);
tmp = f_y;
f_y = f_x;
f_x = tmp * -1;
f_z = 0;
// Supa LG fix end
f = f * 16;
HTH. HAND.
-

Supa - Posts: 164
- Joined: Tue Oct 26, 2004 8:10 am
It's probably laden with vestigial code that was meant to go past walls/multiple targets/etc, but was never finished, or was cut back insufficiently at the last minute.
Quake is rich with such "features".
Quake is rich with such "features".
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
- Wazat
- Posts: 771
- Joined: Fri Oct 15, 2004 9:50 pm
- Location: Middle 'o the desert, USA
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest