Thanks for the suggestion... when i use COLOR clr instead of COLOR* clr I get can not convert POINTER to STRUCT COLOR....

So thinking along those lines I broke the function up
Code:
int return_blue(ENTITY* ent, VECTOR* pos)
{
	COLOR* clr;
	clr = terrain_getpixel(ent,pos.x,pos.y,NULL);
	if(clr.blue == NULL) {return 0;}
	return(clr.blue);
}
function tile_to_height(ENTITY* ent,BMAP* he_bmap,var altitude)
{
	CONTACT* c;
	COLOR* clr;
	
	var num_Vert = ent_vertices(ent);
	var current_vert;
	var _tst = 0;
	for(current_vert = 1; current_vert < num_Vert; current_vert++)
	{
		c = ent_getvertex(ent,NULL,current_vert);
		_tst = return_blue(ent,vector(c.x,c.y,c.z));
		print_var(current_vert);
		print_var(_tst);
	}
	
	c_updatehull(ent,1);
}



Still Crashes at the same place...just now it crashes in the return_blue function....same amount of times it makes it through the loop....Is it possible that it has something with the cord...as according to the manual ent_getvertex returns the cords in the local entity coordinates and terrain_getpixel uses the world Cords...if so what would be the way to convert the position ?

Ok by switching if (clr.blue == NULL) to if(clr == NULL) the function works...Not sure why it will not read the last vert in that column...Still thinking it has to do with the position...

Last edited by lostzac; 08/17/13 08:29.

John C Leutz II