Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. begin RotateQuill
  2.  
  3. ; Local script applied to unique quill.
  4. ; Quill floats and rotates to face specific
  5. ; coordinates when placed on the ground.
  6. ; Requires Tribunal for GetSquareRoot.
  7.  
  8. float FixedX
  9. float FixedY
  10. float GetX
  11. float GetY
  12. float Math
  13. short NewAng
  14. short OnPCDrop
  15.  
  16. if ( MenuMode )
  17. return
  18. endif
  19.  
  20. if ( OnPCDrop == 0 )
  21. return
  22. elseif ( OnPCDrop )
  23. set OnPCDrop to 0
  24. endif
  25.  
  26. set GetX to ( XCoordinate - ( GetPos, X ) )
  27. set FixedX to GetX
  28. if ( GetX < 0 )
  29. set GetX to ( 0 - GetX )
  30. endif
  31.  
  32. set GetY to ( YCoordinate - ( GetPos, Y ) )
  33. set FixedY to GetY
  34. if ( GetY < 0 )
  35. set GetY to ( 0 - GetY )
  36. endif
  37.  
  38. set Math to ( ( GetX * GetX ) + ( GetY * GetY ) )
  39. set Math to ( GetX / ( GetSquareRoot, Math ) )
  40.  
  41. if ( Math < 0.767 )
  42. if ( Math < 0.18 )
  43. set NewAng to 5
  44. elseif ( Math >= 0.18 )
  45. if ( Math < 0.26 )
  46. set NewAng to 10
  47. elseif ( Math >= 0.26 )
  48. if ( Math < 0.35 )
  49. set NewAng to 15
  50. elseif ( Math >= 0.35 )
  51. if ( Math < 0.43 )
  52. set NewAng to 20
  53. elseif ( Math >= 0.43 )
  54. if ( Math < 0.5 )
  55. set NewAng to 25
  56. elseif ( Math >= 0.5 )
  57. if ( Math < 0.575 )
  58. set NewAng to 30
  59. elseif ( Math >= 0.575 )
  60. if ( Math < 0.643 )
  61. set NewAng to 35
  62. elseif ( Math >= 0.643 )
  63. if ( Math < 0.708 )
  64. set NewAng to 40
  65. elseif ( Math >= 0.708 )
  66. set NewAng to 45
  67. endif
  68. endif
  69. endif
  70. endif
  71. endif
  72. endif
  73. endif
  74. endif
  75. elseif ( Math >= 0.767 )
  76. if ( Math < 0.82 )
  77. set NewAng to 50
  78. elseif ( Math >= 0.82 )
  79. if ( Math < 0.87 )
  80. set NewAng to 55
  81. elseif ( Math >= 0.87 )
  82. if ( Math < 0.907 )
  83. set NewAng to 60
  84. elseif ( Math >= 0.907 )
  85. if ( Math < 0.94 )
  86. set NewAng to 65
  87. elseif ( Math >= 0.94 )
  88. if ( Math < 0.966 )
  89. set NewAng to 70
  90. elseif ( Math >= 0.966 )
  91. if ( Math < 0.986 )
  92. set NewAng to 75
  93. elseif ( Math >= 0.986 )
  94. if ( Math < 0.997 )
  95. set NewAng to 80
  96. elseif ( Math >= 0.997 )
  97. if ( Math < 1 )
  98. set NewAng to 85
  99. elseif ( Math == 1 )
  100. set NewAng to 90
  101. endif
  102. endif
  103. endif
  104. endif
  105. endif
  106. endif
  107. endif
  108. endif
  109. endif
  110.  
  111. if ( FixedX > 0 )
  112. if ( FixedY == 0 )
  113. set NewAng to 180
  114. elseif ( FixedY > 0 )
  115. set NewAng to ( 180 + NewAng )
  116. elseif ( FixedY < 0 )
  117. set NewAng to ( 360 - NewAng )
  118. endif
  119. elseif ( FixedX < 0 )
  120. if ( FixedY == 0 )
  121. set NewAng to 0
  122. elseif ( FixedY > 0 )
  123. set NewAng to ( 180 - NewAng )
  124. endif
  125. elseif ( FixedX == 0 )
  126. if ( FixedY == 0 )
  127. set NewAng to 0
  128. SetAngle, X, 270
  129. elseif ( FixedY > 0 )
  130. set NewAng to 270
  131. elseif ( FixedY < 0 )
  132. set NewAng to 90
  133. endif
  134. endif
  135.  
  136. set Math to ( ( Player->GetPos, Z ) + 55 )
  137. SetPos, Z, Math
  138. SetAngle, Z, NewAng
  139.  
  140. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement