samipote

Sprediction v.2.0

Mar 29th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. require 'Utils'
  2. local version = '2.0'
  3.  
  4. function Sprediction(spell,unit,delay,range,speed,from,block,radius)
  5. local x, y, z = GetFireahead(unit,5,0)
  6. local ms = unit.movespeed
  7. local speed=speed
  8. local from = from or Vector(myHero)
  9. local CastPosition = unit.x, unit.y, unit.z
  10. local Position = myHero.x,myHero.y,myHero.z
  11. local delay = delay or (GetDistance(from, unit) / speed)
  12. local velocity = (Position + (((speed * speed + speed) * ms) / 2) - CastPosition) * -1 / ms
  13. local targetposition = Position + (ms * velocity) + ((( ms * ms + ms) * delay) / 2)
  14. local FX,FY,FZ = GetFireahead(unit,delay,speed)
  15. if unit~= nil and block == 0 and targetposition>range then
  16. CastSpellXYZ(spell,FX,FY,FZ)
  17. end
  18. if unit~= nil and targetposition>range and  block == 1 and CreepBlock(GetFireahead(unit,delay,speed)) == 0 then
  19. CastSpellXYZ(spell,FX,FY,FZ)
  20. end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment