Inside3D!
     

Lightning gun -- help
Goto page 1, 2  Next
 
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: Sun Apr 15, 2007 9:23 pm    Post subject: Lightning gun -- help Reply with quote

Hi..

I'm trying to make a QuakeC-made LG without using builtin functions.
I've removed traceline, WriteByte, WriteEntity, and WriteCoord lines from W_FireLightning().

A little time ago, I've seen in slow-motion (host_framerate 0.001) the original one fires dozens of bolt2.mdl forward. And I've seen that they've avelocity_z set to some very high value. And I've noticed that the first bolt spins slower that the second, that spins slower than the third, and so on.

So, I need some help on how to make a QC made one, putting a bolt in front of another, limiting the distance of 600.
And removed after 0.2 seconds, and every frame pointing at the player's view angle like ezquake's fakeshaft.

Any ideas?
Thanks!
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Mon Apr 16, 2007 12:23 am    Post subject: Reply with quote

Just for curiosity: why are you trying to replicate the lightning beam in QuakeC ? Rolling Eyes

EDIT:
Orion wrote:
A little time ago, I've seen in slow-motion (host_framerate 0.001) the original one fires dozens of bolt2.mdl forward. And I've seen that they've avelocity_z set to some very high value. And I've noticed that the first bolt spins slower that the second, that spins slower than the third, and so on.


AFAIK this is just coincidence.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Mon Apr 16, 2007 1:26 am    Post subject: Reply with quote

To use with different models without replacing.
And to make similar things.
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
frag.machine



Joined: 25 Nov 2006
Posts: 728

PostPosted: Mon Apr 16, 2007 1:33 am    Post subject: Reply with quote

Ahh, I see. But you still need traceline() to determine if there's something in the way of your beam. Take a look at the original grappling hook code. It simulates a "chain" with spikes placed along the way between the axe and the spike. I suspect it's the nearest thing you'll get without custom builtins, though.
_________________
frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/
Back to top
View user's profile Send private message Visit poster's website
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Mon Apr 16, 2007 2:54 am    Post subject: Reply with quote

I did it.
I've made a function that will spawn a bolt 32 units forward of each other, to make a line. The only problem is that the lightning goes through walls, I have a demo showing that.
And, 19 bolts reaches 608 units, because each bolt have 32 units of length. And the aiming is better, it's not exactly equal to fakeshaft, but the lightning looks more precise, each bolt have a touch function, and they're solid.
_________________
There's no signature here. Stop looking for one.
Back to top
View user's profile Send private message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon Apr 16, 2007 8:53 am    Post subject: Reply with quote

That's a weird way to do it. Just trace 600 units forward, and place bolts at 32 units from eachother until they reach trace_endpos, then stop, and just set their .think to SUB_Remove and .nextthink to time + 0.2, and damage whatever was hit by the traceline. Why'd you make them solid? I don't see any sense in not using traceline, since then you can't hit world geometry. You can hit entities without traceline, but not the world.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Preach



Joined: 25 Nov 2004
Posts: 122

PostPosted: Mon Apr 16, 2007 10:33 am    Post subject: Reply with quote

How are you spawning entities without using builtins? I thought that there was only one way...
Back to top
View user's profile Send private message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon Apr 16, 2007 10:45 am    Post subject: Reply with quote

Right on
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
FrikaC
Site Admin


Joined: 08 Oct 2004
Posts: 947

PostPosted: Mon Apr 16, 2007 1:22 pm    Post subject: Reply with quote

Three cheers for packet overflow!
Back to top
View user's profile Send private message Send e-mail
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon Apr 16, 2007 1:28 pm    Post subject: Reply with quote

Bah! Packet overflows are for sissies!
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Orion



Joined: 12 Jan 2007
Posts: 413
Location: Brazil

PostPosted: Mon Apr 16, 2007 4:06 pm    Post subject: Reply with quote

Take a look:

Code:

void() BeamTouch =
{
   if (other == self.owner)
      return;
   if (other.takedamage)
   {
      if (self.t_width < time)
      {
         particle (other.origin, '0 0 100', 225, self.dmg*4);
         if (self.owner.classname == "player")
         {
            if (other.classname == "player")
               other.velocity_z = other.velocity_z + 400;
         }
         T_Damage (other, self, self.owner, self.dmg);
         self.t_width = time + 0.1; // don't do damage every frame
      }
   }
};

void(vector org, string bolt, float damage, float numbolts) ParseBeam =
{
   local entity beam;
   local float fwd;
   
   fwd = 0;
   while (numbolts > 0)
   {
      fwd = fwd + 32;
      
      beam = spawn ();
      beam.owner = self;
      beam.movetype = MOVETYPE_FLY;
      beam.solid = SOLID_TRIGGER;
      beam.dmg = damage;
   
      makevectors (self.v_angle);
      beam.avelocity_z = 99999999;
      beam.angles_x = self.v_angle_x * -1;
      beam.angles_y = self.v_angle_y;
      beam.angles_z = self.v_angle_z;
   
      beam.touch = BeamTouch;
   
      beam.nextthink = time + 0.1;
      beam.think = SUB_Remove;
   
      setmodel (beam, bolt);
      setsize (beam, '0 0 0', '0 0 0');
      setorigin (beam, org + v_forward*fwd);
      
      numbolts = numbolts - 1;
   }
};


The bolts are SOLID_TRIGGER, which don't block the way of any entity. But I really should use traceline() to avoid going through walls.
_________________
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: Mon Apr 16, 2007 8:34 pm    Post subject: Reply with quote

Yes, you should. I really don't know WHY you are doing this. Surprised
_________________
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: Mon Apr 16, 2007 8:38 pm    Post subject: Reply with quote

To create another type of instant weapons..
_________________
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: Mon Apr 16, 2007 8:45 pm    Post subject: Reply with quote

I mean, why are you doing it without traceline and all that... :O
_________________
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: Mon Apr 16, 2007 8:46 pm    Post subject: Reply with quote

Just for testing...
But to the bolts reach the trace_endpos, how can I do that?
_________________
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
Goto page 1, 2  Next
Page 1 of 2

 
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