Here is the code to draw a box on an on-screen entity:

Code:
function draw_target(box_size)
{
	VECTOR pos[3];
	vec_set(pos.x,my.x);
	vec_to_screen(pos.x,camera);
	
	// draw target
	draw_line(vector(pos.x - box_size,pos.y - box_size,0),NULL,100);
	draw_line(vector(pos.x + box_size,pos.y - box_size,0),vector(255,255,255),100);
	draw_line(vector(pos.x + box_size,pos.y + box_size,0),vector(255,255,255),100);
	draw_line(vector(pos.x - box_size,pos.y + box_size,0),vector(255,255,255),100);
	draw_line(vector(pos.x - box_size,pos.y - box_size,0),vector(255,255,255),100);
}



The odd thing is that this code works, sort of. The box appears on the screen and rotates around all crazy while shifting positions. This problem goes away when I run this other function before I run the draw_target function

Code:
function register_nav()
{
	VECTOR temp[3];
	
	// create and store nav target panel
	you = ent_create("temp_invs.mdl",my.x,nav_marker);
	you.parent = me;
	
	pan_temp = ent_createlayer("nav_point_target.tga",0,4);
	text_temp = txt_create(1,4);
	text_temp.font = bit_dust_2_bmp;
	
	my.handle_nav_panel = handle(pan_temp);
	my.handle_nav_text = handle(text_temp);
	
	while(my.armor > 0)
	{
		
		// restore nav panel handle
		pan_temp = ptr_for_handle(my.handle_nav_panel);
		text_temp = ptr_for_handle(my.handle_nav_text);
		str_cpy((text_temp.pstring)[0],my.string1);
		
		// set placement of nav text
		vec_set(temp.x,my.x);
		if(vec_to_screen(temp.x,camera) != NULL)
		{
			text_temp.pos_x = temp.x + 24;
			text_temp.pos_y = temp.y - 16;
			set(text_temp,SHOW);
		}
		else
		{
			reset(text_temp,SHOW);
		}
		wait(1);
	}
	
	
	// delete associated nav panel
	text_temp = ptr_for_handle(my.handle_nav_text);
	txt_remove(text_temp);
}



This code creates a text on the screen that follows the entity like a label. This code also used to contain a panel that would follow the entity as a target, but I am moving away from using it, that's why the position updating part is no longer there... The problem also re-occurs when I remove the creation of the the pan_temp entity as well as the restoration of the pan_temp using ptr_for_handle.

Draw_line works fine as long as at least one entity in the level has called the last function. I don't get it, these two functions have nothing to do with eachother.