Advertisement
Kevinkev

Based ;)

Sep 24th, 2013
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.71 KB | None | 0 0
  1. --[[
  2.  
  3. Based on a true story  (EZREAL-ASHE-DRAVEN Helper) 1.7
  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 GetGame().map.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 GetGame().map.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 = 1890,       spellDelay = 480},
  87.  }
  88.  
  89.  for i,championsArray in pairs(championsArray) do
  90.  if myHero.charName == championsArray.name then
  91.  ultiProjectileSpeed = championsArray.projSpeed
  92.  spellDelay          = championsArray.spellDelay
  93.  end
  94.  if myHero.charName == "Draven" then
  95.  globalDelay = 8000
  96.  end
  97.  end
  98.  
  99.  
  100.  ultiProjectileSpeed = myHero:GetSpellData(_R).missileSpeed
  101.  spellDelay = (250+(myHero:GetSpellData(_R).delayCastOffsetPercent * 1000 + 500) * 0.5)
  102.  
  103.  --HOTKEYS
  104.  ShootHK        =  32               --Change it if you wish
  105.  autoUltHK      =  string.byte("H") --Change it if you wish
  106.  manualUltHK    =  string.byte("J") --Change it if you wish
  107.  aimRecallHK    =  string.byte("K") --Change it if you wish
  108.  
  109.  --NumpadHotkeys
  110.  num1 = 97
  111.  num2 = 98
  112.  num3 = 99
  113.  num4 = 100
  114.  num5 = 101
  115.  num6 = 102
  116.  num7 = 103
  117.  num8 = 104
  118.  num9 = 105
  119.  
  120.  --OTHER
  121.  ultiShootDelay = 0
  122.  player = GetMyHero()
  123.  drawCircles = true
  124.  moveBuffer = 20 --To detect pressing B while moving.
  125.  
  126.  
  127.  
  128. HeroBackSpots = {
  129. {name, x, y, z, endTime, damageCheck},
  130. {name, x, y, z, endTime, damageCheck},
  131. {name, x, y, z, endTime, damageCheck},
  132. {name, x, y, z, endTime, damageCheck},
  133. {name, x, y, z, endTime, damageCheck}
  134. }
  135.  
  136.  --ShiftMenu
  137.     KCConfig = scriptConfig("EzrealAsheDraven Ult Helper", "autoUlti")
  138.  
  139.     KCConfig:addParam("Shoot", "Shoot", SCRIPT_PARAM_ONKEYDOWN, false, ShootHK)
  140.  
  141.  
  142.   PrintChat(">> ".. tostring(myHero.charName) .." Helper Loaded [Kevinkev]")
  143. end
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. function OnProcessSpell(object,spell)
  151.  
  152.     buffer = 500 --Champ dissapears after this buffer..
  153.     spellName = spell.name
  154.    
  155.  
  156. --
  157.        
  158.     if object~=nil and object.team ~= player.team  then
  159.     local Rdamage = getDmg("R",object,myHero)
  160.      if Rdamage > object.health then
  161.             damageParameter = true
  162.          --PrintChat("Dominion Recall: ".. object.name)  
  163.         if spell.name == "OdinRecall" then
  164.             --PrintChat("Dominion Recall")
  165.    
  166.             drawMeBacking(object, GetTickCount() + 4500 +buffer,damageParameter) --4.5 seconds for dominion
  167.    
  168.         elseif spell.name == "RecallImproved" then
  169.  
  170.             --PrintChat("Improved Recall")
  171.             drawMeBacking(object, GetTickCount() + 7000 +buffer,damageParameter) --7 Seconds for improved recall
  172.      
  173.         elseif spellName == "Recall" then
  174.    
  175.             --PrintChat("Normal Recall")
  176.             drawMeBacking(object, GetTickCount() +8000 +buffer,damageParameter) --8 Seconds for normal recall
  177.             end
  178.          
  179.          
  180.         end
  181.        
  182.     end
  183. end
  184.  
  185. function drawMeBacking(object,endTime,check)
  186.  
  187.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  188.         if HeroBackSpots.name == nil then
  189.        
  190.         HeroBackSpots.name      = object.name --Record the name & positions
  191.         HeroBackSpots.x         = object.x
  192.         HeroBackSpots.y         = object.y
  193.         HeroBackSpots.z         = object.z
  194.         HeroBackSpots.endTime   = endTime
  195.         HeroBackSpots.damageCheck = check
  196.         PrintChat(HeroBackSpots.name)
  197.         break --to avoid filling multiple entries
  198.         end
  199.     end
  200.  
  201. end
  202.  
  203. function checkMyRecall()
  204.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  205.         if GetTickCount() > (HeroBackSpots.endTime or 0) then
  206.             HeroBackSpots.name = nil --Delete the name (positions are now irrelephant)
  207.         end
  208.     end
  209. end
  210.  
  211. function mathStuff(x,y)
  212.  
  213. return math.floor(math.sqrt((x)^2 + (y)^2))
  214.  
  215. end
  216.  
  217. function moreMathStuff(x,y,z)
  218.  
  219. return mathStuff(z,mathStuff(x,y))
  220.  
  221. end
  222. function OnDeleteObj(object)
  223.     if object.name == "TeleportHome.troy" then
  224.  
  225.         for i,HeroBackSpots in pairs(HeroBackSpots) do
  226.         if HeroBackSpots.x ~= nil then
  227.        
  228.         --If within proximity
  229.             if math.floor(math.sqrt((HeroBackSpots.x)^2 + (HeroBackSpots.z)^2)) - math.floor(math.sqrt((object.x)^2 + (object.z)^2)) < moveBuffer then  
  230.             --And in the list of heroes
  231.                     for j = 1, heroManager.iCount, 1 do
  232.                     local enemyhero = heroManager:getHero(j)
  233.                         if HeroBackSpots.name == enemyhero.name then
  234.                             --This particular one is still visible
  235.                             if enemyhero.visible then
  236.                             --Then they cancelled their recall ;)
  237.                             HeroBackSpots.name = nil
  238.                             --So delete them from the list >:D
  239.                             break
  240.                             end
  241.                         end
  242.                     end
  243.             end
  244.         end
  245.         end
  246.     end
  247. end
  248. --No longer used
  249. function didTheyMove()
  250.     for j = 1, heroManager.iCount, 1 do
  251.         local enemyhero = heroManager:getHero(j)
  252.             for i,HeroBackSpots in pairs(HeroBackSpots) do
  253.             if HeroBackSpots.name == enemyhero.name then
  254.                
  255.                 if moveBuffer<mathStuff( mathStuff(HeroBackSpots.x - enemyhero.x, HeroBackSpots.y - enemyhero.y), HeroBackSpots.z - enemyhero.z) then
  256.                  
  257.                     HeroBackSpots.name = nil
  258.                 end
  259.                 end
  260.             end
  261.     end
  262. end
  263.  
  264.  
  265. function OnTick()
  266.  
  267. --didTheyMove()
  268.  
  269. checkMyRecall()
  270.  
  271. TheMagicHappens()
  272.    
  273.  
  274.  
  275. end
  276.  
  277. function theTimeisRightForRecall()
  278.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  279.         if HeroBackSpots.name ~= nil and HeroBackSpots.damageCheck then
  280.         Speed = ((mathStuff(player.x - HeroBackSpots.x, player.z - HeroBackSpots.z)/(ultiProjectileSpeed/1000)) + GetTickCount())
  281.             if (Speed <  HeroBackSpots.endTime - spellDelay - GetLatency()/2)  then
  282.                doIt(HeroBackSpots.x,HeroBackSpots.z)
  283.             end
  284.         end
  285.     end
  286. end
  287.  
  288. function theTimeisRight()
  289.     for i,HeroBackSpots in pairs(HeroBackSpots) do
  290.         if HeroBackSpots.name ~= nil and HeroBackSpots.damageCheck then
  291.         Speed = ((mathStuff(player.x - BaseSpots[aim].x, player.z - BaseSpots[aim].z)/(ultiProjectileSpeed/1000)) +   GetTickCount())
  292.             if (Speed >  HeroBackSpots.endTime - spellDelay - (GetLatency()/2)) and Speed - GetTickCount()  <= 8000 then
  293.                 doIt(BaseSpots[aim].x,BaseSpots[aim].z)
  294.             end
  295.         end
  296.     end
  297. end
  298.  
  299. function doIt(x,z)
  300.     --If delay is less than the one set.
  301.     if globalDelay < GetTickCount() then
  302.    
  303.     if myHero:CanUseSpell(_R) == READY then
  304.         CastSpell(_R,x,z)
  305.         if myHero.charName == "Draven" then
  306.         globalDelay = GetTickCount()+15000 --Because it will see that R can be used and it'll send the ulti back (1.5 bug fixed)
  307.         end
  308.        
  309.     end
  310.    
  311.    
  312.     end
  313.    
  314.  
  315. end
  316.  
  317. function TheMagicHappens()
  318.    
  319.     if autoUlt then
  320.         if aimRecall then
  321.         theTimeisRightForRecall()
  322.         end
  323.    
  324.         theTimeisRight()
  325.            
  326.     end
  327.     whoTarget()
  328.     if manualUlt then
  329.         if KCConfig.Shoot then
  330.  
  331.         if whoTarget() ~= 0 then
  332.         if whoTarget().visible then --if visible
  333.         doIt(whoTarget().x,whoTarget().z)
  334.         end
  335.         end
  336.         end
  337.     end
  338.        
  339. end
  340.  
  341. function whoTarget()
  342.  
  343.     for j = 1, heroManager.iCount, 1 do
  344.         local enemyhero = heroManager:getHero(j)
  345.         if ValidTarget(enemyhero) and enemyhero.dead == false and enemyhero.visible then
  346.         if lowestHP == nil then lowestHP = enemyhero end
  347.        
  348.         if enemyhero.health < lowestHP.health then
  349.         lowestHP = enemyhero
  350.         end        
  351.         end
  352.     end
  353.  
  354.     if lowestHP == nil then
  355.     return 0
  356.     else
  357.     return lowestHP
  358.     end
  359. end
  360.  
  361. function OnWndMsg(msg,key)
  362.     if key == manualUltHK then
  363.         if msg == KEY_DOWN then
  364.             if manualUlt then
  365.                 manualUlt = false
  366.                 PrintChat(">> Manual Timing OFF")
  367.             else
  368.                 manualUlt = true
  369.                 PrintChat(">> Manual Timing ON")
  370.             end
  371.         end
  372.     end
  373.    
  374.    
  375.    
  376.     if key == autoUltHK then
  377.         if msg == KEY_DOWN then
  378.             if autoUlt then
  379.                 autoUlt = false
  380.                 PrintChat(">> Auto Shoot Ultimate DISABLED")
  381.             else
  382.                 autoUlt = true
  383.                 PrintChat(">> Auto Shoot Ultimate ENABLED")
  384.             end
  385.         end
  386.     end
  387.    
  388.    
  389.     if key == aimRecallHK then
  390.         if msg == KEY_DOWN then
  391.             if aimRecall then
  392.                 aimRecall = false
  393.                 PrintChat(">> Aim recall location DISABLED")
  394.             else
  395.                 aimRecall = true
  396.                 PrintChat(">> Aim recall location ENABLED")
  397.             end
  398.         end
  399.     end
  400.    
  401.     --Numpad functions (not implemented)
  402.     if key == num2 then
  403.         if msg == KEY_DOWN then
  404.             if not aimnum2 then
  405.                 aimnum2 = true
  406.                 PrintChat(">> Aiming: Bots's Red")
  407.             else
  408.                 aimnum2 = false
  409.                 PrintChat(">> Not Aiming: Bots's Red ")
  410.             end
  411.         end
  412.     end
  413.    
  414.     if key == num3 then
  415.         if msg == KEY_DOWN then
  416.             if not aimnum3 then
  417.                 aimnum3 = true
  418.                 PrintChat(">> Aiming: Dragon")
  419.             else
  420.                 aimnum3 = false
  421.                 PrintChat(">> Not Aiming: Dragon ")
  422.             end
  423.         end
  424.     end
  425.    
  426.     if key == num4 then
  427.         if msg == KEY_DOWN then
  428.             if not aimnum4 then
  429.                 aimnum4 = true
  430.                 PrintChat(">> Aiming: Bots's Blue")
  431.             else
  432.                 aimnum4 = false
  433.                 PrintChat(">> Not Aiming: Bots's Blue ")
  434.             end
  435.         end
  436.     end
  437.    
  438.     if key == num5 then
  439.         if msg == KEY_DOWN then
  440.             if not objAimer then
  441.                 objAimer = true
  442.                 PrintChat(">> Objective Aimer ON")
  443.             else
  444.                 objAimer = false
  445.                 PrintChat(">> Objective Aimer OFF ")
  446.             end
  447.         end
  448.     end
  449.    
  450.     if key == num6 then
  451.         if msg == KEY_DOWN then
  452.             if not aimnum6 then
  453.                 aimnum6 = true
  454.                 PrintChat(">> Aiming: Tops's Blue")
  455.             else
  456.                 aimnum6 = false
  457.                 PrintChat(">> Not Aiming: Tops's Blue ")
  458.             end
  459.         end
  460.     end
  461.    
  462.     if key == num7 then
  463.         if msg == KEY_DOWN then
  464.             if not aimnum7 then
  465.                 aimnum7 = true
  466.                 PrintChat(">> Aiming: Baron")
  467.             else
  468.                 aimnum7 = false
  469.                 PrintChat(">> Not Aiming: Baron ")
  470.             end
  471.         end
  472.     end
  473.    
  474.     if key == num8 then
  475.         if msg == KEY_DOWN then
  476.             if not aimnum8 then
  477.                 aimnum8 = true
  478.                 PrintChat(">> Aiming: Top's Red")
  479.             else
  480.                 aimnum8 = false
  481.                 PrintChat(">> Not Aiming: Top's Red ")
  482.             end
  483.         end
  484.     end
  485.    
  486.    
  487. end
  488.  
  489.  
  490. function OnDraw()
  491.  
  492.         if manualUlt then
  493.         x,y = WorldToScreen(D3DXVECTOR3(player.x, player.y, player.z)) --gets the position on the screen
  494.  
  495.         if whoTarget() ~= 0 then
  496.         DrawText(tostring("Aiming: "..whoTarget().charName),15,x,y, 0xFF00FF00)
  497.         end
  498.         end
  499.  
  500.  
  501.         if drawCircles then
  502.                 for i,HeroBackSpots in pairs(HeroBackSpots) do
  503.                         if HeroBackSpots.name ~= nil then
  504.                             --Thanks Apple--
  505.                             text = math.round((HeroBackSpots.endTime - GetTickCount())/1000) --gets the timer in digits
  506.                             --Thanks gReY--
  507.                             x,y = WorldToScreen(D3DXVECTOR3(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z)) --gets the position on the screen
  508.                            
  509.                             DrawText("RECALL IN " ..text,22, x - 60, y + 80, 0xFF00FF00)
  510.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 28, circleColor)
  511.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 29, circleColor)
  512.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 30, circleColor)
  513.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 31, circleColor)
  514.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 32, circleColor)
  515.                             --I'd rather the circles get smaller Apple ;) time tick tick away~
  516.                             DrawCircle(HeroBackSpots.x, HeroBackSpots.y, HeroBackSpots.z, 15*text + 30, circleColor)
  517.                         end
  518.                 end
  519.                
  520.                 for i,BaseSpots in pairs(BaseSpots) do
  521.                         if GetDistance(BaseSpots, mousePos) <= 250 then
  522.                                 circleColor = 0x00FF00
  523.                         else
  524.                                 circleColor = 0xFFFFFF
  525.                         end
  526.  
  527.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 28, circleColor)
  528.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 29, circleColor)
  529.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 30, circleColor)
  530.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 31, circleColor)
  531.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 32, circleColor)
  532.                         DrawCircle(BaseSpots.x, BaseSpots.y, BaseSpots.z, 100, circleColor)
  533.                 end
  534.  
  535.  
  536.                 if objAimer then
  537.                 for i,BuffCamps in pairs(BuffCamps) do
  538.                        
  539.                         DrawCircle(BuffCamps.x, BuffCamps.y, BuffCamps.z, 28, circleColor)
  540.                         DrawCircle(BuffCamps.x, BuffCamps.y, BuffCamps.z, 29, circleColor)
  541.                         DrawCircle(BuffCamps.x, BuffCamps.y, BuffCamps.z, 30, circleColor)
  542.                         DrawCircle(BuffCamps.x, BuffCamps.y, BuffCamps.z, 31, circleColor)
  543.                         DrawCircle(BuffCamps.x, BuffCamps.y, BuffCamps.z, 32, circleColor)
  544.                         DrawCircle(BuffCamps.x, BuffCamps.y, BuffCamps.z, 100, circleColor)
  545.                 end
  546.                 end
  547.                
  548.              
  549.         end
  550.        
  551. end
  552.  
  553.  
  554. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement