Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Me ="DemonicArcher"
- local Target = nil
- local radar = peripheral.wrap("right")
- local mon = peripheral.wrap("top")
- local player = radar.getPlayerData("DemonicArcher")
- local myPlace = {}
- local targetPlace = {}
- local radarX = -113
- local radarY = 94
- local radarZ = 276
- local xDiff
- local yDiff
- local Distance
- local Decl
- local xPlayer
- local zPlayer
- local xTarget
- local zTarget
- function locate()
- player = radar.getPlayerData(Me)
- Player2 = radar.getPlayerData(Target)
- a = 1
- for k,v in pairs(player.position) do
- myPlace[a] = v
- a=a+1
- end
- b = 1
- for k,v in pairs(player2.position) do
- mobPlace[b] = v
- b=b+1
- end
- xPlayer = myPlace[2]+radarX
- zPlayer = myPlace[3]+radarZ
- xTarget = mobPlace[2]+radarX
- zTarget = mobPlace[3]+radarZ
- end
- function findDist()
- xDiff = (xPlayer-xTarget)
- zDiff = (zPlayer-zTarget)
- Distance = math.sqrt(xDiff^2 + zDiff^2)
- end
- function Angles()
- Decl = (Distance^2 +zDiff^2 - xDiff^2)/(2*Distance*zDiff)
- Decl = math.acos(Decl)
- Decl = math.deg(Decl)
- end
- function Quadrant()
- if xDiff>0 then
- Angle = Decl+180
- elseif xDiff<0 then
- Angle = Decl
- end
- end
- while true do
- locate()
- findDist()
- Angles()
- Quadrant()
- print(xDiff)
- print(zDiff)
- print(Distance)
- print(Decl)
- mon.clear()
- mon.setTextScale(3)
- mon.setCursorPos(1,1)
- mon.write(math.floor(Angle))
- print(math.floor(Angle))
- sleep(.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement