16HeX16

Udyr Helper 2.1

Mar 30th, 2013
2,201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.98 KB | None | 0 0
  1. --[[    Udyr Helper 2.1 by HeX
  2.  
  3. Big thanks to: jbman for giving me his unfinished Udyr code which i used as a base.
  4.  
  5.  
  6. Features:
  7.     -Stun Cycle: E-> Stun all nearby enemies
  8.     -Proc Combo: Q-> AA-> Q-> AA (Will wait for cooldown before using attacks)
  9.     -Tiger Combo: Items-> E-> Q
  10.     -Turtle Mode: Items-> E-> W
  11.     -Phoenix Combo: Items-> E-> R
  12.     -Auto ignite killable enemy ON/OFF option in ingame menu.
  13.     -Item Support: Blade of the Ruined King, Bligewater Cutlass, Deathfire Grasp, Hextech Gunblade, Tiamat, Ravenous Hydra, Randuins Omen, Sword of the Divine.
  14. ]]
  15.  
  16. if myHero.charName ~= "Udyr" then return end
  17.  
  18. --[[--(Code)--]]--
  19. local ts
  20. local range = 600
  21. local stunTarget = nil
  22. --[[--(Stances)--]]--
  23. local qCast = 0
  24. local lastTigerStance = 0
  25. --[[--(Attacks)--]]--
  26. local lastBasicAttack = 0
  27. local swingDelay = 0.1
  28. local swing = 0
  29. --[[--(Waits)--]]--
  30. local nextTick = 0
  31. local waitDelay = 400
  32. local Tick = 0
  33. --[[--(Ready)--]]--
  34. local ignite = nil
  35. local QREADY, WREADY, EREADY, RREADY = false, false, false, false
  36. local BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot, STDSlot = nil, nil, nil, nil, nil, nil, nil, nil
  37. local BRKREADY, DFGREADY, HXGREADY, BWCREADY, TMTREADY, RAHREADY, RNDREADY, STDREADY = false, false, false, false, false, false, false, false
  38.  
  39. function OnLoad()
  40.     --[[--(PrintChats)--]]--
  41.     PrintChat("<font color='#CCCCCC'> >> Udyr Helper 2.0 loaded! <<</font>")
  42.     PrintChat("<font color='#CCCCCC'> >> Press 0 to check hotkeys  <<</font>")
  43.     --[[--(Config)--]]--
  44.     UHConfig = scriptConfig("Udyr Helper", "UdyrHelper")
  45.     UHConfig:addParam("StunCycle", "Stun Cycle", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  46.     UHConfig:addParam("ProcCombo", "Double Proc - Tiger", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  47.     UHConfig:addParam("TigerCombo", "Combo - Tiger", SCRIPT_PARAM_ONKEYDOWN, false, 90)
  48.     UHConfig:addParam("TurtleCombo", "Combo - Turtle", SCRIPT_PARAM_ONKEYDOWN, false, 88)
  49.     UHConfig:addParam("PhoenixCombo", "Combo - Phoenix", SCRIPT_PARAM_ONKEYDOWN, false, 67)
  50.     UHConfig:addParam("Help", "Show Help", SCRIPT_PARAM_ONKEYDOWN, false, 48)
  51.     UHConfig:addParam("autoignite", "Auto Ignite killable", SCRIPT_PARAM_ONOFF, true)
  52.     UHConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, false)
  53.     UHConfig:permaShow("StunCycle")
  54.     UHConfig:permaShow("ProcCombo")
  55.     UHConfig:permaShow("TigerCombo")
  56.     UHConfig:permaShow("TurtleCombo")
  57.     UHConfig:permaShow("PhoenixCombo")
  58.    
  59.     ts = TargetSelector(TARGET_LOW_HP, range, DAMAGE_MAGIC)
  60.     ts.name = "Udyr"
  61.     UHConfig:addTS(ts)
  62.     Tick = os.clock()
  63.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  64.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  65.     end
  66. end
  67.  
  68. function OnTick()
  69.     ts:update()
  70.    
  71.     if UHConfig.Help then
  72.         PrintHelp()
  73.     end
  74.     if swing == 1 and os.clock() > lastBasicAttack + 0.5 then
  75.         swing = 0
  76.     end
  77.  
  78.  --[[--(Ready)--]]--
  79.     BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot, STDSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3077), GetInventorySlotItem(3074), GetInventorySlotItem(3143), GetInventorySlotItem(3131)
  80.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  81.     WREADY = (myHero:CanUseSpell(_W) == READY)
  82.     EREADY = (myHero:CanUseSpell(_E) == READY)
  83.     RREADY = (myHero:CanUseSpell(_R) == READY)
  84.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  85.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  86.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  87.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  88.     TMTREADY = (TMTSlot ~= nil and myHero:CanUseSpell(TMTSlot) == READY)
  89.     RAHREADY = (RAHSlot ~= nil and myHero:CanUseSpell(RAHSlot) == READY)
  90.     RNDREADY = (RNDSlot ~= nil and myHero:CanUseSpell(RNDSlot) == READY)
  91.     STDREADY = (STDSlot ~= nil and myHero:CanUseSpell(STDSlot) == READY)
  92.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  93.    
  94.     --[[--(Ignite)--]]--   
  95.     if UHConfig.autoignite then
  96.         if IREADY then
  97.             local ignitedmg = 0    
  98.             for i = 1, heroManager.iCount, 1 do
  99.                 local enemyhero = heroManager:getHero(i)
  100.                 if ValidTarget(enemyhero,600) then
  101.                     ignitedmg = 50 + 20 * myHero.level
  102.                     if enemyhero.health <= ignitedmg then
  103.                         CastSpell(ignite, enemyhero)
  104.                     end
  105.                 end
  106.             end
  107.         end
  108.     end
  109.    
  110.     --[[--(Items)--]]--
  111.     if ts.target ~= nil and (UHConfig.TigerCombo or UHConfig.PhoenixCombo or UHConfig.TurtleCombo) then
  112.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  113.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  114.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  115.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  116.         if STDREADY and GetDistance(ts.target) < 275 then CastSpell(STDSlot) end
  117.         if TMTREADY and GetDistance(ts.target) < 275 then CastSpell(TMTSlot) end
  118.         if RAHREADY and GetDistance(ts.target) < 275 then CastSpell(RAHSlot) end
  119.         if RNDREADY and GetDistance(ts.target) < 275 then CastSpell(RNDSlot) end
  120.  
  121.         if GetDistance(ts.target) < range then
  122.             myHero:Attack(ts.target)
  123.         end
  124.     end
  125.    
  126. --------------------------------------------(Combos)-------------------------------------------
  127.     --[[--(Proc Combo)--]]--
  128.     QTimer = 6 + (6*myHero.cdr)
  129.   if UHConfig.ProcCombo then
  130.         if QREADY and qCast == 0 then
  131.             CastSpell(_Q)
  132.         end
  133.         if ts.target ~= nil then
  134.             if qCast == 1 and os.clock() - lastTigerStance > QTimer then
  135.                 if swing == 0 then        
  136.                     myHero:Attack(ts.target)
  137.                     elseif swing == 1 then    
  138.                     if QREADY and os.clock() - lastBasicAttack > swingDelay then            
  139.                         CastSpell(_Q)
  140.                         swing = 0
  141.                     end
  142.                 end
  143.             end
  144.         end
  145.   end
  146.    
  147.     --[[--(Stun Cycle)--]]--
  148.     if UHConfig.StunCycle then
  149.         stunTarget = findClosestEnemy()
  150.         if stunTarget ~= nil and GetDistance(stunTarget) <= range then
  151.             if EREADY and not Bear then
  152.                 CastSpell(_E)
  153.             end
  154.             if Bear then
  155.                 myHero:Attack(stunTarget)
  156.             end
  157.         end
  158.     end
  159.    
  160.  
  161.     --[[--(Tiger Combo)--]]--
  162.   if UHConfig.TigerCombo and ts.target ~= nil then
  163.         if EREADY and not QREADY and not (Bear or TargetHaveBuff("udyrbearstuncheck", ts.target)) then
  164.             CastSpell(_E)
  165.             swing = 0
  166.         end
  167.         if QREADY then
  168.             CastSpell(_Q)
  169.             swing = 0
  170.         end
  171.   end
  172.    
  173.     --[[--(Phoenix Combo)--]]--
  174.   if UHConfig.PhoenixCombo and ts.target ~= nil then
  175.         if EREADY and not (Bear or TargetHaveBuff("udyrbearstuncheck", ts.target)) then
  176.             CastSpell(_E)
  177.             swing = 0
  178.         end
  179.         if RREADY and not Phoenix and TargetHaveBuff("udyrbearstuncheck", ts.target) then
  180.             CastSpell(_R)
  181.             swing = 0
  182.         end
  183.   end
  184.  
  185.     --[[--(Turtle Combo)--]]--
  186.   if UHConfig.TurtleCombo and ts.target ~= nil then
  187.         if EREADY and not (Bear or TargetHaveBuff("udyrbearstuncheck", ts.target)) then
  188.             CastSpell(_E)
  189.             swing = 0
  190.         end
  191.         if WREADY and TargetHaveBuff("udyrbearstuncheck", ts.target) then
  192.             CastSpell(_W)
  193.             swing = 0
  194.         end
  195.   end
  196. end
  197.  
  198. function OnDraw()
  199.     if UHConfig.drawcircles then
  200.         if ts.target ~= nil then
  201.             for j=0, 10 do DrawCircle(ts.target.x,ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
  202.         end
  203.         if stunTarget ~= nil and not stunTarget.dead and not myHero.dead then
  204.             for j=0, 10 do DrawCircle(stunTarget.x,stunTarget.y,stunTarget.z, 80 +j*1.5, 0x7A24DB) end
  205.         end
  206.         if not myHero.dead then
  207.             DrawCircle(myHero.x, myHero.y, myHero.z, range, 0x00FF00)
  208.         end
  209.     end
  210. end
  211.  
  212. function OnProcessSpell(unit, spell)
  213.   if unit.isMe then
  214.         if spell and spell.name:find("Attack") then
  215.             swing = 1
  216.             qCast = 0
  217.             lastBasicAttack = os.clock()
  218.         end
  219.         if spell and spell.name:find("TigerStance") then
  220.             Tiger = true
  221.             Turtle = false
  222.             Bear = false
  223.             Phoenix = false
  224.             qCast = 1
  225.             lastTigerStance = os.clock()
  226.         end
  227.         if spell and spell.name:find("TurtleStance") then
  228.             Tiger = false
  229.             Turtle = true
  230.             Bear = false
  231.             Phoenix = false
  232.         end
  233.         if spell and spell.name:find("BearStance") then
  234.             Tiger = false
  235.             Turtle = false
  236.             Bear = true
  237.             Phoenix = false
  238.         end
  239.         if spell and spell.name:find("PhoenixStance") then    
  240.             Tiger = false
  241.             Turtle = false
  242.             Bear = false
  243.             Phoenix = true
  244.         end
  245.     end
  246. end
  247.  
  248. function PrintHelp()
  249.     local tick = GetTickCount()
  250.     if GetTickCount() > nextTick then
  251.         PrintChat("<font color='#CCCCCC'> >> Udyr Hotkeys <<</font>")
  252.         PrintChat(">> Spacebar - Stun Cycle")
  253.         PrintChat(">> G - Double Tiger Procs")
  254.         PrintChat(">> Z - Tiger Combo")
  255.         PrintChat(">> X - Turtle Combo")
  256.         PrintChat(">> C - Phoenix Combo")
  257.         nextTick = GetTickCount() + waitDelay  
  258.     end
  259. end
  260.  
  261. function findClosestEnemy()
  262.     local closestEnemy = nil
  263.     local currentEnemy = nil
  264.     for i=1, heroManager.iCount do
  265.         currentEnemy = heroManager:GetHero(i)
  266.         if currentEnemy.team ~= myHero.team and not currentEnemy.dead and currentEnemy.visible and GetDistance(currentEnemy) < range and not TargetHaveBuff("udyrbearstuncheck", currentEnemy) then
  267.             if closestEnemy == nil then
  268.                 closestEnemy = currentEnemy
  269.                 elseif GetDistance(currentEnemy) < GetDistance(closestEnemy) then
  270.                     closestEnemy = currentEnemy
  271.             end
  272.         end
  273.     end
  274. return closestEnemy
  275. end
Advertisement
Add Comment
Please, Sign In to add comment