Advertisement
H3stia

Tristana.lua

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