Forum

Lightning gun -- help

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Lightning gun -- help

Postby Orion » Sun Apr 15, 2007 9:23 pm

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!
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby frag.machine » Mon Apr 16, 2007 12:23 am

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

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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Orion » Mon Apr 16, 2007 1:26 am

To use with different models without replacing.
And to make similar things.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby frag.machine » Mon Apr 16, 2007 1:33 am

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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Orion » Mon Apr 16, 2007 2:54 am

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.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Urre » Mon Apr 16, 2007 8:53 am

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.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Preach » Mon Apr 16, 2007 10:33 am

How are you spawning entities without using builtins? I thought that there was only one way...
Preach
 
Posts: 122
Joined: Thu Nov 25, 2004 7:20 pm

Postby Urre » Mon Apr 16, 2007 10:45 am

Right on
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby FrikaC » Mon Apr 16, 2007 1:22 pm

Three cheers for packet overflow!
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Urre » Mon Apr 16, 2007 1:28 pm

Bah! Packet overflows are for sissies!
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Orion » Mon Apr 16, 2007 4:06 pm

Take a look:

Code: Select all
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.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Sajt » Mon Apr 16, 2007 8:34 pm

Yes, you should. I really don't know WHY you are doing this. :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.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Orion » Mon Apr 16, 2007 8:38 pm

To create another type of instant weapons..
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Sajt » Mon Apr 16, 2007 8:45 pm

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.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Orion » Mon Apr 16, 2007 8:46 pm

Just for testing...
But to the bolts reach the trace_endpos, how can I do that?
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest