Advertisement
DemonicArcher

Untitled

Feb 9th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. local Me ="DemonicArcher"
  2. local Target = nil
  3.  
  4. local radar = peripheral.wrap("right")
  5. local mon = peripheral.wrap("top")
  6. local player = radar.getPlayerData("DemonicArcher")
  7. local myPlace = {}
  8.  
  9. local targetPlace = {}
  10.  
  11.  
  12.  
  13. local radarX = -113
  14. local radarY = 94
  15. local radarZ = 276
  16.  
  17. local xDiff
  18. local yDiff
  19. local Distance
  20. local Decl
  21. local xPlayer
  22. local zPlayer
  23. local xTarget
  24. local zTarget
  25.  
  26.  
  27.  
  28. function locate()
  29. player = radar.getPlayerData(Me)
  30. Player2 = radar.getPlayerData(Target)
  31.  
  32.  
  33.  
  34. a = 1
  35. for k,v in pairs(player.position) do
  36. myPlace[a] = v
  37. a=a+1
  38. end
  39. b = 1
  40. for k,v in pairs(player2.position) do
  41. mobPlace[b] = v
  42. b=b+1
  43. end
  44. xPlayer = myPlace[2]+radarX
  45. zPlayer = myPlace[3]+radarZ
  46. xTarget = mobPlace[2]+radarX
  47. zTarget = mobPlace[3]+radarZ
  48.  
  49.  
  50.  
  51.  
  52. end
  53.  
  54. function findDist()
  55. xDiff = (xPlayer-xTarget)
  56. zDiff = (zPlayer-zTarget)
  57. Distance = math.sqrt(xDiff^2 + zDiff^2)
  58.  
  59. end
  60.  
  61. function Angles()
  62. Decl = (Distance^2 +zDiff^2 - xDiff^2)/(2*Distance*zDiff)
  63. Decl = math.acos(Decl)
  64. Decl = math.deg(Decl)
  65. end
  66.  
  67. function Quadrant()
  68. if xDiff>0 then
  69. Angle = Decl+180
  70. elseif xDiff<0 then
  71. Angle = Decl
  72. end
  73.  
  74.  
  75. end
  76.  
  77.  
  78. while true do
  79. locate()
  80. findDist()
  81. Angles()
  82. Quadrant()
  83. print(xDiff)
  84. print(zDiff)
  85. print(Distance)
  86. print(Decl)
  87. mon.clear()
  88. mon.setTextScale(3)
  89. mon.setCursorPos(1,1)
  90. mon.write(math.floor(Angle))
  91. print(math.floor(Angle))
  92. sleep(.5)
  93. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement