Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.57 KB | None | 0 0
  1. Update Compass
  2. Options: Action
  3. Return Type: (None)
  4. Parameters
  5. Player = 0 <Integer>
  6. Grammar Text: Update Compass for player (Player)
  7. Hint Text: Makes the compass point the right way, and disables it if necessary
  8. Custom Script Code
  9. Local Variables
  10. Target = Player Target Unit[Player] <Unit>
  11. Player = Hero[Player] <Unit>
  12. Angle = (Angle from (Position of Player) to (Position of Target)) <Real>
  13. Yaw = (Current camera yaw of player Player) <Real>
  14. Difference = 0.0 <Real>
  15. correct point = Off <Compass Points>
  16. ------- (yaw) - (difference) = angle
  17. Actions
  18. ------- Convert yaw to a value from 0 to 360
  19. General - If (Conditions) then do (Actions) else do (Actions)
  20. If
  21. Yaw < 0.0
  22. Then
  23. Variable - Set Yaw = (360.0 + Yaw)
  24. Else
  25. ------- Convert angle to a value from 0 to 360
  26. General - If (Conditions) then do (Actions) else do (Actions)
  27. If
  28. Angle < 0.0
  29. Then
  30. Variable - Set Angle = (360.0 + Angle)
  31. Else
  32. ------- Find the new angle (between the 3 points)
  33. Variable - Set Difference = (Yaw - Angle)
  34. Variable - Set Difference = (Abs(Difference))
  35. ------- Output for debug
  36. UI - Clear Chat Messages for (All players)
  37. UI - Display (Combine ("Yaw: ", (Text(Yaw) with Any Precision decimal places), " Angle: ", (Text(Angle) with Any Precision decimal places), " New Angle: ", (Text(Difference) with Any Precision decimal places))) for (All players) to Subtitle area
  38. General - If (Conditions) then do (Actions) else do (Actions)
  39. If
  40. Or
  41. Conditions
  42. And
  43. Conditions
  44. Yaw > Angle
  45. 1 <= Difference <= 90
  46. And
  47. Conditions
  48. Yaw < Angle
  49. 270 <= Difference <= 360
  50. Then
  51. Variable - Set correct point = TopRight
  52. Else
  53. General - If (Conditions) then do (Actions) else do (Actions)
  54. If
  55. Or
  56. Conditions
  57. And
  58. Conditions
  59. Yaw < Angle
  60. 1 <= Difference <= 90
  61. And
  62. Conditions
  63. Yaw > Angle
  64. 270 <= Difference <= 360
  65. Then
  66. Variable - Set correct point = TopLeft
  67. Else
  68. General - If (Conditions) then do (Actions) else do (Actions)
  69. If
  70. Or
  71. Conditions
  72. And
  73. Conditions
  74. Yaw < Angle
  75. 90 <= Difference <= 180
  76. And
  77. Conditions
  78. Yaw > Angle
  79. 180 <= Difference <= 270
  80. Then
  81. Variable - Set correct point = BotLeft
  82. Else
  83. General - If (Conditions) then do (Actions) else do (Actions)
  84. If
  85. Or
  86. Conditions
  87. And
  88. Conditions
  89. Yaw > Angle
  90. 90 <= Difference <= 180
  91. And
  92. Conditions
  93. Yaw < Angle
  94. 180 <= Difference <= 270
  95. Then
  96. Variable - Set correct point = BotRight
  97. Else
  98. General - Switch (Actions) depending on correct point
  99. Cases
  100. General - If (TopLeft)
  101. Actions
  102. Dialog - Set Compass.Compass Icon image to Images.TopLeft for (Player group(Player))
  103. General - If (TopRight)
  104. Actions
  105. Dialog - Set Compass.Compass Icon image to Images.TopRight for (Player group(Player))
  106. General - If (BotRight)
  107. Actions
  108. Dialog - Set Compass.Compass Icon image to Images.BottomRight for (Player group(Player))
  109. General - If (BotLeft)
  110. Actions
  111. Dialog - Set Compass.Compass Icon image to Images.BottomLeft for (Player group(Player))
  112. General - If (Locked)
  113. Actions
  114. Dialog - Set Compass.Compass Icon image to Images.Locked for (Player group(Player))
  115. Default
  116. Dialog - Set Compass.Compass Icon image to Images.Empty for (Player group(Player))
  117. ------- Override direction if special situation arises
  118. General - If (Conditions) then do (Actions) else do (Actions)
  119. If
  120. Or
  121. Conditions
  122. locked[Player] == true
  123. Player Target Player[Player] == 0
  124. (Distance between (Position of Hero[Player]) and (Position of Player Target Unit[Player])) <= compass_cutoff_distance[Player Target Player[Player]]
  125. Then
  126. Dialog - Set Compass.Compass Icon image to Images.Locked for (Player group(Player))
  127. Else
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement