Forum

turrets, not the funny mental disorder :p

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

turrets, not the funny mental disorder :p

Postby RooT » Fri Sep 30, 2005 1:15 am

hah sorry bout that couldnt help it. well im making a turret upgrade for my ups mod, wich is coming out really sweet right now :P but i have a problem with the turret. it wont become a solid, player blocking entity. my knowledge of entity types is pretty decent or so i thought but i cant get it to stop the player withour making it a bsp entity, and that lags really bad when i use it. well any help would be great, thanks!
Code: Select all
void() build =
{
   local entity t;
   local vector dir, org, source;

   makevectors (self.v_angle);
   source = self.origin + '0 0 16';
   traceline (source, source + v_forward*64, FALSE, self);
   if (trace_fraction != 1.0)
   {
      sprint(self,"{}You can't build there\n");
      return;
   }
   org = trace_endpos + v_forward*4;


   t = spawn();
   setmodel(t,"progs/agc.mdl");
   setorigin(t, org + '0 0 20');
   setsize (t, VEC_ORIGIN, VEC_ORIGIN);      
   t.owner = self;
   t.movetype = MOVETYPE_TOSS;
   t.solid = SOLID_SLIDEBOX;
   t.touch = stp;
   t.classname = "turret";
   t.think = build1;
   t.nextthink = time + 0.2;
   makevectors (self.v_angle);
   t.angles_z = self.angles_z;
   t.angles_y = self.angles_y;

   self.buildtime = time + 1.5;
   self.impulse = 0;
   sprint(self,"{}Building Turret!\n");
};
My mod site!
Mod Status:
Turret Defense: 30%
UPS: 45%
User avatar
RooT
 
Posts: 40
Joined: Wed Sep 07, 2005 1:28 am

Postby Spike » Fri Sep 30, 2005 3:40 am

Put the setorigin or setsize after the t.solid = SOLID_SLIDEBOX;

Yes, it does make a difference.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby FrikaC » Fri Sep 30, 2005 8:09 pm

There's nothing 'funny' about someone suffering from Tourettes Syndrome.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

question

Postby RooT » Mon Oct 03, 2005 8:59 pm

ok i got the turret to be solid, solid_bsp actualy, not sure if thats good or not? but it works the best. only problem is it becomes un-solid when i attach an owner tag to it, my guess is that bsp solids are reserved for world brushes and such and that noone can own them so through w/e glitch this happens. anyone got an idea?
My mod site!
Mod Status:
Turret Defense: 30%
UPS: 45%
User avatar
RooT
 
Posts: 40
Joined: Wed Sep 07, 2005 1:28 am

Postby Urre » Fri Oct 07, 2005 5:01 am

You must be using DarkPlaces or possibly FTE, since to my knowledge those are the only engines that support non-bmodel entities to be SOLID_BSP. This enables polygon collisions against their model geometry (obviously doesn't work on sprites).

The issue you're having however, is that Quake makes entities non-solid for the targeted .owner. For example, all projectiles in Quake are owned by the shooter, so that they won't collide with him. I'm sure you've noticed when you bounce a grenade off a wall towards yourself, it goes straight through you. The entity will however stay solid for any other entities than their owner.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Plumb » Thu Apr 20, 2006 11:06 am

I thought this behavior was in the QuakeC code itself. At the top of GrenadeTouch is something like:

if (other == self.owner)
return;

This stops quake from reacting to touch events between the missile and it's owner. Commenting the line out will turn the gren launcher into a gib button :P

So when creating a new entity there shouldn't be a difference in how something collides with it's owner and anyone else unless you purposefully write something to make it so.

It doesn't explain why you're having trouble though, sorry.
Plumb
 
Posts: 11
Joined: Thu Apr 20, 2006 10:30 am

Postby Sajt » Thu Apr 20, 2006 1:09 pm

You might want to use a bounding box with some kind of size, too.
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 Urre » Sun Apr 23, 2006 12:34 am

Plumb wrote:I thought this behavior was in the QuakeC code itself. At the top of GrenadeTouch is something like:

if (other == self.owner)
return;

This stops quake from reacting to touch events between the missile and it's owner. Commenting the line out will turn the gren launcher into a gib button :P


That quite simply is not true, the progs106 source contains a bunch of redundant code. Try and see for thyself. The Quake wiki says the same. An entity with an .owner cannot collide with the entity .owner points to, nor the other way around.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby Lardarse » Sun Apr 23, 2006 12:51 pm

That means you need to create a new field for the turret to point back to teh owner.
Code: Select all
.entity turret_owner;


Then when you create the turret:
Code: Select all
t.turret_owner = self;
User avatar
Lardarse
 
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest