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;
}
};
Bots stuck in floor
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?
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?