Railgun problem
Moderator: InsideQC Admins
6 posts
• Page 1 of 1
Railgun problem
Hi.
I've made a Q2-style railgun for Quake.
It spawns an invisible MOVETYPE_NOCLIP entity that thinks every frame, and only MOVETYPE_NOCLIP entities can exceed sv_maxvelocity.
But, to be an instant weapon, it should use traceline(), but the only problem is if I fire the railgun in long distances, no particle effect spawns or I receive this error: "overflow wihtout allowoverflow set".
And I don't care about instant or non-intant weapons. I've made it non-instant, with a velocity of 5000, and an avelocity of '0 0 2700', to make the blue corkscrew around the white particles.
And, as MOVETYPE_NOCLIP entities can't trigger a touch, it searchs every frame for enemies in a sphere of 80 units, and makes the particle effects.
And now here's the problem.
It does between 50 and 140 damage, and the problem is, when a player or monster takes the damage, and the slug is near it in the next frame, it will do the damage twice.
See below:
Next frame:
So, what's the way to fix that?
Thanks...
I've made a Q2-style railgun for Quake.
It spawns an invisible MOVETYPE_NOCLIP entity that thinks every frame, and only MOVETYPE_NOCLIP entities can exceed sv_maxvelocity.
But, to be an instant weapon, it should use traceline(), but the only problem is if I fire the railgun in long distances, no particle effect spawns or I receive this error: "overflow wihtout allowoverflow set".
And I don't care about instant or non-intant weapons. I've made it non-instant, with a velocity of 5000, and an avelocity of '0 0 2700', to make the blue corkscrew around the white particles.
And, as MOVETYPE_NOCLIP entities can't trigger a touch, it searchs every frame for enemies in a sphere of 80 units, and makes the particle effects.
And now here's the problem.
It does between 50 and 140 damage, and the problem is, when a player or monster takes the damage, and the slug is near it in the next frame, it will do the damage twice.
See below:
- Code: Select all
() <-- player
| --- <-- slug at about 80 units of distance. it takes 60 damage.
|
/\
Next frame:
- Code: Select all
()
-|- <-- the slug crossed the player, and it took 120 damage, and was killed.
|
/\
So, what's the way to fix that?
Thanks...
-

Orion - Posts: 476
- Joined: Fri Jan 12, 2007 6:32 pm
- Location: Brazil
I say just ditch the non-instant stuff. Your findradius stuff is a little weird.
Do a traceline, on impact, do damage then move the next trace's startpoint to a unit or so ahead of the impact point, use the struck entity as the next ignore param to traceline, and trace again.
Dunno what that overflow stuff is though. I know I've gotten it before, but it's been a while and I forget what for. I think it might be a protocol thing because you are trying to spam a zillion particle effects. Which you shouldn't be...
Do a traceline, on impact, do damage then move the next trace's startpoint to a unit or so ahead of the impact point, use the struck entity as the next ignore param to traceline, and trace again.
Dunno what that overflow stuff is though. I know I've gotten it before, but it's been a while and I forget what for. I think it might be a protocol thing because you are trying to spam a zillion particle effects. Which you shouldn't be...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
You should probably make a .float and use it as a timer on the monster. Your railgun is probably hitting it twice because it's 'thinking' faster than how fast the rail travels through the victim, and you're probably making it think every Quake frame since you're using a findradius();.
So when the rail connects add
self.railrehit_finished = time + #r; to the rail entity after it's t_damage function and make sure it can only hit the victim when it's < the timer.
Hope I helped!
So when the rail connects add
self.railrehit_finished = time + #r; to the rail entity after it's t_damage function and make sure it can only hit the victim when it's < the timer.
Hope I helped!
-

RenegadeC - Posts: 391
- Joined: Fri Oct 15, 2004 10:19 pm
- Location: The freezing hell; Canada
Well I did it just to be safe, in case two entities are pressed against each other I didn't want it to hit the previous one again because of some floatally imprecise stuff... Maybe it never happens but I like to be safe
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
