16HeX16

Tristana Helper 1.2.1

Mar 30th, 2013
2,547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.10 KB | None | 0 0
  1. --[[    Tristana Helper by HeX 1.2.1
  2.  
  3. Hotkeys:
  4.     -Basic Combo: Space
  5.     -Harass(Toggle): Z
  6.     -Auto Jump(Toggle): X
  7.     -Auto Ult(Toggle): C
  8.     -Jump Ult Combo: G
  9.  
  10. Features:
  11.     -Basic Combo: Items-> W-> E-> Q-> R(If killable)
  12.     -Harass: E
  13.     -Jump Ult Combo: W(behind target)-> R
  14.     -Use ultimate in combo ON/OFF option in ingame menu.
  15.     -Auto Ignite in combo ON/OFF option in ingame menu.
  16.     -Item Support: Blade of the Ruined King, Bligewater Cutlass, Deathfire Grasp, Hextech Gunblade.
  17.    
  18. Explanation of the marks:
  19.     -Green circle: Marks the current target to which you will do the combo
  20.     -Blue circle: Killed with a combo, if all the skills were available
  21.     -Red circle: Killed using Items + 2 Hits + W + E + R + Ignite(if available)
  22.     -2 Red circles: Killed using Items + 1 Hit + W + E + Ignite(if available)
  23.     -3 Red circles: Killed using R 
  24. ]]
  25.  
  26. if myHero.charName ~= "Tristana" then return end
  27. --[[    Settings    ]]--
  28. local jumpBuffer = 200 --Distance behind target you will jump, Jump Ult combo. 200 by Default.
  29. local rDelay = 300 --Delay before using ultimate in Jump Combo. 300 by Default.
  30. local MinMana = 40 --Minimum amount of mana you need to use Q in combo(Percent) 40% by Default.
  31. --[[    Ranges  ]]--
  32. local Arange = 0
  33. local Wrange = 900
  34. local Erange = 0
  35. local Rrange = 700
  36. local Crange = 600
  37. --[[    Prediction  ]]--
  38. local wSpeed = 1.5
  39. local travelDuration = 0
  40. local ts
  41. --[[    Jump Combo  ]]--
  42. local jumpTick = 0
  43. local jumpDelay = 0
  44. local eUsed = false
  45. --[[    Attacks ]]--
  46. local nextTick = 0
  47. local lastBasicAttack = 0
  48. local startAttackSpeed = 0.625
  49. local swing = 0
  50. --[[    Damage Calculation  ]]--
  51. local calculationenemy = 1
  52. local killable = {}
  53. --[[    Items   ]]--
  54. local ignite = nil
  55. local QREADY, WREADY, EREADY, RREADY  = false, false, false, false
  56. local DFGREADY, BRKREADY, HXGREADY, BWCREADY = false, false, false, false
  57. local DFGSlot, BRKSlot, HXGSlot, BWCSlot = nil, nil, nil, nil
  58.  
  59. function OnLoad()
  60.     PrintChat("<font color='#CCCCCC'> >> Tristana Helper 1.2.1 loaded! <<</font>")
  61.     THConfig = scriptConfig("Tristana Helper", "TristanaHelper")
  62.     THConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  63.     THConfig:addParam("ultCombo", "Jump Ult Combo", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  64.     THConfig:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYTOGGLE, false, 90)
  65.     THConfig:addParam("autojump", "Jump when Killable", SCRIPT_PARAM_ONKEYTOGGLE, true, 88)
  66.     THConfig:addParam("autoult", "Ult when Killable", SCRIPT_PARAM_ONKEYTOGGLE, true, 67)
  67.     THConfig:addParam("autoignite", "Ignite when Killable", SCRIPT_PARAM_ONOFF, true)
  68.     THConfig:addParam("useR", "Use Ultimate in Combo", SCRIPT_PARAM_ONOFF, true)
  69.     THConfig:addParam("movement", "Basic Orb Walking", SCRIPT_PARAM_ONOFF, true)
  70.     THConfig:addParam("drawcirclesSelf", "Draw Circles - Self", SCRIPT_PARAM_ONOFF, false)
  71.     THConfig:addParam("drawcirclesEnemy", "Draw Circles - Enemy", SCRIPT_PARAM_ONOFF, false)
  72.     THConfig:permaShow("scriptActive")
  73.     THConfig:permaShow("ultCombo")
  74.     THConfig:permaShow("Harass")
  75.     THConfig:permaShow("autojump")
  76. --  THConfig:permaShow("autoult")
  77.    
  78.     ts = TargetSelector(TARGET_LOW_HP, Crange+150, DAMAGE_MAGIC)
  79.     ts.name = "Tristana"
  80.     THConfig:addTS(ts)
  81.    
  82.     Arange = 550 + ((myHero.level-1) * 9)
  83.     Erange = 625 + ((myHero.level-1) * 9)
  84.    
  85.     lastBasicAttack = os.clock()
  86.    
  87.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  88.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  89.     end
  90. end
  91.  
  92. function OnProcessSpell(unit, spell)
  93.     if unit.isMe and (spell.name:find("Attack") ~= nil) then
  94.         swing = 1
  95.         lastBasicAttack = os.clock()
  96.     end
  97. end
  98.  
  99. function OnTick()
  100.     ts:update()
  101.     Arange = 550 + ((myHero.level-1) * 9)
  102.     Erange = 625 + ((myHero.level-1) * 9)
  103.  
  104.     AttackDelay = 1/(myHero.attackSpeed*startAttackSpeed)
  105.     if swing == 1 and os.clock() > lastBasicAttack + AttackDelay then
  106.         swing = 0
  107.     end
  108.    
  109.     if tick == nil or GetTickCount()-tick>=100 then
  110.         tick = GetTickCount()
  111.         DmgCalculation()
  112.     end
  113.    
  114.     if ts.target ~= nil then
  115.         RDMG = getDmg("R",ts.target,myHero)
  116.     end
  117.    
  118.     DFGSlot, BRKSlot, HXGSlot, BWCSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144)
  119.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  120.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  121.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  122.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  123.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  124.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  125.     WREADY = (myHero:CanUseSpell(_W) == READY)
  126.     EREADY = (myHero:CanUseSpell(_E) == READY)
  127.     RREADY = (myHero:CanUseSpell(_R) == READY)
  128.  
  129.     --[[    Auto Ignite ]]--
  130.     if THConfig.autoignite then    
  131.         if IREADY then
  132.             local ignitedmg = 0    
  133.             for i = 1, heroManager.iCount, 1 do
  134.                 local enemyhero = heroManager:getHero(i)
  135.                 if ValidTarget(enemyhero,600) then
  136.                     ignitedmg = 50 + 20 * myHero.level
  137.                     if enemyhero.health <= ignitedmg then
  138.                         CastSpell(ignite, enemyhero)
  139.                     end
  140.                 end
  141.             end
  142.         end
  143.     end
  144.    
  145.     if ts.target ~= nil and not myHero.dead then
  146.         travelDuration = GetDistance(ts.target, myHero)/wSpeed
  147.         jumpDelay = travelDuration
  148.     end
  149.     if ts.target ~= nil and WREADY and travelDuration ~= nil then
  150.         predic = GetPredictionPos(ts.target, travelDuration)
  151.     end
  152.  
  153.     --[[    Auto Jump   ]]--
  154.     if THConfig.autojump and WREADY then
  155.         for i = 1, heroManager.iCount, 1 do
  156.             local Target = heroManager:getHero(i)
  157.             local wDamage = getDmg("W",Target,myHero)
  158.             if Target ~= nil and not myHero.dead then
  159.                 travelDuration = GetDistance(Target, myHero)/wSpeed
  160.                 jumpDelay = travelDuration
  161.                 predic = GetPredictionPos(Target, travelDuration)
  162.             end  
  163.             if predic ~= nil and ValidTarget(Target, Wrange) and Target.health < wDamage then
  164.                 CastSpell(_W, predic.x, predic.z)
  165.             end
  166.         end
  167.     end
  168.    
  169.     --[[    Ult Combo   ]]--
  170.     if ts.target ~= nil and THConfig.ultCombo then
  171.         local tickCount = GetTickCount()
  172.         if predic ~= nil then
  173.             TargetPos = Vector(predic.x, predic.y, predic.z)
  174.             MyPos = Vector(myHero.x, myHero.y, myHero.z)
  175.             JumpPos = TargetPos + (TargetPos-MyPos)*((jumpBuffer/GetDistance(ts.target)))
  176.         end
  177.         if JumpPos ~= nil and WREADY and GetDistance(JumpPos) < Wrange and not ts.target.dead and GetTickCount() > jumpTick and RREADY then
  178.             CastSpell(_W, JumpPos.x, JumpPos.z)
  179.             jumpTick = GetTickCount() + jumpDelay
  180.             eUsed = true
  181.         end
  182.         if not WREADY and RREADY and GetTickCount() > (jumpTick + rDelay) and eUsed == true then
  183.             CastSpell(_R, ts.target)
  184.             eUsed = false
  185.         end
  186.     end
  187.  
  188.     --[[    Auto Ult    ]]--
  189.     if THConfig.autoult and RREADY then
  190.         for i = 1, heroManager.iCount, 1 do
  191.             local Target = heroManager:getHero(i)
  192.             local rDamage = getDmg("R",Target,myHero)
  193.             if ValidTarget(Target, Rrange) and Target.health < rDamage then
  194.                 CastSpell(_R, Target)
  195.             end
  196.         end
  197.     end
  198.    
  199.     --[[    Harass  ]]--
  200.     if ts.target ~= nil and THConfig.Harass  then
  201.         if EREADY and GetDistance(ts.target) < Erange then
  202.             CastSpell(_E, ts.target)
  203.         end
  204.     end  
  205.  
  206.     --[[    Basic Combo ]]--
  207.     if ts.target ~= nil and THConfig.scriptActive and not ts.target.dead then
  208.         --[[    Items   ]]--
  209.         if GetDistance(ts.target) < Crange then
  210.             if DFGREADY then CastSpell(DFGSlot, ts.target) end
  211.             if BRKREADY then CastSpell(BRKSlot, ts.target) end
  212.             if HXGREADY then CastSpell(HXGSlot, ts.target) end
  213.             if BWCREADY then CastSpell(BWCSlot, ts.target) end
  214.         end
  215.         --[[    Abilities   ]]--
  216.         if predic ~= nil and WREADY and GetDistance(predic) < Wrange then
  217.             CastSpell(_W, predic.x, predic.z)
  218.         end
  219.         if THConfig.useR and RREADY and GetDistance(ts.target) < Rrange and ts.target.health < RDMG then
  220.             CastSpell(_R, ts.target)
  221.         end
  222.     --[[    Attacks ]]--
  223.         local tick = GetTickCount()
  224.         if swing == 0 then
  225.             if GetDistance(ts.target) < Arange and GetTickCount() > nextTick then
  226.                 myHero:Attack(ts.target)
  227.                 nextTick = GetTickCount()
  228.             end
  229.             elseif swing == 1 then
  230.             if QREADY and GetDistance(ts.target) < Arange and MinMana <= ((myHero.mana/myHero.maxMana)*100) then
  231.                 CastSpell(_Q)
  232.             end
  233.             if EREADY and GetDistance(ts.target) < Erange and GetTickCount() > (nextTick + 225) then
  234.                 CastSpell(_E, ts.target)
  235.                 swing = 0
  236.             end
  237.             if THConfig.movement and GetTickCount() > (nextTick + 250) then
  238.                 myHero:MoveTo(mousePos.x, mousePos.z)
  239.             end
  240.         end
  241.     end
  242. end
  243.  
  244. --[[
  245. Explanation of the marks:
  246.     -Green circle: Marks the current target to which you will do the combo
  247.     -Blue circle: Killed with a combo, if all the skills were available
  248.     -Red circle: Killed using Items + 2 Hits + W + E + R + Ignite(if available)
  249.     -2 Red circles: Killed using Items + 1 Hit + W + E + Ignite(if available)
  250.     -3 Red circles: Killed using R 
  251. ]]
  252. function DmgCalculation()
  253.     local enemy = heroManager:GetHero(calculationenemy)
  254.     if ValidTarget(enemy) then
  255.         local ignitedamage, dfgdamage, hxgdamage, bwcdamage, brkdamage = 0, 0, 0, 0, 0
  256.         local wdamage = getDmg("W",enemy,myHero)
  257.         local edamage = getDmg("E",enemy,myHero)
  258.         local rdamage = getDmg("R",enemy,myHero,1)
  259.         local hitdamage = getDmg("AD",enemy,myHero)
  260.         local ignitedamage = (ignite and getDmg("IGNITE",enemy,myHero) or 0)
  261.         local dfgdamage = (DFGSlot and getDmg("DFG",enemy,myHero) or 0)
  262.         local hxgdamage = (HXGSlot and getDmg("HXG",enemy,myHero) or 0)
  263.         local bwcdamage = (BWCSlot and getDmg("BWC",enemy,myHero) or 0)
  264.         local brkdamage = (BRKSlot and getDmg("RUINEDKING",enemy,myHero) or 0)
  265.         local combo1 = hitdamage*2 + wdamage + edamage + rdamage
  266.         local combo2 = hitdamage*2
  267.         local combo3 = hitdamage*1
  268.         local combo4 = 0
  269.     if WREADY then
  270.         combo2 = combo2 + wdamage
  271.         combo3 = combo3 + wdamage
  272.     end
  273.     if EREADY then
  274.         combo2 = combo2 + edamage
  275.         combo3 = combo3 + edamage
  276.     end
  277.     if RREADY then
  278.         combo2 = combo2 + rdamage
  279.         combo4 = combo4 + rdamage
  280.     end
  281.     if DFGREADY then
  282.         combo1 = combo1 + dfgdamage
  283.         combo2 = combo2 + dfgdamage
  284.         combo3 = combo3 + dfgdamage
  285.     end
  286.     if HXGREADY then
  287.         combo1 = combo1 + hxgdamage
  288.         combo2 = combo2 + hxgdamage
  289.         combo3 = combo3 + hxgdamage
  290.     end
  291.     if BWCREADY then
  292.         combo1 = combo1 + bwcdamage
  293.         combo2 = combo2 + bwcdamage
  294.         combo3 = combo3 + bwcdamage
  295.     end
  296.     if BRKREADY then
  297.         combo1 = combo1 + brkdamage
  298.         combo2 = combo2 + brkdamage
  299.         combo3 = combo3 + brkdamage
  300.     end
  301.     if IREADY then
  302.         combo1 = combo1 + ignitedamage
  303.         combo2 = combo2 + ignitedamage
  304.         combo3 = combo3 + ignitedamage
  305.     end
  306.     if combo4 >= enemy.health then killable[calculationenemy] = 4
  307.         elseif combo3 >= enemy.health then killable[calculationenemy] = 3
  308.         elseif combo2 >= enemy.health then killable[calculationenemy] = 2
  309.         elseif combo1 >= enemy.health then killable[calculationenemy] = 1
  310.         else killable[calculationenemy] = 0 end
  311.     end
  312.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  313.             else calculationenemy = calculationenemy-1
  314.         end
  315. end
  316.  
  317. function OnDraw()  
  318.     if THConfig.drawcirclesSelf and not myHero.dead then
  319.         DrawCircle(myHero.x, myHero.y, myHero.z, Wrange, 0x00FF00)
  320.         DrawCircle(myHero.x, myHero.y, myHero.z, Erange, 0x00FFFF)
  321.     end
  322.     if ts.target ~= nil and THConfig.drawcirclesEnemy then
  323.         for j=0, 10 do
  324.             DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  325.         end
  326.     end
  327.     for i=1, heroManager.iCount do
  328.         local enemydraw = heroManager:GetHero(i)
  329.         if ValidTarget(enemydraw) then
  330.             if THConfig.drawcirclesEnemy then
  331.                 if killable[i] == 1 then
  332.                     for e=0, 15 do
  333.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0x0000FF)
  334.                     end
  335.                     elseif killable[i] == 2 then
  336.                     for e=0, 10 do
  337.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  338.                     end
  339.                     elseif killable[i] == 3 then
  340.                     for e=0, 10 do
  341.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  342.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + e*1.5, 0xFF0000)
  343.                     end
  344.                     elseif killable[i] == 4 then
  345.                     for e=0, 10 do
  346.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  347.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + e*1.5, 0xFF0000)
  348.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + e*1.5, 0xFF0000)
  349.                     end
  350.                 end
  351.             end
  352.         end
  353.     end
  354. end
Advertisement
Add Comment
Please, Sign In to add comment