I wanted to keep it separate as I will likely call it for many models during their first few frames(static models)...I initially am setting it for the player..who in time will get it called only at key intervals...key_pressed/key_any or whatever best will suit it.
here is how I set it now...
Code:
function player_ambient()
{
var fmt, pxl; COLOR tmpC;

	c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
	if(trace_hit)
	{
		my.ambient = -120;
		BMAP* shadows = ent_getskin(you,2);  //<<shadowmap skin number
		fmt = bmap_lock(shadows,0);
		pxl = pixel_for_bmap(shadows,hit.u1,hit.v1);
		bmap_unlock(shadows);
		pixel_to_vec(tmpC, NULL, fmt, pxl);
		my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3) * 0.784;
	}
	
}




Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/