Ooooh, that sounds too tricky for my klutzy koding non-skill.
Here's what I have so far. It works going up hill and on the level, but not downhill.

Code:
ent_terrain = you;
	burro = me;
	vec_set(temp, you.x);
	vec_sub(temp,my.x);
        my.tilt = vec_to_angle(you.tilt,temp);