Advertisement
Guest User

Ashe-Helper-v1.6b.lua

a guest
Feb 23rd, 2013
630
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.  
  3.     Ashe Helper v1.6b(fixed) by xkjtx/DeniCevap/ConfidentialitySpice(original script)
  4.     (SBTW)modded/added for there sweetness and autoAttack code! -xkjtx/DeniCevap
  5.     assisted(Ult code) by HeX --Just beautiful!
  6.     -Move to Mouse added on (2-17-2013) -xkjtx
  7.  
  8.     -Auto Volley <<Hot key Default = Space Bar>>(32)<<(Toggle minionCollision(in menu))>>
  9.     -Auto Frost Shot (Auto) <<(autoAttacks target while holding Space Bar)>>
  10.     -Auto Ult(R) Shot <<(Hot key Default = letter S)>>(83)<<(Change to (32) to burst with Ult)
  11.     -Minion Collision <<(Off by default)>>Toggle in menu<<
  12.     -Target configuration<<(Selecting target with Left Mouse click will focus)>>
  13.     -Press shift to configure
  14.  
  15.     Explanation of the marks:
  16.     -Green circle: Marks the current target to which you will do the combo
  17.     -Marks focused target(small greenish circle)
  18.     -Marks the targets next position (in light blueish color: always appears in front of target moving)
  19.     -AA Range(purpleish)
  20.     -Volley Range(greenish)
  21.     -Move To Mouse(toggle in menu/off by default) --<< This will mess with the AA'ing, but everything else works fine
  22.  
  23. ]]
  24.  
  25. if myHero.charName ~= "Ashe" then return end
  26.  
  27. --[[            Code            ]]
  28.  
  29. local range = 750
  30. local range2 = 1000 --<< Turned down, because auto(hot-key) tries to fire out of range. >>
  31. local range3 = 20000
  32. local player = GetMyHero()
  33. local enemyMinions = {}
  34. local tick = nil
  35.  
  36. -- ts
  37. local ts
  38.  
  39. -- hot keys (SBTW = both hot keys are 32)
  40. local hotVolly = 32 -- Space bar
  41. local hotArrow = 83 -- letter 'S'
  42.  
  43. -- more locals
  44. local WREADY = false
  45. local RREADY = false
  46. local travelDuration = nil
  47. local predic = nil
  48. local startAttackSpeed = 0.625
  49. local lastBasicAttack = 0
  50. local swing = 0
  51. local delay = 200
  52. local speed = 1.975
  53. local wWidth = 135 -- <<Increase if W is hitting creeps with collision ON.>>
  54.  
  55. function OnLoad()
  56.     PrintChat("Ashe Helper v1.6b: mod(xkjtx)!")
  57.     SCConfig = scriptConfig("Ashe Helper 1.6", "Ashe-perfect--xkjtx--Working")
  58.     SCConfig:addParam("scriptActive", "Volley", SCRIPT_PARAM_ONKEYDOWN, false, hotVolly) -- Space
  59.     SCConfig:addParam("ULTActive", "Arrow", SCRIPT_PARAM_ONKEYDOWN, false, hotArrow) -- S
  60.     SCConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  61.     SCConfig:addParam("checkCollision", "Use minion collision", SCRIPT_PARAM_ONOFF, false) -- off by default
  62.     SCConfig:addParam("moveMouse", "Active Move", SCRIPT_PARAM_ONOFF, false) -- move to Mouse(off by default) -- messes with AA'ing, but will cast W and R when hotkeys are pressed and its on--
  63.     SCConfig:addParam("predicTion", "Prediction OnOff", SCRIPT_PARAM_ONOFF, true) -- On by default because I believe it works better..
  64.     SCConfig:permaShow("scriptActive")
  65.     SCConfig:permaShow("ULTActive")
  66.     SCConfig:permaShow("checkCollision")
  67.     SCConfig:permaShow("moveMouse")
  68.     for i = 0, objManager.maxObjects, 1 do
  69.         local object = objManager:GetObject(i)
  70.         if CollisionCheck(object) then table.insert(enemyMinions, object) end
  71.     end
  72.     -- set to true if you want to GetTarget
  73.     ts = TargetSelector(TARGET_NEAR_MOUSE,range3,DAMAGE_PHYSICAL,true) -- TARGET_NEAR_MOUSE -- TARGET_LOW_HP  --  Trying both work good, but Ult seems to work better with TARGET_NEAR_MOUSE = true
  74.     ts.name = "Ashe"
  75.     SCConfig:addTS(ts)
  76.     lastBasicAttack = os.clock()
  77. end
  78.  
  79. function OnCreateObj(object)
  80.     if CollisionCheck(object) then table.insert(enemyMinions, object) end
  81. end
  82.  
  83. --[[function OnProcessSpell(unit, spell)
  84.     if unit.isMe and (spell.name:find("Attack") ~= nil) then
  85.         swing = 1
  86.         lastBasicAttack = os.clock()
  87.     end
  88. end]]
  89.  
  90. function CollisionCheck(object)
  91.     return object and object.valid and object.name:find("Minion_") and object.team ~= myHero.team and object.dead == false
  92. end
  93.  
  94. --[[ -------------------------Stuff that happens when you press hot keys------------------------- ]]--
  95. function OnTick()
  96.     if myHero.dead then return end
  97.     ts:update()
  98.     if ts.target ~= nil and not myHero.dead then
  99.         travelDuration = (delay + GetDistance(myHero, ts.target)/speed)
  100.         ts:SetPrediction(travelDuration)
  101.  
  102.         WREADY = (myHero:CanUseSpell(_W) == READY)
  103.         RREADY = (myHero:CanUseSpell(_R) == READY)
  104.  
  105.         predic = ts.nextPosition
  106.         AttackDelay = 1/(myHero.attackSpeed*startAttackSpeed)
  107.         if swing == 1 and os.clock() > lastBasicAttack + AttackDelay then
  108.             swing = 0
  109.         end
  110.         if SCConfig.ULTActive or SCConfig.scriptActive and not SCConfig.moveMouse then
  111.             if GetDistance(ts.target)<=range2 and swing == 0 then
  112.                 myHero:Attack(ts.target)
  113.             end
  114.         end
  115.     end
  116.     for i,minion in pairs(enemyMinions) do
  117.         if minion ~= nil and not minion.valid then
  118.             table.remove(enemyMinions, i)
  119.         end
  120.     end
  121.     if SCConfig.scriptActive and SCConfig.predicTion then
  122.         if SCConfig.moveMouse then
  123.             player:MoveTo(mousePos.x, mousePos.z) -- move to mouse
  124.         end
  125.         if WREADY and ts.target ~= nil and not myHero.dead and GetDistance(ts.target)<=range2 then
  126.             if SCConfig.checkCollision and ts.target ~= nil and predic ~= nil and not minionCollision(ts.target, wWidth, enemyMinions, range2) then
  127.                 CastSpell(_W, ts.nextPosition.x, ts.nextPosition.z)
  128.             elseif not SCConfig.checkCollision and ts.target ~= nil then
  129.                 CastSpell(_W, ts.nextPosition.x, ts.nextPosition.z)
  130.             end
  131.         end
  132.     elseif SCConfig.scriptActive and not SCConfig.predicTion then
  133.         if WREADY and ts.target ~= nil and not myHero.dead and GetDistance(ts.target)<=range2 then
  134.             if SCConfig.checkCollision and ts.target ~= nil and not minionCollision(ts.target, wWidth, enemyMinions, range2) then
  135.                 CastSpell(_W, ts.target)
  136.             elseif not SCConfig.checkCollision and ts.target ~= nil then
  137.                 CastSpell(_W, ts.target)
  138.             end
  139.         end
  140.     end
  141.     if SCConfig.ULTActive then
  142.         if SCConfig.moveMouse then
  143.             player:MoveTo(mousePos.x, mousePos.z) -- move to mouse
  144.         end
  145.         if RREADY and ts.target ~= nil and not myHero.dead and predic ~= nil and GetDistance(predic)<=range3 then
  146.             CastSpell(_R, ts.nextPosition.x, ts.nextPosition.z)
  147.         end
  148.     end
  149. end
  150.  
  151. --[[---------------------------------Basic Attacks and Q-------------------------------]]--
  152. function OnProcessSpell(unit, spell)
  153.     if unit.isMe and spell and spell.name:find("BasicAttack")or spell.name:find("CritAttack") and spell.name ~= nil and string.find(spell.name, "attack") then
  154.         swing = 1
  155.         lastBasicAttack = os.clock()
  156.     end
  157.     --[[if unit.isMe and spell.name ~= nil and string.find(spell.name, "attack") then
  158.         swing = 1              
  159.         lastBasicAttack = os.clock()  
  160.     end]]
  161.     if unit.isMe and spell and string.find(string.lower(spell.name),"attack") then
  162.         for i=1, heroManager.iCount do
  163.         local target = heroManager:GetHero(i)
  164.             if target ~= nil and target.visible and target.team ~= player.team and not target.dead and math.sqrt((target.x - spell.endPos.x)^2 + (target.z - spell.endPos.z)^2) < 80 then
  165.                 CastSpell(_Q)
  166.             end
  167.         end
  168.     end
  169.     if unit.isMe and spell and string.find(string.lower(spell.name),"frostarrow") then
  170.         local continueFrost = false
  171.         for i=1, heroManager.iCount do
  172.         local target = heroManager:GetHero(i)
  173.             if target ~= nil and target.visible and target.team ~= player.team and not target.dead and math.sqrt((target.x - spell.endPos.x)^2 + (target.z - spell.endPos.z)^2) < 80 then
  174.                 continueFrost = true
  175.             else
  176.                 continueFrost = false
  177.             end
  178.         end
  179.         if continueFrost == false then
  180.             CastSpell(_Q)
  181.         end
  182.     end
  183. end
  184.  
  185. --[[---------------------------------Collision Function-------------------------------]]--
  186. function minionCollision(predic, width, enemyMinions, range)
  187.     for _, minionObjectE in pairs(enemyMinions) do
  188.         if minionObjectE ~= nil and string.find(minionObjectE.name,"Minion_") == 1 and minionObjectE.team ~= player.team and minionObjectE.dead == false and minionObjectE.valid then
  189.             if predic ~= nil and player:GetDistance(minionObjectE) < range2 then
  190.                 ex = player.x
  191.                 ez = player.z
  192.                 tx = predic.x
  193.                 tz = predic.z
  194.                 dx = ex - tx
  195.                 dz = ez - tz
  196.                 if dx ~= 0 then
  197.                     m = dz/dx
  198.                     c = ez - m*ex
  199.                 end
  200.                 mx = minionObjectE.x
  201.                 mz = minionObjectE.z
  202.                 distanc = (math.abs(mz - m*mx - c))/(math.sqrt(m*m+1))
  203.                 if distanc < width and math.sqrt((tx - ex)*(tx - ex) + (tz - ez)*(tz - ez)) > math.sqrt((tx - mx)*(tx - mx) + (tz - mz)*(tz - mz)) then
  204.                     return true
  205.                 end
  206.             end
  207.         end
  208.     end
  209.     return false
  210. end
  211.  
  212. function OnDraw()
  213.     if SCConfig.drawcircles and not myHero.dead then
  214.         DrawCircle(myHero.x, myHero.y, myHero.z, range, 0x9900FF) -- purpleish
  215.         DrawCircle(myHero.x, myHero.y, myHero.z, range2, 0x003300) -- greenish
  216.         if ts.target ~= nil then
  217.             for j=0, 10 do
  218.                 DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  219.             end
  220.             if predic ~= nil then
  221.                 DrawCircle(predic.x, predic.y, predic.z, 100, 0x000099) -- blueish
  222.             end
  223.         end
  224.     end
  225. end
  226.  
  227. function OnSendChat(msg)
  228.     ts:OnSendChat(msg, "pri")
  229. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement