Bots stuck in floor

Discuss programming in the QuakeC language.
Post Reply
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Bots stuck in floor

Post by Cobalt »

HI Everyone. Have not messed with Quake C since 2002! Glad to see this site is still here for support. I am back working on my CTFBOT+ mod, and cant seem to stop the bots from getting stuck in the floor with my new mod for copytobodyque(). I have the body images sometimes becoming solids that takedamage, and I decided one day to make the bots attack them if touched, because they would block them. They do attack the corpses, but alot of times it seems they loose their self.origin or something and they get stuck in the floor where the corpse use to be. Here is the touch finction for the ccorpses / images. Any sugguestions appreciated !


void () image_touch =
{
local float old_solid;
old_solid = self.solid;

if (pointcontents (self.origin + '0 0 -22') == CONTENT_LAVA)
self.solid = SOLID_BBOX;
makevectors (self.angles);

if ((self.classname == "image2"))
{
self.velocity_z = 10;
}

if (other.classname == "bot")
{
self.solid = SOLID_TRIGGER;
self.velocity_z = self.velocity_z + 1;
self.solid = old_solid;
}

if ((self.watertype != CONTENT_WATER))
{
self.flags = (self.flags + FL_ONGROUND);
if ((self.velocity != VEC_ORIGIN))
{
self.movetype = MOVETYPE_BOUNCE;
}
else
{
self.movetype = MOVETYPE_STEP;
}
self.think = image_remove;
self.nextthink = ((time + (random () * 45)) + (random () * 30));
return;
}
if (other)
{
makevectors (other.angles);
if ((other.takedamage && (random () < 0.2)))
{
self.velocity = (other.velocity * 0.45);
self.avelocity = (other.velocity * 0.2);
sound (self, CHAN_ITEM, "demon/dland2.wav", 1, ATTN_IDLE);
return;
}
else
{
ambientsound (self.origin, "ambience/water1.wav", 0.5, ATTN_IDLE);
}


if ((pointcontents (self.origin) == CONTENT_SOLID))
{
self.velocity = (self.origin + other.origin);
self.avelocity = (self.avelocity * 0.55);
self.flags = (self.flags | FL_ONGROUND);
sound (self, CHAN_ITEM, "wizard/hit.wav", 1, ATTN_STATIC);
return;
}
return;
}
};
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Post by Cobalt »

Im also thinking, could the setsize for the dead body be the problem? The initial setsize command is:

setsize (ent, '-16 -16 0', '0 0 0');


which I think is stock from the original code. This command always confused me. Theres more code in the bodyque code I added that may be changing it to :

setsize (image, '-16 -16 -24', '16 3 -0.5');
image.flags = 0;

I dont remember how I came up with this value. Would I need to ftos the vector value to do a dprint of the size of a body image ? Would I be looking at self.size specific?
MauveBib
Posts: 634
Joined: Thu Nov 04, 2004 1:22 am

Post by MauveBib »

in q1bsp the only hull sized recognised for colisions against the world are point, player and shambler sized. It seems you're accidentally setting the player hull to something smaller than player sized which is being rounded down to point sized.
Apathy Now!
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Post by Cobalt »

Thanks for the reply....you may be onto something. I changed the -0.5 value to -0.25 and I placed the self.flags zero above the setsize. So far all I have seen is one corpse body set to the wrong size and they are not onground.

I remember way back we had a Quake C wiki....is it still around here?
Post Reply