Advertisement
Kevinkev

ViLoaded 1.4 (Added toggle for draw circle)

Mar 27th, 2013
3,968
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.41 KB | None | 0 0
  1. --[[
  2.     ViLoaded
  3.     by Kevinkev
  4.    
  5.     <like matrix reloaded... no? ok..>
  6.    
  7.     Based on AutoVi by x7x
  8.     Q fixed thanks to eXtragoZ.
  9.     Thanks Manciuszz for showing me as well.
  10.     Added item support thanks to Not2Legit
  11.  
  12. ]]
  13. if myHero.charName ~= "Vi" then return end
  14.    
  15. local items =
  16. {
  17. BRK = {id=3153, range = 500, reqTarget = true, slot = nil}, --Blade of the Ruined King
  18. BWC = {id=3144, range = 400, reqTarget = true, slot = nil}, --Bilgewater Cutlass
  19. DFG = {id=3128, range = 750, reqTarget = true, slot = nil}, --Deathfire Grasp
  20. HGB = {id=3146, range = 400, reqTarget = true, slot = nil}, --Hextech Gunblade
  21. RSH = {id=3074, range = 350, reqTarget = false, slot = nil}, --Ravenous Hydra
  22. STD = {id=3131, range = 350, reqTarget = false, slot = nil}, --Sword of the Divine
  23. TMT = {id=3077, range = 350, reqTarget = false, slot = nil}, --Tiamat
  24. YGB = {id=3142, range = 350, reqTarget = false, slot = nil} --Youmuu's Ghostblade
  25. }
  26. function OnLoad()
  27.     --makeFile(path)
  28.     --Hotkeys
  29.     comboKey = 32
  30.     nextTick = 0
  31.     --Do not touch
  32.     qTick = 0
  33.     castQ = false
  34.     TimeIsRight = false
  35.     swingDelay  = 0.24
  36.     EMaxRange   = 600
  37.     EMinRange   = 125
  38.     ScanRange   = 700
  39.     RRange      = 700
  40.     RWidth      = 200
  41.     sexyahhahh  = 0 --Copyright variable name by x7x
  42.     iPressedQ   = false
  43.     buffer      = 0 --So it doesn't undershoot Q
  44.     debugTime   = 0
  45.     targetX,targetZ = 0,0
  46.     lastBasicAttack = 0    
  47.     --600 is good on stationary targets (faster)
  48.     --Decreasing increases charge time so you can actually reach enemies running away
  49.     invisibleTime   = 300 --Decrease this number to increase the charge duration
  50.     ts = TargetSelector(TARGET_LOW_HP,700,DAMAGE_PHYSICAL,false)
  51.     tQ = TargetPrediction(700, 1, 0)
  52.     --Menu
  53.     ViConfig = scriptConfig("Vi Combo", "ViCombo")
  54.     ViConfig:addParam("active", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, comboKey)
  55.     ViConfig:addParam("useult", "Use Ultimate", SCRIPT_PARAM_ONOFF, true)
  56.     ViConfig:addParam("drawCircle", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  57. ViConfig:addParam("Movement", "Move to Cursor", SCRIPT_PARAM_ONOFF, true)
  58.     ViConfig:permaShow("active")
  59.     ts.name = "Vi"
  60.     ViConfig:addTS(ts)
  61.     PrintChat(">> ViLoaded!")
  62. end
  63. function UseItems(target)
  64.     if target == nil then return end
  65.     for _,item in pairs(items) do
  66.         item.slot = GetInventorySlotItem(item.id)
  67.         if item.slot ~= nil then
  68.             if item.reqTarget and GetDistance(target) < item.range then
  69.                 CastSpell(item.slot, target)
  70.             elseif not item.reqTarget then
  71.                 if (GetDistance(target) - getHitBoxRadius(myHero) - getHitBoxRadius(target)) < 50 then
  72.                 CastSpell(item.slot)
  73.                 end
  74.             end
  75.         end
  76.     end
  77. end
  78.  
  79. function CastSpellQ() --Cast Vi's Q workaround since it's bugged. Ty eXtragoZ!
  80.     if myHero:CanUseSpell(_Q) == READY then
  81.         if not iPressedQ and GetTickCount() - qTick + invisibleTime > HoldForHowLong(targetX, targetZ) then
  82.             CastSpell(_Q, targetX, targetZ)
  83.             CastSpell(10)
  84.             swing = 0
  85.             qTick = GetTickCount()
  86.         end
  87.  
  88.         if iPressedQ and GetTickCount() - qTick + invisibleTime > HoldForHowLong(targetX, targetZ) then
  89.             CastSpell(_Q, targetX, targetZ)
  90.             qTick = GetTickCount()
  91.         end
  92.     end
  93. end
  94.  
  95. function OnProcessSpell(unit, spell)
  96.     if unit.isMe and (spell.name:find("BasicAttack" or "CritAttack") ~= nil) then
  97.         swing = 1
  98.         lastBasicAttack = os.clock()
  99.     end
  100. end
  101.  
  102. function getHitBoxRadius(target)
  103.  
  104. return GetDistance(target.minBBox, target.maxBBox)/2
  105.  
  106. end
  107. function OnCreateObj(object)
  108.     if object.name == "Vi_Q_Channel_L.troy" then iPressedQ = true end
  109. end
  110.  
  111. function OnDeleteObj(object)
  112.     if object.name == "Vi_Q_Channel_L.troy" then iPressedQ = false end
  113. end
  114.    
  115. function HoldForHowLong(x,z)
  116.     result = 0
  117.     distance = pythag(myHero.x - x, myHero.z - z) + buffer
  118.     if distance < 250 then
  119.         return result
  120.     elseif distance > 725 then
  121.         return result + 1250
  122.     else
  123.         result = (distance-250)/0.38
  124.         return result
  125.     end
  126.    
  127. end
  128.    
  129. function pythag(x,y)
  130.  
  131.     return math.floor(math.sqrt((x)^2 + (y)^2))
  132.  
  133. end
  134.    
  135. function OnTick()
  136.  
  137.     ts:update()
  138.     QReady = (myHero:CanUseSpell(_Q) == READY)
  139.     EReady = (myHero:CanUseSpell(_E) == READY)
  140.     RReady = (myHero:CanUseSpell(_R) == READY)
  141.    
  142.     if os.clock() > lastBasicAttack + 0.5 then
  143.         swing = 0
  144.     end
  145.  
  146.     --Combo's and such
  147.     if ts.target ~= nil and ViConfig.active then
  148.         myHero:Attack(ts.target)  
  149.         QPredict = tQ:GetPrediction(ts.target)
  150.         if QPredict ~= nil then
  151.            
  152.             --ItemSupport
  153.             UseItems(ts.target)
  154.             --Vi's R
  155.             if RReady and ViConfig.useult then CastSpell(_R, ts.target) end
  156.            
  157.            
  158.             --Vi's Q
  159.             if QReady then
  160.             targetX, targetZ = QPredict.x,QPredict.z
  161.                 CastSpellQ()
  162.                
  163.             end
  164.                
  165.             myHero:Attack(ts.target)      
  166.             --Auto E after auto attack
  167.             if EReady and QReady == false and os.clock() - lastBasicAttack > swingDelay and GetDistance(ts.target) <= EMinRange + 125 then
  168.                 CastSpell(_E)
  169.             end
  170.         end
  171.     end
  172.  
  173.  if ViConfig.Movement and ViConfig.active and ts.target == nil then myHero:MoveTo(mousePos.x, mousePos.z)
  174.         end
  175. end
  176.  
  177. function OnUnload()
  178.     PrintChat(">> Arrivederci")
  179. end
  180.    
  181. function OnDraw()
  182.     if ViConfig.drawCircle then
  183.     DrawCircle(myHero.x, myHero.y, myHero.z, ScanRange, 0xFF0000)
  184.     end
  185. end
  186.    
  187. function OnWndMsg(msg,key)
  188. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement