OK, at least that's something different. That's good. I still think you need to use USE_POLYGON, to get down to the actual surface of the terrain (sorry ... stubborn). That still gives the problem of possibly getting a trace not hitting the surface. I think this code might do the trick:
Code:
function village_func()
{
my.polygon = on;
vec_set (temp, my.pos);
temp.z -= 1000;
result = -1; // makes sure to initialize result to a known value we can check against
result -= c_trace(my.pos, temp, ignore_me + ignore_sprites + use_polygon);
if(result >= 0) // acceptable value as long as trace origin is above the terrain surface
{
temp.z = my.z - result;
vec_set(my.pos,temp);
}
else
{
// if first trace did not do the job do it again
result -= c_trace(my.pos, temp, ignore_me + ignore_sprites + use_polygon);
temp.z = my.z - result;
vec_set(my.pos,temp);
}

}

function sioux_camp()
{
temp.x = -96;
temp.y = -1164;
temp.z = 300;
ent_create("tepee_village.mdl",temp,village_func);
}



edit: now, if both traces fail to hit at all the village should appear at a world z of -1.
cheerio

Last edited by tindust; 12/04/07 07:33.