Guest User

syndra test

a guest
Mar 13th, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.43 KB | None | 0 0
  1. --[[
  2.     Follow while combo:
  3.         0 for Dont Follow
  4.         1 for Follow the mouse
  5. ]]
  6.  
  7. if myHero.charName ~= "Syndra" then return end
  8.  
  9. local qRange = 800
  10. local wRange = 925
  11. local eRange = 650
  12. local rRange = 675
  13. local enemyMinions = {}
  14. local ultDmg = {90, 135, 180}
  15. local wWait, nextdelay, balls, qX, qZ, qCreated = 0, 0, 0, 0, 0, 0
  16. local DFGSlot = nil
  17.  
  18. local delay, espeed = 250, 1.35
  19.  
  20. local QREADY, WREADY, EREADY, RREADY, DFGREADY = false, false, false, false, false
  21.  
  22. function OnLoad()
  23.     HConfig = scriptConfig("Syndra Combo", "SyndraCombo")
  24.     HConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  25.     HConfig:addParam("stun", "Stun", SCRIPT_PARAM_ONKEYDOWN, false, 84)
  26.     HConfig:addParam("following", "Follow while combo", SCRIPT_PARAM_SLICE, 0, 0, 1)
  27.    
  28.     for i=1, heroManager.iCount do
  29.         local enemy = heroManager:GetHero(i)
  30.         if enemy.team ~= myHero.team then
  31.             HConfig:addParam("ult"..enemy.charName, "Ult and DFG on "..enemy.charName, SCRIPT_PARAM_ONOFF, true)
  32.         end
  33.     end
  34.    
  35.     HConfig:permaShow("stun")
  36.     HConfig:permaShow("scriptActive")
  37.    
  38.     enemyMinions = minionManager(MINION_ENEMY, wRange, myHero, MINION_SORT_HEALTH_DES)
  39.    
  40.     PrintChat(" >> Syndra Combo by HunteR")
  41. end
  42.  
  43. function getEnemyMinion()
  44.     for i, minion in pairs(enemyMinions.objects) do
  45.         if minion ~= nil and minion.valid then
  46.             return minion
  47.         end
  48.     end
  49.     return nil
  50. end
  51.  
  52. function getBall()
  53.     local ret = nil
  54.     if GetTickCount() > nextdelay then
  55.         balls = 0
  56.         for i = 1, objManager.maxObjects do
  57.             local object = objManager:getObject(i)
  58.             if object then
  59.                 if GetDistance(object) < rRange and string.find(string.lower(object.name), "darksphere") and string.find(string.lower(object.name), "_idle") then
  60.                     balls = balls + 1
  61.                     if ret == nil then ret = object end
  62.                 end
  63.             end
  64.         end
  65.         if ret == nil then ret = "none" end
  66.         nextdelay = GetTickCount() + 100
  67.     end
  68.     return ret
  69. end
  70.  
  71. function OnTick()
  72.     if myHero.dead then
  73.         return
  74.     end
  75.    
  76.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  77.     WREADY = (myHero:CanUseSpell(_W) == READY)
  78.     EREADY = (myHero:CanUseSpell(_E) == READY)
  79.     RREADY = (myHero:CanUseSpell(_R) == READY)
  80.     DFGSlot = GetInventorySlotItem(3128)
  81.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  82.    
  83.     local spellR = myHero:GetSpellData(_R)
  84.     if spellR.level == 3 then rRange = 750 end
  85.    
  86.     if HConfig.scriptActive then combo("Combo") end
  87.     if HConfig.stun then combo("Stun") end
  88. end
  89.  
  90. function OnProcessSpell(unit, spell)
  91.     if unit.name == myHero.name then
  92.         if spell.name == "SyndraQ" then
  93.             qCreated = os.clock() + 1
  94.             qX, qZ = spell.endPos.x, spell.endPos.z
  95.         end
  96.     end
  97. end
  98.  
  99. function getDistance2(x1, z1, x2, z2)
  100.     return math.sqrt(math.pow(x2 - x1, 2) + math.pow(z2 - z1, 2))
  101. end
  102.  
  103. function combo(typeC)
  104.     local focusEnemy = nil
  105.     local minimumHit = -1
  106.     local lowPriority = false
  107.    
  108.     local stunEnemy = nil
  109.     local minimumDistance = -1
  110.    
  111.     for i=1, heroManager.iCount do
  112.         local target = heroManager:GetHero(i)
  113.         if ValidTarget(target, 1000) then
  114.             local dmg = getDmg("Q", target, myHero)
  115.             local hits = (target.health / dmg)
  116.             if minimumHit == -1 or (hits < minimumHit and HConfig["ult"..target.charName]) or hits <= 1.05 or (not lowPriority and minimumHit > 1.05) then
  117.                 focusEnemy = target
  118.                 minimumHit = hits
  119.                 lowPriority = HConfig["ult"..target.charName]
  120.             end
  121.            
  122.             local distancetoStun = GetDistance(target)
  123.             if minimumDistance == -1 or distancetoStun < minimumDistance then
  124.                 stunEnemy = target
  125.                 minimumDistance = distancetoStun
  126.             end
  127.         end
  128.     end
  129.    
  130.     if focusEnemy ~= nil or (stunEnemy ~= nil and typeC == "Stun") then
  131.         if typeC == "Stun" then
  132.             focusEnemy = stunEnemy
  133.         end
  134.    
  135.         local travelDuration = (delay + GetDistance(myHero, focusEnemy)/espeed)
  136.         travelDuration = (delay + GetDistance(GetPredictionPos(focusEnemy, travelDuration))/espeed)
  137.         travelDuration = (delay + GetDistance(GetPredictionPos(focusEnemy, travelDuration))/espeed)
  138.         travelDuration = (delay + GetDistance(GetPredictionPos(focusEnemy, travelDuration))/espeed)      
  139.         local prediction = GetPredictionPos(focusEnemy, travelDuration)
  140.        
  141.         local spellW = myHero:GetSpellData(_W)
  142.        
  143.         if QREADY and prediction ~= nil then
  144.             local dPredict = GetDistance(prediction)
  145.             if EREADY then
  146.                 if (dPredict < eRange) then
  147.                     CastSpell(_Q, prediction.x, prediction.z)
  148.                 else
  149.                     local xQ = myHero.x + (eRange / dPredict) * (prediction.x - myHero.x)
  150.                     local zQ = myHero.z + (eRange / dPredict) * (prediction.z - myHero.z)
  151.                     CastSpell(_Q, xQ, zQ)
  152.                 end
  153.                
  154.                 return
  155.             elseif dPredict < qRange then
  156.                 CastSpell(_Q, prediction.x, prediction.z)
  157.                 return
  158.             end
  159.         end
  160.        
  161.         if EREADY and qCreated > os.clock() then
  162.             if getDistance2(myHero.x, myHero.z, qX, qZ) < eRange then
  163.                 CastSpell(_E, qX, qZ)
  164.                 wWait = GetTickCount() + 700
  165.                 return
  166.             else
  167.                 myHero:MoveTo(qX, qZ)
  168.                 return
  169.             end
  170.         end
  171.        
  172.         if typeC == "Combo" then
  173.             if DFGREADY and GetDistance(focusEnemy) < 750 and HConfig["ult"..focusEnemy.charName] then
  174.                 CastSpell(DFGSlot, focusEnemy)
  175.                 return
  176.             end
  177.            
  178.             if WREADY and GetTickCount() > wWait then
  179.                 local wGetX, wGetZ = nil, nil
  180.                
  181.                 if spellW.name == "SyndraW" and not EREADY then
  182.                     enemyMinions:update()
  183.                     local minion = getEnemyMinion()
  184.                    
  185.                     if minion ~= nil then wGetX, wGetZ = minion.x, minion.z end
  186.                    
  187.                     if wGetX == nil then
  188.                         local ball = getBall()
  189.                         if ball == nil then return end
  190.                         if ball ~= "none" then wGetX, wGetZ = ball.x, ball.z end
  191.                     end
  192.                    
  193.                     if wGetX ~= nil then
  194.                         CastSpell(_W, wGetX, wGetZ)
  195.                         wWait = GetTickCount() + 300
  196.                         return
  197.                     end
  198.                 elseif spellW.name ~= "SyndraW" then
  199.                     if not focusEnemy.canMove then
  200.                         wGetX = focusEnemy.x
  201.                         wGetZ = focusEnemy.z
  202.                     elseif prediction ~= nil then
  203.                         wGetX = prediction.x
  204.                         wGetZ = prediction.z
  205.                     end
  206.                    
  207.                     if wGetX ~= nill then
  208.                         CastSpell(_W, wGetX, wGetZ)
  209.                         return
  210.                     end
  211.                 end
  212.             end
  213.            
  214.             local AlwaysUltimate = true
  215.            
  216.             if CountEnemyHeroInRange(1000) > 3 then
  217.                 if getDmg("Q", focusEnemy, myHero) >= focusEnemy.health then
  218.                     AlwaysUltimate = false
  219.                 end
  220.             end
  221.            
  222.             if RREADY and GetDistance(focusEnemy) < rRange and HConfig["ult"..focusEnemy.charName] then
  223.                 CastSpell(_R, focusEnemy)
  224.             end
  225.         end
  226.     end
  227. end
  228.    
  229.     if HConfig.following == 1 and typeC == "Combo" then
  230.         myHero:MoveTo(mousePos.x, mousePos.z)
  231.     end
  232. end
Advertisement
Add Comment
Please, Sign In to add comment