Forum

Spawning a trigger between 2 entities...

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Spawning a trigger between 2 entities...

Postby Orion » Tue Oct 05, 2010 5:28 pm

Hey, I'm coding field generators here, when you build 2 of them side by side and an invisible trigger field is spawned between them, with the proper hitbox width. This trigger will check for players, projectiles etc to damage any player that goes through it. Projectiles will simply 'hit' it.

I'm having trouble on setting the trigger's size, which will go from one field generator to another accordingly.

Here's a simple diagram on how it should be:


Image

Any help will be greatly appreciated!
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby Spike » Tue Oct 05, 2010 6:12 pm

you can't rotate bboxes.

Code: Select all
void(entity point1, entity point2) positionselfaroundbounds =
{
  local vector abs_max, abs_min, sz;
  abs_max = maxv(point1.absmax, point2.absmax);
  abs_min = maxv(point1.absmin, point2.absmin);
  sz = abs_max - abs_min;
  setsize(self, sz * -0.5, sz * 0.5);
  setorigin(self, (abs_max + abs_min) * 0.5;
};
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby ratbert » Wed Oct 06, 2010 3:35 am

Why not look at custom tf quake source. They have a field generator already in their that works.
ratbert
 
Posts: 37
Joined: Thu Nov 19, 2009 3:47 pm

Postby frag.machine » Wed Oct 06, 2010 1:08 pm

If I was doing that:
1) first, obtain the distance between the two poles (d);
2) do a findradius (pole1.origin, d);
3) for every entity (e) found:
4) do a traceline between pole1 and pole2;
5) if e == trace_ent, block/explode/damage/remove/whatever.

Of course, your force fields won't affect hitscan weapons (shotguns, thunderbolt, etc).
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 » Wed Oct 06, 2010 6:14 pm

Yes, the easiest way is doing traceline, but the problem is, It will only work for players or monsters passing through them, because traceline will trace a really narrow line so a rocket will freely pass through the generators...

I can do tracebox, but I want to make it work server-side on any engine, because not all engines have tracebox.

I'm thinking of making findradius() and narrow it down to a narrow cone, which is easy too.

EDIT: But then the field will be somewhat convex...
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Postby frag.machine » Wed Oct 06, 2010 7:20 pm

You can set your think frequency a bit higher (instead every 0.1seg, let's say 0.05), but yes, chances are you may miss a really fast projectile.
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 » Thu Oct 07, 2010 12:10 am

Well, I had to take a look at CustomTF source code, that was the only way.
Also, I made the trigger completely solid, so even hitscan weapons will be blocked. :)

The field disengages and becomes non-solid if a teammate passes through it.

But it still have a problem. It only works in one direction. O.o
For example, I build 2 north and south, it works. I build 2 east and west, it doesn't work.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest