Well I found part of the problem and solved it.
This need to be changed
obj.roofdistframe = c_trace(obj.x, vector(obj.x, obj.y, obj.z-9000), IGNORE_PASSABLE | IGNORE_FLAG2 | USE_POLYGON);
if(obj.in_jump == 2)
{fallstart(obj);}
else if(obj.in_jump == 3)
{fallgo(obj);}
else if(obj.in_jump == 4)
{landing(obj);}
else if(obj.roofdistframe > obj.objekthoehe/2 && obj.in_jump != 2 && obj.in_jump != 1)
{obj.in_jump = 2;}
}
To some thing like this
switch(obj.in_jump)
{
case 2:
fallstart(obj);
break;
case 3:
fallgo(obj);
break;
case 4:
landing(obj);
break;
// default:
// if(obj.roofdistframe > (obj.objekthoehe) && obj.in_jump != 2 && obj.in_jump != 1)
// obj.in_jump = 2;
// break;
}
The comment out line(in my script),in the original script was causing the "states to rapidly repeat. It in effect was staying in "fallgo" at the last condition. This was happening because you never put a case for 0 so when you reached 0 it defaulted to that line (I think). All I know for sure is that it was changing from in_jump=3 to in_jump=4 then right back to in_jump=3. This made it fall through the floor. So That is fixed, with the setting I'm using now it floats above or touches the floor when it lands. It seems to stop at a different point each time. So I'm trying to figure out why.
I'll work a little more on it.