Inside3D!
     

Railgun problem

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Tue Jul 24, 2007 4:19 am    Post subject: Railgun problem Reply with quote

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:

Code:

() <-- player
|    --- <-- slug at about 80 units of distance. it takes 60 damage.
|
/\ 


Next frame:
Code:

  ()
  -|- <-- the slug crossed the player, and it took 120 damage, and was killed.
  |
  /\



So, what's the way to fix that?
Thanks...
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Tue Jul 24, 2007 5:48 am    Post subject: Reply with quote

I say just ditch the non-instant stuff. Your findradius stuff is a little weird. Smile

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.
Back to top
View user's profile Send private message
RenegadeC



Joined: 15 Oct 2004
Posts: 370
Location: The freezing hell; Canada

PostPosted: Tue Jul 24, 2007 9:35 am    Post subject: Reply with quote

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! Smile
Back to top
View user's profile Send private message AIM Address MSN Messenger
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Tue Jul 24, 2007 11:19 am    Post subject: Reply with quote

Sajt: there's no need to even move it a unit if you use the next entity in line as the ignore ent.

Orion: do what Sajt said, except skip moving it, no need.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Wed Jul 25, 2007 3:27 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Wed Jul 25, 2007 3:45 am    Post subject: Reply with quote

TY guys! Smile
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group