Code:
function Entity_gravity(var Dist2floor, var fallspeed, var resilience, ENTITY* ent)
{
 VECTOR temp;
 var range=0.2;//play with this
 var current_height;
 vec_set(temp.x, ent.x);
 temp.z -= 10000;
 current_height = c_trace(ent.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE | IGNORE_PASSENTS);
 
 if(current_height > Dist2floor+range)
 {ent.z -= fallspeed * time_step;}

 if(current_height < Dist2floor-range)
 {ent.z += resilience*time_step;}
 return current_height;
}



This is and old function that ive made a long time ago, but i think it is what you´re looking for
You just have to call it inside a loop from the entity´s action

Last edited by wdakfenixx; 01/27/13 21:21. Reason: Forgot to tell you how to use it

CAUTION :The content above could blow your mind