Advertisement
Kevinkev

EAD Ulti Helper 1.5.lua (performance maintenance)

Dec 20th, 2012
2,675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.24 KB | None | 0 0
  1. --[[
  2.  
  3. Based on a true story  (EZREAL-ASHE-DRAVEN Helper) 1.5
  4.  
  5. <Pun intended>
  6. Explanation: Base because it shoots at base, true because trueshotbarrage,
  7. and story because you'll tell your kids about the time you killed someone at base using an ez ulti.
  8.  
  9. Basically the same thing so I merged em. You can add your champions yourself eg Draven. More code needed though ;P
  10.  
  11. by Kevinkev
  12.                        
  13.  
  14.  
  15.  
  16.  
  17. ]]--
  18.  
  19.  
  20. if myHero.charName == "Ezreal" or myHero.charName == "Ashe" or myHero.charName == "Draven" then
  21.  
  22.  
  23. function OnLoad()
  24. globalDelay = 0
  25. useIT = true
  26.  if GetMap().index == 1 then
  27.  --SummonersRift
  28.     BaseSpots = {
  29.         -- Recall-to-Base Locations
  30.         { x = 28.58,    y = 184.62, z = 267.16  }, -- BOT LEFT BASE              [1]
  31.         { x = 13936.64, y = 184.97, z = 14174.86}  -- TOP RIGHT BASE             [9]
  32.     }
  33.  
  34.     BuffCamps = {
  35.     --To steal later on.. ;P
  36. ["topBlue"] ={  name = "AncientGolem7.1.1",     x = 10386.60546875,     y = 54.86909866333,     z = 6811.1123046875}, --[6]
  37. ["Dragon"]  ={  name = "Dragon6.1.1",           x = 9459.51953125,      y = -60.592025756836,   z = 4193.0297851563}, --[3]
  38. ["Baron"]   ={  name = "Worm12.1.1",            x = 4600.4951171875,    y = -63.072219848633,   z = 10250.461914063}, --[7]
  39. ["botBlue"] ={  name = "AncientGolem1.1.1",     x = 3632.7001953125,    y = 54.173000335693,    z = 7600.373046875},  --[4]
  40. ["botRed"]  ={  name = "LizardElder4.1.1",      x = 7455.615234375,     y = 57.275253295898,    z = 3890.2026367188}, --[2]
  41. ["topRed"]  ={  name = "LizardElder10.1.1",     x = 6504.2407226563,    y = 54.63500213623,     z = 10584.5625}       --[8]
  42.  
  43. --If its easier to read I made this
  44. --[[
  45. Ba = Baron
  46. S = base "S"pot
  47. b = blue
  48. R = red
  49. D = dragon
  50. 5 is the "H"otkey to activate this.
  51.  
  52. [7] [8] [9]
  53. [4] [5] [6]
  54. [1] [2] [3]
  55. ============
  56. [Ba][R] [S]
  57. [b] [H] [b]
  58. [S] [R] [D]
  59.  
  60. ]]--
  61.     }
  62.  
  63.  
  64.  
  65.  
  66.  elseif GetMap().index == 8 then
  67.   --Dominion
  68.    BaseSpots = {
  69.         -- Recall-to-Base Locations
  70.         { x = 514.287109375,    y = -35.081577301025, z = 4149.9916992188  }, -- LEFT BASE              [4]
  71.          { x = 13311.96484375,    y = -37.369071960449, z = 4161.232421875  }  -- RIGHT BASE             [6]
  72.     }
  73.  end
  74.  
  75.  if player.team == TEAM_BLUE then
  76.  aim = 2 --Top
  77.  else
  78.  aim = 1 --Bot
  79.  end
  80.  
  81.  --Change these to your liking. I couldnt be bothered putting it in tables.
  82.  
  83.  championsArray = {
  84.  {name = "Ezreal",      projSpeed = 1720.89,       spellDelay = 265},
  85.  {name = "Ashe",        projSpeed = 1600,       spellDelay = 265},
  86.  {name = "Draven",      projSpeed = 1900,       spellDelay = 480},
  87.  }
  88.  
  89.  if myHero.charName == "Ezreal" then
  90.  --Ezreal STATS
  91.  --
  92.  ultiProjectileSpeed = 1720.89
  93.  spellDelay = 265
  94.  
  95.  elseif myHero.charName == "Ashe" then
  96.  --ASHE STATS
  97.  --
  98.  ultiProjectileSpeed = 1600
  99.  spellDelay = 265
  100.  elseif myHero.charName == "Draven" then
  101.  --DRAVEN STATS
  102.  --
  103.  
  104.  ultiProjectileSpeed = 1890
  105.  spellDelay = 480
  106.  end
  107.  
  108.  
  109.  --HOTKEYS
  110.  ShootHK        =  32               --Change it if you wish
  111.  
  112.  autoUltHK      =  string.byte("X") --Change it if you wish
  113.  manualUltHK    =  string.byte("V") --Change it if you wish
  114.  aimRecallHK    =  string.byte("C") --Change it if you wish
  115.  --OTHER
  116.  ultiShootDelay = 0
  117.  player = GetMyHero()
  118.  drawCircles = true
  119.  moveBuffer = 20 --To detect pressing B while moving.
  120.  
  121.  
  122.  
  123. HeroBackSpots = {
  124. {name, x, y, z, endTime, damageCheck},
  125. {name, x, y, z, endTime, damageCheck},
  126. {name, x, y, z, endTime, damageCheck},
  127. {name, x, y, z, endTime, damageCheck},
  128. {name, x, y, z, endTime, damageCheck}
  129. }
  130.  
  131.  --ShiftMenu
  132.     KCConfig = scriptConfig("EzrealAsheDraven Ult Helper", "autoUlti")
  133.  
  134.     KCConfig:addParam("Shoot", "Shoot", SCRIPT_PARAM_ONKEYDOWN, false, ShootHK)
  135.  
  136.  
  137.   PrintChat(">> ".. tostring(myHero.charName) .." Helper Loaded [Kevinkev]")
  138. end
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145. function OnProcessSpell(object,spell)
  146.  
  147.     buffer = 500 --Champ dissapears after this buffer..
  148.     spellName = spell.name
  149.    
  150.  
  151. --
  152.        
  153.     if object~=nil and object.team ~= player.team  then
  154.     local Rdamage = getDmg("R",object,myHero)
  155.      if Rdamage > object.health then
  156.             damageParameter = true
  157.          --PrintChat("Dominion Recall: ".. object.name)  
  158.         if spell.name == "OdinRecall" then
  159.             --PrintChat("Dominion Recall")
  160.    
  161.             drawMeBacking(object, GetTickCount() + 4500 +buffer,damageParameter) --4.5 seconds for dominion
  162.    
  163.         elseif spell.name == "RecallImproved" then
  164.  
  165.             --PrintChat("Improved Recall")
  166.             drawMeBacking(object, GetTickCount() + 7000 +buffer,damageParameter) --7 Seconds for improved recall
  167.      
  168.         elseif spellName == "Recall" then
  169.    
  170.             --PrintChat("Normal Recall")
  171.             drawMeBacking(object, GetTickCount() +8000 +buffer,damageParameter) --8 Seconds for normal recall
  172.             end
  173.          
  174.          
  175.         end
  176.        
  177.     end
  178. end
  179.  
  180. function drawMeBacking(object,endTime,check)
  181.  
  182.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  183.         if HeroBackSpots.name == nil then
  184.        
  185.         HeroBackSpots.name      = object.name --Record the name & positions
  186.         HeroBackSpots.x         = object.x
  187.         HeroBackSpots.y         = object.y
  188.         HeroBackSpots.z         = object.z
  189.         HeroBackSpots.endTime   = endTime
  190.         HeroBackSpots.damageCheck = check
  191.         --PrintChat(HeroBackSpots.name)
  192.         break --to avoid filling multiple entries
  193.         end
  194.     end
  195.  
  196. end
  197.  
  198. function checkMyRecall()
  199.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  200.         if GetTickCount() > (HeroBackSpots.endTime or 0) then
  201.             HeroBackSpots.name = nil --Delete the name (positions are now irrelephant)
  202.         end
  203.     end
  204. end
  205.  
  206. function mathStuff(x,y)
  207.  
  208. return math.floor(math.sqrt((x)^2 + (y)^2))
  209.  
  210. end
  211.  
  212. function moreMathStuff(x,y,z)
  213.  
  214. return mathStuff(z,mathStuff(x,y))
  215.  
  216. end
  217. function OnDeleteObj(object)
  218.     if object.name == "TeleportHome.troy" then
  219.  
  220.         for i,HeroBackSpots in pairs(HeroBackSpots) do
  221.  
  222.         --If within proximity
  223.             if moreMathStuff(HeroBackSpots.x,HeroBackSpots.y,HeroBackSpots.z) - moreMathStuff(object.x,object.y,object.z) < moveBuffer then  
  224.             --And in the list of heroes
  225.                     for j = 1, heroManager.iCount, 1 do
  226.                     local enemyhero = heroManager:getHero(j)
  227.                         if HeroBackSpots.name == enemyhero.name then
  228.                             --This particular one is still visible
  229.                             if enemyhero.visible then
  230.                             --Then they cancelled their recall ;)
  231.                             HeroBackSpots.name = nil
  232.                             --So delete them from the list >:D
  233.                             break
  234.                             end
  235.                         end
  236.                     end
  237.             end
  238.         end
  239.     end
  240. end
  241. --No longer used
  242. function didTheyMove()
  243.     for j = 1, heroManager.iCount, 1 do
  244.         local enemyhero = heroManager:getHero(j)
  245.             for i,HeroBackSpots in pairs(HeroBackSpots) do
  246.             if HeroBackSpots.name == enemyhero.name then
  247.                
  248.                 if moveBuffer<mathStuff( mathStuff(HeroBackSpots.x - enemyhero.x, HeroBackSpots.y - enemyhero.y), HeroBackSpots.z - enemyhero.z) then
  249.                  
  250.                     HeroBackSpots.name = nil
  251.                 end
  252.                 end
  253.             end
  254.     end
  255. end
  256.  
  257.  
  258. function OnTick()
  259.  
  260. --didTheyMove()
  261.  
  262. checkMyRecall()
  263.  
  264. TheMagicHappens()
  265.    
  266.  
  267.  
  268. end
  269.  
  270. function theTimeisRightForRecall()
  271.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  272.         if HeroBackSpots.name ~= nil and HeroBackSpots.damageCheck then
  273.         Speed = ((mathStuff(player.x - HeroBackSpots.x, player.z - HeroBackSpots.z)/(ultiProjectileSpeed/1000)) + GetTickCount())
  274.             if (Speed <  HeroBackSpots.endTime - spellDelay - GetLatency()/2)  then
  275.                doIt(HeroBackSpots.x,HeroBackSpots.z)
  276.             end
  277.         end
  278.     end
  279. end
  280.  
  281. function theTimeisRight()
  282.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  283.         if HeroBackSpots.name ~= nil and HeroBackSpots.damageCheck then
  284.         Speed = ((mathStuff(player.x - BaseSpots[aim].x, player.z - BaseSpots[aim].z)/(ultiProjectileSpeed/1000)) +   GetTickCount())
  285.             if (Speed >  HeroBackSpots.endTime - spellDelay - (GetLatency()/2)) and Speed - GetTickCount()  <= 8000 then
  286.                 doIt(BaseSpots[aim].x,BaseSpots[aim].z)
  287.             end
  288.         end
  289.     end
  290. end
  291.  
  292. function doIt(x,z)
  293.     --If delay is less than the one set.
  294.     if globalDelay < GetTickCount() then
  295.    
  296.     if myHero:CanUseSpell(_R) == READY then
  297.         CastSpell(_R,x,z)
  298.         if myHero.charName == "Draven" then
  299.         globalDelay = GetTickCount()+15000 --Because it will see that R can be used and it'll send the ulti back (1.5 bug fixed)
  300.         end
  301.        
  302.     end
  303.    
  304.    
  305.     end
  306.    
  307.  
  308. end
  309.  
  310. function TheMagicHappens()
  311.    
  312.     if autoUlt and myHero:CanUseSpell(_R) == READY then
  313.         if aimRecall then
  314.         theTimeisRightForRecall()
  315.         end
  316.    
  317.         theTimeisRight()
  318.            
  319.     end
  320.  
  321.     if manualUlt then
  322.         if KCConfig.Shoot then
  323.     target = whoTarget()
  324.         if target ~= 0 then
  325.         if target.visible then --if visible
  326.         doIt(target.x,target.z)
  327.         end
  328.         end
  329.         end
  330.     end
  331.        
  332. end
  333.  
  334. function whoTarget()
  335.  
  336.     for j = 1, heroManager.iCount, 1 do
  337.         local enemyhero = heroManager:getHero(j)
  338.         if ValidTarget(enemyhero) and enemyhero.dead == false then
  339.         if lowestHP == nil then lowestHP = enemyhero end
  340.        
  341.         if enemyhero.health < lowestHP.health then
  342.         lowestHP = enemyhero
  343.         end        
  344.         end
  345.     end
  346.  
  347.     if lowestHP == nil then
  348.     return 0
  349.     else
  350.     return lowestHP
  351.     end
  352. end
  353.  
  354. function OnWndMsg(msg,key)
  355.     if key == manualUltHK then
  356.  
  357.         if msg == KEY_DOWN then
  358.  
  359.             if manualUlt then
  360.  
  361.                 manualUlt = false
  362.  
  363.                 PrintChat(">> Manual Timing OFF")
  364.  
  365.             else
  366.  
  367.                 manualUlt = true
  368.  
  369.                 PrintChat(">> Manual Timing ON")
  370.  
  371.             end
  372.  
  373.         end
  374.  
  375.     end
  376.    
  377.    
  378.    
  379.     if key == autoUltHK then
  380.  
  381.         if msg == KEY_DOWN then
  382.  
  383.             if autoUlt then
  384.  
  385.                 autoUlt = false
  386.  
  387.                 PrintChat(">> Auto Shoot Ultimate DISABLED")
  388.  
  389.             else
  390.  
  391.                 autoUlt = true
  392.  
  393.                 PrintChat(">> Auto Shoot Ultimate ENABLED")
  394.  
  395.             end
  396.  
  397.         end
  398.  
  399.     end
  400.    
  401.    
  402.     if key == aimRecallHK then
  403.  
  404.         if msg == KEY_DOWN then
  405.  
  406.             if aimRecall then
  407.  
  408.                 aimRecall = false
  409.  
  410.                 PrintChat(">> Aim recall location DISABLED")
  411.  
  412.             else
  413.  
  414.                 aimRecall = true
  415.  
  416.                 PrintChat(">> Aim recall location ENABLED")
  417.  
  418.             end
  419.  
  420.         end
  421.  
  422.     end
  423.    
  424.      SC__OnWndMsg(msg,key)
  425. end
  426.  
  427.  
  428. function OnDraw()
  429.  
  430.         if manualUlt then
  431.         x,y = get2DFrom3D(player.x, player.y, player.z) --gets the position on the screen
  432.  
  433.         if whoTarget() ~= 0 then
  434.         DrawText(tostring("Aiming: "..whoTarget().charName),15,x,y, 0xFF00FF00)
  435.         end
  436.         end
  437.  
  438.  
  439.         if drawCircles then
  440.                 for i,HeroBackSpots in pairs(HeroBackSpots) do
  441.                         if HeroBackSpots.name ~= nil then
  442.                             --Thanks Apple--
  443.                             text = math.round((HeroBackSpots.endTime - GetTickCount())/1000) --gets the timer in digits
  444.                             --Thanks gReY--
  445.                             x,y = get2DFrom3D(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z) --gets the position on the screen
  446.                            
  447.                             DrawText("RECALL IN " ..text,22, x - 60, y + 80, 0xFF00FF00)
  448.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 28, circleColor)
  449.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 29, circleColor)
  450.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 30, circleColor)
  451.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 31, circleColor)
  452.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 32, circleColor)
  453.                             --I'd rather the circles get smaller Apple ;) time tick tick away~
  454.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 15*text + 30, circleColor)
  455.                         end
  456.                 end
  457.                
  458.                 for i,BaseSpots in pairs(BaseSpots) do
  459.                         if GetDistance(BaseSpots, mousePos) <= 250 then
  460.                                 circleColor = 0x00FF00
  461.                         else
  462.                                 circleColor = 0xFFFFFF
  463.                         end
  464.  
  465.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 28, circleColor)
  466.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 29, circleColor)
  467.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 30, circleColor)
  468.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 31, circleColor)
  469.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 32, circleColor)
  470.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 100, circleColor)
  471.                 end
  472.  
  473.              
  474.         end
  475.     SC__OnDraw()
  476.        
  477. end
  478.  
  479.  
  480. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement