Advertisement
Guest User

Thresh-v1.0.lua

a guest
Mar 27th, 2013
679
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.52 KB | None | 0 0
  1. --[[            
  2.  
  3.             Thresh the beast v1.0
  4.             -- Grabbed 99% code from the Blitz script by burn
  5.                     - Modded to work for Thresh by xkjtx
  6.  
  7.             - Features:
  8.                 - Combo (spells will cast only in range) Q-E-R and it will try to AA when
  9.                     ever possible.
  10.                 - Harass will harass with Q and if Q hits then it will E-Auto-Attack
  11.  
  12.                 - Damage calculation, for combos you could do to kill the target. It will
  13.                     display red circles and text.
  14.  
  15.                 -- Todo:
  16.                     - Auto kill with E or R (maybe even Q.. :-))
  17.                     -
  18.  
  19. ]]
  20.  
  21. if myHero.charName ~= "Thresh" then return end
  22.  
  23.     local player = GetMyHero()
  24.     local playing_AD = true --<-- CHANGE THIS TO 'true' IF YOU WANT TO PLAY AD OR TO 'false' IF PLAYING AP <------------- <------------- <-------------
  25.     local attackrange = 475
  26.     local qrange = 1025 -- lowered to stop missing..
  27.     local wrange = 950
  28.     local erange = 375
  29.     local ultirange = 450
  30.     local waittxt = {}
  31.     local floattext = {"Skills are not available","Able to fight","Killable","Murder Now!"}
  32.     local killable = {}
  33.     local calculationenemy = 1
  34.     local ignite = nil
  35.     local SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil
  36.     local QREADY, WREADY, EREADY, RREADY, IREADY = false, false, false, false, false
  37.     -- better Q prediction
  38.     local delay = 250
  39.     local qspeed = 1.525
  40.     local travelDuration = 600
  41.  
  42.     -- hot keys
  43.     local comboKey = 32 -- Space Bar
  44.     local grabKey = string.byte("S") -- letter S
  45.     local useUltKey = string.byte("X") -- letter X
  46.     local moveKey = string.byte("V") -- letter V
  47.     local minionCol = string.byte("U") -- letter U
  48.    
  49.     function OnLoad()
  50.         PrintChat(">> Thresh Combo 1.0 loaded!")
  51.         ThreConfig = scriptConfig("Thresh", "threshcombo")
  52.         ThreConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, comboKey)
  53.         ThreConfig:addParam("grabQ", "Grab Q", SCRIPT_PARAM_ONKEYDOWN, false, grabKey) -- S
  54.         ThreConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  55.         ThreConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  56.         ThreConfig:addParam("useUlti", "Toggle Use Ultimate in Combo", SCRIPT_PARAM_ONKEYTOGGLE, true, useUltKey) -- X
  57.         ThreConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, false) -- Of by default(I use my own)
  58.         ThreConfig:addParam("MoveToMouse", "Move to Mouse: Hot Key toggle", SCRIPT_PARAM_ONKEYTOGGLE, false, moveKey) -- V -- Off by default(will only work with harass)(when On, Nautilus will not AA while moving, but will cast all spells)
  59.         ThreConfig:addParam("checkCollision", "Use minion collision", SCRIPT_PARAM_ONKEYTOGGLE, false, minionCol) -- U -- off by default(FPS DROP) (when off it will grab minions in the way so watch out)
  60.         ThreConfig:permaShow("scriptActive")
  61.         ThreConfig:permaShow("grabQ")
  62.         ThreConfig:permaShow("useUlti")
  63.         ThreConfig:permaShow("MoveToMouse")
  64.         ThreConfig:permaShow("checkCollision")
  65.         if playing_AD == true then
  66.             ts = TargetSelector(TARGET_LOW_HP,qrange,DAMAGE_PHYSICAL)
  67.         else
  68.             ts = TargetSelector(TARGET_LOW_HP,qrange,DAMAGE_MAGIC)
  69.         end
  70.         ts.name = "Thresh"
  71.         ThreConfig:addTS(ts)
  72.         if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  73.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  74.         for i=1, heroManager.iCount do waittxt[i] = i*3 end
  75.     end
  76.  
  77.     function OnTick()
  78.         ts:update()
  79.  
  80.         if myHero.dead then return end
  81.  
  82.         if ts.target ~= nil then
  83.             travelDuration = (delay + GetDistance(myHero, ts.target)/qspeed)
  84.         end
  85.  
  86.         ts:SetPrediction(travelDuration)
  87.  
  88.         if (ts.target ~= nil or myHero:CanUseSpell(_Q) == READY) then predic = ts.nextPosition end
  89.  
  90.         SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  91.         QREADY = (myHero:CanUseSpell(_Q) == READY)
  92.         WREADY = (myHero:CanUseSpell(_W) == READY)
  93.         EREADY = (myHero:CanUseSpell(_E) == READY)
  94.         RREADY = (myHero:CanUseSpell(_R) == READY)
  95.         IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  96.  
  97.         if tick == nil or GetTickCount()-tick>=100 then
  98.             tick = GetTickCount()
  99.             SCDmgCalculation()
  100.         end
  101.  
  102.         if ThreConfig.MoveToMouse and ThreConfig.grabQ then
  103.             player:MoveTo(mousePos.x, mousePos.z) -- move to mouse(when On, Nautilus will not AA while moving, but will cast all spells)
  104.         end
  105.  
  106.         if ThreConfig.autoignite then    
  107.                 if IREADY then
  108.                         local ignitedmg = 0    
  109.                         for j = 1, heroManager.iCount, 1 do
  110.                                 local enemyhero = heroManager:getHero(j)
  111.                                 if ValidTarget(enemyhero,600) then
  112.                                         ignitedmg = 50 + 20 * myHero.level
  113.                                         if enemyhero.health <= ignitedmg then
  114.                                                 CastSpell(ignite, enemyhero)
  115.                                         end
  116.                                 end
  117.                         end
  118.                 end
  119.         end
  120.  
  121.         if ThreConfig.grabQ and ts.target ~= nil then
  122.             if ThreConfig.checkCollision and predic ~= nil and QREADY and GetDistance(ts.target) <= qrange and not GetMinionCollision(myHero,ts.nextPosition, 180) then
  123.                 CastSpell(_Q, predic.x, predic.z)
  124.             elseif not ThreConfig.checkCollision and predic ~= nil and QREADY and GetDistance(ts.target) <= qrange then
  125.                 CastSpell(_Q, predic.x, predic.z)
  126.             end
  127.             if (EREADY or WREADY) and GetDistance(ts.target) <= wrange then
  128.                 CastSpell(_E, mousePos.x, mousePos.z)
  129.                 --CastSpell(_W)
  130.                 myHero:Attack(ts.target)
  131.             end
  132.         end
  133.  
  134.         if ThreConfig.scriptActive then
  135.             if ts.target ~= nil then
  136.                 if ThreConfig.checkCollision and predic ~= nil and QREADY and GetDistance(ts.target) <= qrange and not GetMinionCollision(myHero,ts.nextPosition, 180) then
  137.                     CastSpell(_Q, predic.x, predic.z)
  138.                 elseif not ThreConfig.checkCollision and predic ~= nil and QREADY and GetDistance(ts.target) <= qrange then
  139.                     CastSpell(_Q, predic.x, predic.z)
  140.                 end
  141.                 if EREADY and GetDistance(ts.target) <= erange then
  142.                     CastSpell(_E, ts.target.x, ts.target.z)
  143.                 end
  144.                 --if WREADY and GetDistance(ts.target) <= wrange then
  145.                     --CastSpell(_W)
  146.                 --end
  147.                 if GetDistance(ts.target) <= attackrange then
  148.                     myHero:Attack(ts.target)
  149.                 end
  150.                 if ThreConfig.useUlti and RREADY and GetDistance(ts.target) < ultirange then
  151.                     CastSpell(_R, ts.target)
  152.                 end
  153.             end
  154.         end
  155.     end
  156.      
  157.     function SCDmgCalculation()
  158.         local enemy = heroManager:GetHero(calculationenemy)
  159.         if ValidTarget(enemy) then
  160.             local ignitedamage, Sheendamage, Trinitydamage = 0, 0, 0
  161.             local qdamage = getDmg("Q",enemy,myHero)
  162.             local edamage = getDmg("E",enemy,myHero)
  163.             local rdamage = getDmg("R",enemy,myHero,1)
  164.             local hitdamage = getDmg("AD",enemy,myHero)
  165.             local ignitedamage = (ignite and getDmg("IGNITE",enemy,myHero) or 0)
  166.             local Sheendamage = (SheenSlot and getDmg("SHEEN",enemy,myHero) or 0)
  167.             local Trinitydamage = (TrinitySlot and getDmg("TRINITY",enemy,myHero) or 0)
  168.             local combo1 = hitdamage*2 + qdamage + edamage + rdamage + Sheendamage + Trinitydamage
  169.             local combo2 = hitdamage*2 + Sheendamage + Trinitydamage
  170.             local combo3 = hitdamage*1 + Sheendamage + Trinitydamage
  171.             local combo4 = 0
  172.             if QREADY then
  173.                 combo2 = combo2 + qdamage
  174.                 combo3 = combo3 + qdamage
  175.             end
  176.             if EREADY then
  177.                 combo2 = combo2 + edamage
  178.                 combo3 = combo3 + edamage
  179.             end
  180.             if RREADY then
  181.                 combo2 = combo2 + rdamage
  182.                 combo4 = combo4 + rdamage
  183.             end
  184.             if IREADY then
  185.                 combo1 = combo1 + ignitedamage
  186.                 combo2 = combo2 + ignitedamage
  187.                 combo3 = combo3 + ignitedamage
  188.             end
  189.             if combo4 >= enemy.health then killable[calculationenemy] = 4
  190.             elseif combo3 >= enemy.health then killable[calculationenemy] = 3
  191.             elseif combo2 >= enemy.health then killable[calculationenemy] = 2
  192.             elseif combo1 >= enemy.health then killable[calculationenemy] = 1
  193.             else killable[calculationenemy] = 0 end
  194.         end
  195.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  196.         else calculationenemy = calculationenemy-1 end
  197.     end
  198.      
  199.     function OnDraw()
  200.         if ThreConfig.drawcircles and not myHero.dead then
  201.             DrawCircle(myHero.x, myHero.y, myHero.z, attackrange, 0xCCFF99)
  202.             DrawCircle(myHero.x, myHero.y, myHero.z, qrange, 0xCCFF33)
  203.             DrawCircle(myHero.x, myHero.y, myHero.z, ultirange, 0xFF6600)
  204.             if ts ~= nil and ts.target ~= nil then
  205.                 for j=0, 10 do
  206.                     DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  207.                 end
  208.             end
  209.             for i=1, heroManager.iCount do
  210.             local enemydraw = heroManager:GetHero(i)
  211.             if ValidTarget(enemydraw) then
  212.                 if ThreConfig.drawcircles then
  213.                     if killable[i] == 1 then
  214.                         for j=0, 20 do
  215.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  216.                         end
  217.                     elseif killable[i] == 2 then
  218.                         for j=0, 10 do
  219.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  220.                         end
  221.                     elseif killable[i] == 3 then
  222.                         for j=0, 10 do
  223.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  224.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  225.                         end
  226.                     elseif killable[i] == 4 then
  227.                         for j=0, 10 do
  228.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  229.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  230.                             DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  231.                         end
  232.                     end
  233.                 end
  234.                 if ThreConfig.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  235.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  236.                 end
  237.             end
  238.             if waittxt[i] == 1 then waittxt[i] = 30
  239.             else waittxt[i] = waittxt[i]-1 end
  240.             end
  241.         end
  242.     end
  243.        
  244.     function OnSendChat(msg)
  245.         ts:OnSendChat(msg, "pri")
  246.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement