Advertisement
Guest User

Untitled

a guest
Jun 24th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. script "steptesting" ENTER
  2. {
  3. int IAmFalling;
  4. while (1)
  5. {
  6. //If player is moving upwards and not already falling...
  7. if (GetActorVelZ(0) > 0 && IAmFalling == 0)
  8. {
  9. //...they are probably in the air.
  10. IAmFalling = 1;
  11. }
  12.  
  13. //If player is moving downwards and not already falling...
  14. if (GetActorVelZ(0) < 0 && IAmFalling == 0)
  15. {
  16. //...and there is a 16 unit height or less step below...
  17. if (GetActorZ(0) <= (GetActorFloorZ(0)+16.0))
  18. {
  19. //...set player down to that step.
  20. SetActorPosition(0, GetActorX(0), GetActorY(0), GetActorFloorZ(0), 0);
  21. }
  22. else
  23. {
  24. //Otherwise they are probably in the air.
  25. IAmFalling = 1;
  26. }
  27. }
  28.  
  29. if (GetActorZ(0) == GetActorFloorZ(0) && IAmFalling == 1)
  30. {
  31. //If player is on the ground, they can't be in the air.
  32. IAmFalling = 0;
  33. }
  34. //print(f:IAmFalling); //debug
  35. Delay (1);
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement