Well, these problems aren't
quite so little.
First off, your character isn't falling because he hasn't been instructed to. When you call c_move(), you tell him to move forward, but you don't check to see how far he is above the ground and give him a negative z distance so he can fall. In fact, you don't do anything with "distance_to_ground", which is rather inefficient.
The thing about "poor-man's-physics" is that your characters aren't affected by gravity the way physics objects are. You have to manually check how high above the ground they are, and if they are too high, you must give them a negative Z distance value.
Also, you shouldn't trace downwards 1000 quants. If the ground is farther than 1000 quants, or any number for that matter, the function returns a zero, which in this case isn't good for much. You should only trace down 5 quants or so, and if the ray doesn't hit anything (ie, returns a zero), then you should make the character fall. That's much more efficient.
For example:
action moving_character()
{
// some variables
var dist_to_ground;
var dist[3];
// give me a bounding box
my.fat = on;
my.narrow = on;
// make sure the b-box is equally long on all sides to prevent "hitching" while rotating
if( my.min_x < my.min_y ) { my.min_y = my.min_x; }
if( my.max_x > my.max_y ) { my.max_y = my.max_x; }
if( my.min_y < my.min_x ) { my.min_x = my.min_y; }
if( my.max_y > my.max_x ) { my.max_x = my.max_y; }
while( my ) // only loop as long as I exist
{
vec_set( temp.x, my.x );
temp.z -= 5; // trace down only 5 quants
dist_to_ground = c_trace( my.x, temp.x, ignore_passable+ignore_me+use_box );
if( dist_to_ground == 0 ) // no ground below me?
{
dist.x = 3; // move slow in mid-air
dist.y = 0; // no sideways movement
dist.z = -10; // gravity
}
if( dist_to_ground <= 5 && dist_to_ground != 0 ) // found ground?
{
dist.x = 6; // move quickly on land
dist.y = 0; // no sideways movement
dist.z = 0; // no gravity on the ground
}
c_move( my, dist, nullvector, ignore_passable+glide ); // move me according to "dist"
wait(1);
}
}
I should note that I use C-Script in this example, which is what I am accustomed to. You might have to fix the syntax up a little.