16HeX16

JarvanIV Helper Vadash Update

Jun 6th, 2013
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.37 KB | None | 0 0
  1. --[[    Jarvan Helper by HeX/Vadash  ]]--
  2. if myHero.charName ~= "JarvanIV" then return end
  3. --[[    Ranges  ]]--
  4. local wRange = 600
  5. local eDelay = 200 --[[Q cast delay (200 ms), cant lower it]] + 0 --[[E cast delay (200 ms), but we cast Q right after E, before flag lands]] + 0 --[[overshoot 0..50 ms]]
  6. local eBuffer = 50
  7. local Range = 850
  8. local QRange = 770
  9. --[[    Code    ]]--
  10. local Dstandard
  11. local ignite = nil
  12. local QREADY, WREADY, EREADY = false, false, false
  13. local BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot = nil, nil, nil, nil, nil, nil, nil
  14. local BRKREADY, DFGREADY, HXGREADY, BWCREADY, TMTREADY, RAHREADY, RNDREADY = false, false, false, false, false, false, false
  15. --[[    Attacks ]]--
  16. local lastBasicAttack = 0
  17. local swing = 0
  18. local startAttackSpeed = 0.658
  19. local nextTick = 0
  20. local tpE = TargetPredictionVIP(Range, math.huge, eDelay/1000, eBuffer) --range, speed, delay, width
  21.  
  22. function OnProcessSpell(unit, spell)
  23.     if unit.isMe and (spell.name:find("Attack") ~= nil) then
  24.         swing = 1
  25.         lastBasicAttack = GetTickCount()
  26.     end
  27. end
  28.  
  29. function OnLoad()
  30.     PrintChat("<font color='#CCCCCC'> >> Jarvan Helper 1.1.7+ loaded! <<</font>")
  31.     JHConfig = scriptConfig("Jarvan Helper", "JarvanHelper")
  32.     JHConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  33.     JHConfig:addParam("escape", "Escape Mode", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  34.     JHConfig:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, 90)
  35.     JHConfig:addParam("qKillsteal", "KS with Q", SCRIPT_PARAM_ONOFF, true)
  36.     JHConfig:addParam("mouseCombo", "Aim at mouse in Combo", SCRIPT_PARAM_ONOFF, false)
  37.     JHConfig:addParam("autoignite", "Auto Ignite Killable", SCRIPT_PARAM_ONOFF, true)
  38.     JHConfig:addParam("drawcirclesSelf", "Draw Circles - Self", SCRIPT_PARAM_ONOFF, false)
  39.     JHConfig:addParam("drawcirclesEnemy", "Draw Circles - Enemy", SCRIPT_PARAM_ONOFF, false)
  40.     JHConfig:permaShow("scriptActive")
  41.     JHConfig:permaShow("Harass")
  42.     ts = TargetSelector(TARGET_LOW_HP, Range+50, DAMAGE_PHYSICAL)
  43.     ts.name = "JarvanIV"
  44.     JHConfig:addTS(ts)
  45.  
  46.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  47.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  48.     end
  49. end
  50.  
  51. function getAttackSpeed()
  52.     return myHero.attackSpeed/(1/startAttackSpeed)
  53. end
  54.  
  55. function getAttackDelay()
  56.     return (1000 * ( -0.375 + (0.625 / startAttackSpeed))) / getAttackSpeed()
  57. end
  58.  
  59. function OnTick()
  60.     local AttackDelay = getAttackDelay()
  61.     if swing == 1 and GetTickCount() > lastBasicAttack + AttackDelay then
  62.         swing = 0
  63.     end
  64.  
  65.     ts:update()
  66.     BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3077), GetInventorySlotItem(3074),  GetInventorySlotItem(3143)
  67.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  68.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  69.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  70.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  71.     TMTREADY = (TMTSlot ~= nil and myHero:CanUseSpell(TMTSlot) == READY)
  72.     RAHREADY = (RAHSlot ~= nil and myHero:CanUseSpell(RAHSlot) == READY)
  73.     RNDREADY = (RNDSlot ~= nil and myHero:CanUseSpell(RNDSlot) == READY)
  74.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  75.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  76.     WREADY = (myHero:CanUseSpell(_W) == READY)
  77.     EREADY = (myHero:CanUseSpell(_E) == READY)
  78.  
  79.     --[[    Auto Ignite     ]]--
  80.     if JHConfig.autoignite then    
  81.         if IREADY then
  82.             local ignitedmg = 0    
  83.             for i = 1, heroManager.iCount, 1 do
  84.                 local enemyhero = heroManager:getHero(i)
  85.                 if ValidTarget(enemyhero,600) then
  86.                     ignitedmg = 50 + 20 * myHero.level
  87.                     if enemyhero.health <= ignitedmg then
  88.                         CastSpell(ignite, enemyhero)
  89.                     end
  90.                 end
  91.             end
  92.         end
  93.     end
  94.    
  95.     --[[ Q Killsteal    ]]--
  96.     if JHConfig.qKillsteal then    
  97.         if QREADY then
  98.             local qDmg = 0    
  99.             for i = 1, heroManager.iCount, 1 do
  100.                 local enemyhero = heroManager:getHero(i)
  101.                 if ValidTarget(enemyhero, QRange) then
  102.                     qDmg = getDmg("Q", enemyhero, myHero)
  103.                     if enemyhero.health <= qDmg then
  104.                         predic = tpE:GetPrediction(enemyhero)
  105.                         hc = tpE:GetHitChance(enemyhero)
  106.                         if predic ~= nil and hc > 0.5 then CastSpell(_Q, predic.x, predic.z) end
  107.                     end
  108.                 end
  109.             end
  110.         end
  111.     end
  112.    
  113.     --[[    Prediction      ]]--
  114.     if ts.target ~= nil and ValidTarget(ts.target) then
  115.         predic = tpE:GetPrediction(ts.target)
  116.         hc = tpE:GetHitChance(ts.target)
  117.     end
  118.     if predic ~= nil and hc > 0.5 and not myHero.dead and ts.target ~= nil and ValidTarget(ts.target) then
  119.         TargetPos = Vector(predic.x, predic.y, predic.z)
  120.         MyPos = Vector(myHero.x, myHero.y, myHero.z)
  121.         TruePos = TargetPos + (TargetPos-MyPos)*((eBuffer/GetDistance(ts.target)))
  122.     end
  123.  
  124.     --[[    Harass  ]]--
  125.     if JHConfig.Harass then
  126.         if ts.target ~= nil and GetDistance(ts.target) < QRange then
  127.             predic = tpE:GetPrediction(ts.target)
  128.             hc = tpE:GetHitChance(ts.target)
  129.             if predic ~= nil and hc > 0.5 then CastSpell(_Q, predic.x, predic.z) end
  130.         end
  131.     end
  132.  
  133.     --[[    Items   ]]--
  134.     if JHConfig.scriptActive and ts.target and ValidTarget(ts.target) and GetDistance(ts.target) < wRange then
  135.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  136.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  137.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  138.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  139.         if TMTREADY and GetDistance(ts.target) < 275 then CastSpell(TMTSlot) end
  140.         if RAHREADY and GetDistance(ts.target) < 275 then CastSpell(RAHSlot) end
  141.         if RNDREADY and GetDistance(ts.target) < 275 then CastSpell(RNDSlot) end
  142.     end
  143.  
  144.     --[[    Escape / mousepos combo ]]--
  145.     if (JHConfig.scriptActive and JHConfig.mouseCombo) or JHConfig.escape then
  146.         if EREADY and QREADY and GetDistance(mousePos) < Range then
  147.             CastSpell(_E, mousePos.x, mousePos.z)
  148.             Dstandard = mousePos
  149.         end
  150.         if Dstandard ~= nil then
  151.             if QREADY and GetDistance(Dstandard) < Range then
  152.                 local QPos = myHero - (Vector(myHero) - Vector(Dstandard)):normalized()*QRange
  153.                 CastSpell(_Q, QPos.x, QPos.z)
  154.                 Dstandard = nil
  155.             end
  156.         end            
  157.     end
  158.  
  159.     --[[ Auto combo ]]--
  160.     if JHConfig.scriptActive and ts.target and ValidTarget(ts.target) and not JHConfig.mouseCombo then
  161.         if TruePos ~= nil and EREADY and QREADY and GetDistance(TruePos) < Range and not JHConfig.mouseCombo then
  162.             CastSpell(_E,TruePos.x,TruePos.z)
  163.             Dstandard = TruePos
  164.         end
  165.         if Dstandard ~= nil then
  166.             if QREADY and GetDistance(Dstandard) < Range and GetDistance(TruePos, Dstandard) < 75 then
  167.                 local QPos = myHero - (Vector(myHero) - Vector(Dstandard)):normalized()*QRange
  168.                 CastSpell(_Q, QPos.x, QPos.z)
  169.                 Dstandard = nil
  170.             end
  171.         end
  172.     end
  173.  
  174.     --[[ W + orbwalk        ]]--
  175.     if JHConfig.scriptActive and ts.target then
  176.         if WREADY and GetDistance(ts.target) < wRange then
  177.             nextpos = tpE:GetPrediction(ts.target)
  178.             if nextpos and GetDistance(nextpos) < wRange then
  179.                 CastSpell(_W)
  180.             end
  181.         end
  182.         if swing == 0 then
  183.             if GetDistance(ts.target) < 250 and GetTickCount() > nextTick then
  184.                 myHero:Attack(ts.target)
  185.                 nextTick = GetTickCount()
  186.             elseif GetTickCount() > nextTick then
  187.             nextpos = tpE:GetPrediction(ts.target)
  188.             if nextpos then  
  189.                 myHero:MoveTo(nextpos.x, nextpos.z)
  190.             else
  191.                 myHero:MoveTo(ts.target.x, ts.target.z)
  192.             end
  193.         end
  194.     elseif swing == 1 and GetTickCount() > (nextTick + AttackDelay*1000) then
  195.         nextpos = tpE:GetPrediction(ts.target)
  196.         if nextpos then  
  197.             myHero:MoveTo(nextpos.x, nextpos.z)
  198.         else
  199.             myHero:MoveTo(ts.target.x, ts.target.z)
  200.         end
  201.     end
  202.     elseif JHConfig.scriptActive then
  203.         myHero:MoveTo(mousePos.x, mousePos.z)
  204.     end
  205. end
  206.  
  207. function OnCreateObj(obj)
  208.     if obj ~= nil and string.find(obj.name, "JarvanDemacianStandard_buf") then
  209.         Dstandard = obj
  210.     end
  211. end
  212.  
  213. function OnDeleteObj(obj)
  214.     if obj ~= nil and string.find(obj.name, "JarvanDemacianStandard_buf") then
  215.         Dstandard = nil
  216.     end
  217. end
  218.  
  219. function OnDraw()      
  220.     if JHConfig.drawcirclesSelf and not myHero.dead then
  221.         DrawCircle(myHero.x, myHero.y, myHero.z, Range, 0x00FF00)
  222.         --DrawCircle(myHero.x, myHero.y, myHero.z, wRange, 0x00FFFF)
  223.     end
  224.     if ts.target ~= nil and JHConfig.drawcirclesEnemy then
  225.         for j=0, 10 do
  226.             DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  227.         end
  228.     end
  229. end
Advertisement
Add Comment
Please, Sign In to add comment