Advertisement
Hepht

FaceAway by someone

Oct 3rd, 2014
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.11 KB | None | 0 0
  1. -- ported script, will try to avoid trynd W and cassio stun (not 100%)
  2. require 'Utils'
  3. local delay = 850
  4. local lastRightClick = {x = nil, z = nil}
  5. local lastmyHeroPos = {x = 0, z = 0}
  6. local move = {x=0,z=0}
  7. local exist = false
  8. local moving = false
  9. local lastmove = 0
  10. local tickHeroPos = 0
  11. local forcemove = false
  12.  
  13.         for i=1, objManager:GetMaxHeroes() do
  14.                 local enemy = objManager:GetHero(i)
  15.                 if enemy.team ~= myHero.team and (enemy.name == "Tryndamere" or enemy.name == "Cassiopeia") then
  16.                         exist = true
  17.                 end
  18.         end
  19.  
  20. function OnProcessSpell(object,spell)
  21.         if not exist then return end
  22.         local spellName = spell.name
  23.         if object and object.team ~= myHero.team then
  24.                 if spellName == "CassiopeiaPetrifyingGaze" and GetDistance(object) <= 750 then
  25.                         local dist = GetDistance(object)
  26.                         move = {x=myHero.x+((object.x-myHero.x)*(-100)/dist),z=myHero.z+((object.z-myHero.z)*(-100)/dist)}
  27.                         _MoveToXYZ(move.x,0,move.z)
  28.                         moving = true
  29.                         lastmove = GetTickCount()
  30.                 elseif spellName == "MockingShout" and GetDistance(object) <= 850 then
  31.                         local dist = GetDistance(object)
  32.                         move = {x=myHero.x+((object.x-myHero.x)*(100)/dist),z=myHero.z+((object.z-myHero.z)*(100)/dist)}
  33.                         _MoveToXYZ(move.x,0,move.z)
  34.                         moving = true
  35.                         lastmove = GetTickCount()
  36.                 end
  37.         end
  38. end
  39. function OnWndMsg(msg,key)
  40.         if not exist then return end
  41.         if msg == WM_RBUTTONDOWN then
  42.                 lastRightClick.x,lastRightClick.z = mousePos.x,mousePos.z
  43.                 if forcemove and moving then
  44.                         _MoveToXYZ(move.x,0,move.z)
  45.                 end
  46.         end
  47. end
  48. function OnTick()
  49.         if not exist then return end
  50.  
  51.         if GetTickCount()-lastmove>=delay and moving and lastRightClick.x then
  52.                 _MoveToXYZ(lastRightClick.x,0, lastRightClick.z)
  53.                 moving = false
  54.         end
  55.  
  56.         if lastRightClick.x and not moving then
  57.                 if math.abs(myHero.x-lastRightClick.x) <= 75 and math.abs(myHero.z-lastRightClick.z) <= 75 then
  58.                 --If myHero has reached last right clicked position.
  59.                         lastRightClick.x = nil
  60.                         lastRightClick.z = nil
  61.                 end
  62.                 tickHeroPos = tickHeroPos+1
  63.                 if tickHeroPos>=100 then
  64.                         if lastmyHeroPos.x == myHero.x and lastmyHeroPos.z == myHero.z then
  65.                         --If myHero has not moved since the last 100 tick.
  66.                                 lastRightClick.x = nil
  67.                                 lastRightClick.z = nil
  68.                         end
  69.                         lastmyHeroPos.x = myHero.x
  70.                         lastmyHeroPos.z = myHero.z
  71.                         tickHeroPos = 0
  72.                 end
  73.         end
  74. end
  75. SetTimerCallback("OnTick")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement