Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script "steptesting" ENTER
- {
- int IAmFalling;
- while (1)
- {
- //If player is moving upwards and not already falling...
- if (GetActorVelZ(0) > 0 && IAmFalling == 0)
- {
- //...they are probably in the air.
- IAmFalling = 1;
- }
- //If player is moving downwards and not already falling...
- if (GetActorVelZ(0) < 0 && IAmFalling == 0)
- {
- //...and there is a 16 unit height or less step below...
- if (GetActorZ(0) <= (GetActorFloorZ(0)+16.0))
- {
- //...set player down to that step.
- SetActorPosition(0, GetActorX(0), GetActorY(0), GetActorFloorZ(0), 0);
- }
- else
- {
- //Otherwise they are probably in the air.
- IAmFalling = 1;
- }
- }
- if (GetActorZ(0) == GetActorFloorZ(0) && IAmFalling == 1)
- {
- //If player is on the ground, they can't be in the air.
- IAmFalling = 0;
- }
- //print(f:IAmFalling); //debug
- Delay (1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement