Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Callback.Add("Draw", function() Tick() end)
- Callback.Add("ProcessWaypoint", function(unit, point) PW(unit, point) end)
- tick = 0
- WTable = {}
- function Tick()
- tick = GetTickCount()
- if WTable[myHero.networkID] then
- for i=#WTable[myHero.networkID], 1, -1 do
- -- Remove extra waypoints
- if WTable[myHero.networkID][i] and i ~= 1 and WTable[myHero.networkID][1]["time"]-WTable[myHero.networkID][i]["time"] >= 100 then
- table.remove(WTable[myHero.networkID], i)
- print("removed")
- end
- -- END
- if WTable[myHero.networkID][i] and WTable[myHero.networkID][i]["time"] then
- local a = WorldToScreen(0, WTable[myHero.networkID][i]["Vector"])
- if WTable[myHero.networkID][i-1] then
- local b = WorldToScreen(0, WTable[myHero.networkID][i-1]["Vector"])
- DrawLine(a.x, a.y, b.x, b.y, 1, GoS.White)
- DrawCircle(WTable[myHero.networkID][i]["Vector"], 50, 1, 0, GoS.White)
- local GBW = GetBestWaypoint(myHero, GetOrigin(myHero)).Vector
- local Extend = VectorExtend(myHero.pos, GBW, myHero.ms)
- DrawCircle(Extend, 70, 3, 0, GoS.Blue) -- Goes backwards
- end
- end
- end
- 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
- WTable[myHero.networkID] = {}
- end
- end
- end
- function GetBestWaypoint(unit, pos)
- local point = nil
- for i=1, #WTable[unit.networkID], 1 do
- if not point and WTable[unit.networkID][i] then point = WTable[unit.networkID][i] end
- if point and WTable[unit.networkID][i] and GetDistanceSqr(point.Vector,pos) > GetDistanceSqr(WTable[unit.networkID][i].Vector,pos) then
- point = WTable[unit.networkID][i-1]
- end
- end
- return point
- end
- function PW(unit, point)
- if unit.isHero and unit.team==myHero.team and not unit.isDead then
- if not WTable[unit.networkID] then WTable[unit.networkID] = {} end
- WTable[unit.networkID][point.index] = {Vector =Vector(point.position.x, point.position.y, point.position.z), time= tick}
- end
- end
- function VectorExtend(v,t,d)
- return v + d * (t-v):normalized()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement