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:
Any help will be greatly appreciated!
Spawning a trigger between 2 entities...
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;
};
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 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).
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)
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...
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...
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
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.
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.