What's wrong with using the c_trace?
You are tracing to handle the gravity anyway!
If your entity is above an entity the trace returns "you" for the entity.
Maybe I'm wrong, but I would write something like this after the trace instruction:
if(you != 0)
{
my.ambient = you.ambient;
}
From the manual:
"
you If the obstacle was an entity, the you pointer is set to that entity; otherwise it's set to NULL
"
online manual