Advertisement
Guest User

Untitled

a guest
Jun 30th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1.  
  2. Callback.Add("Draw", function() Tick() end)
  3. Callback.Add("ProcessWaypoint", function(unit, point) PW(unit, point) end)
  4.  
  5. tick = 0
  6. WTable = {}
  7.  
  8. function Tick()
  9. tick = GetTickCount()
  10. if WTable[myHero.networkID] then
  11. for i=#WTable[myHero.networkID], 1, -1 do
  12. -- Remove extra waypoints
  13. if WTable[myHero.networkID][i] and i ~= 1 and WTable[myHero.networkID][1]["time"]-WTable[myHero.networkID][i]["time"] >= 100 then
  14. table.remove(WTable[myHero.networkID], i)
  15. print("removed")
  16. end
  17. -- END
  18. if WTable[myHero.networkID][i] and WTable[myHero.networkID][i]["time"] then
  19. local a = WorldToScreen(0, WTable[myHero.networkID][i]["Vector"])
  20. if WTable[myHero.networkID][i-1] then
  21. local b = WorldToScreen(0, WTable[myHero.networkID][i-1]["Vector"])
  22. DrawLine(a.x, a.y, b.x, b.y, 1, GoS.White)
  23. DrawCircle(WTable[myHero.networkID][i]["Vector"], 50, 1, 0, GoS.White)
  24. local GBW = GetBestWaypoint(myHero, GetOrigin(myHero)).Vector
  25. local Extend = VectorExtend(myHero.pos, GBW, myHero.ms)
  26. DrawCircle(Extend, 70, 3, 0, GoS.Blue) -- Goes backwards
  27. end
  28. end
  29. end
  30. if WTable[myHero.networkID] and WTable[myHero.networkID][1] and WTable[myHero.networkID][1]["Vector"] and GetDistance(myHero, WTable[myHero.networkID][1]["Vector"]) <25 then
  31. WTable[myHero.networkID] = {}
  32. end
  33. end
  34. end
  35.  
  36. function GetBestWaypoint(unit, pos)
  37. local point = nil
  38. for i=1, #WTable[unit.networkID], 1 do
  39. if not point and WTable[unit.networkID][i] then point = WTable[unit.networkID][i] end
  40. if point and WTable[unit.networkID][i] and GetDistanceSqr(point.Vector,pos) > GetDistanceSqr(WTable[unit.networkID][i].Vector,pos) then
  41. point = WTable[unit.networkID][i-1]
  42. end
  43. end
  44. return point
  45. end
  46.  
  47. function PW(unit, point)
  48. if unit.isHero and unit.team==myHero.team and not unit.isDead then
  49. if not WTable[unit.networkID] then WTable[unit.networkID] = {} end
  50. WTable[unit.networkID][point.index] = {Vector =Vector(point.position.x, point.position.y, point.position.z), time= tick}
  51. end
  52. end
  53.  
  54. function VectorExtend(v,t,d)
  55. return v + d * (t-v):normalized()
  56. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement