Advertisement
Kevinkev

ViLoaded 1.3 (item support+movement)

Jan 17th, 2013
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.30 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("Movement", "Move to Cursor", SCRIPT_PARAM_ONOFF, true)
  57.     ViConfig:permaShow("active")
  58.     ts.name = "Vi"
  59.     ViConfig:addTS(ts)
  60.     PrintChat(">> ViLoaded!")
  61. end
  62. function UseItems(target)
  63.     if target == nil then return end
  64.     for _,item in pairs(items) do
  65.         item.slot = GetInventorySlotItem(item.id)
  66.         if item.slot ~= nil then
  67.             if item.reqTarget and GetDistance(target) < item.range then
  68.                 CastSpell(item.slot, target)
  69.             elseif not item.reqTarget then
  70.                 if (GetDistance(target) - getHitBoxRadius(myHero) - getHitBoxRadius(target)) < 50 then
  71.                 CastSpell(item.slot)
  72.                 end
  73.             end
  74.         end
  75.     end
  76. end
  77.  
  78. function CastSpellQ() --Cast Vi's Q workaround since it's bugged. Ty eXtragoZ!
  79.     if myHero:CanUseSpell(_Q) == READY then
  80.         if not iPressedQ and GetTickCount() - qTick + invisibleTime > HoldForHowLong(targetX, targetZ) then
  81.             CastSpell(_Q, targetX, targetZ)
  82.             CastSpell(10)
  83.             swing = 0
  84.             qTick = GetTickCount()
  85.         end
  86.  
  87.         if iPressedQ and GetTickCount() - qTick + invisibleTime > HoldForHowLong(targetX, targetZ) then
  88.             CastSpell(_Q, targetX, targetZ)
  89.             qTick = GetTickCount()
  90.         end
  91.     end
  92. end
  93.  
  94. function OnProcessSpell(unit, spell)
  95.     if unit.isMe and (spell.name:find("BasicAttack" or "CritAttack") ~= nil) then
  96.         swing = 1
  97.         lastBasicAttack = os.clock()
  98.     end
  99. end
  100.  
  101. function getHitBoxRadius(target)
  102.  
  103. return GetDistance(target.minBBox, target.maxBBox)/2
  104.  
  105. end
  106. function OnCreateObj(object)
  107.     if object.name == "Vi_Q_Channel_L.troy" then iPressedQ = true end
  108. end
  109.  
  110. function OnDeleteObj(object)
  111.     if object.name == "Vi_Q_Channel_L.troy" then iPressedQ = false end
  112. end
  113.    
  114. function HoldForHowLong(x,z)
  115.     result = 0
  116.     distance = pythag(myHero.x - x, myHero.z - z) + buffer
  117.     if distance < 250 then
  118.         return result
  119.     elseif distance > 725 then
  120.         return result + 1250
  121.     else
  122.         result = (distance-250)/0.38
  123.         return result
  124.     end
  125.    
  126. end
  127.    
  128. function pythag(x,y)
  129.  
  130.     return math.floor(math.sqrt((x)^2 + (y)^2))
  131.  
  132. end
  133.    
  134. function OnTick()
  135.  
  136.     ts:update()
  137.     QReady = (myHero:CanUseSpell(_Q) == READY)
  138.     EReady = (myHero:CanUseSpell(_E) == READY)
  139.     RReady = (myHero:CanUseSpell(_R) == READY)
  140.    
  141.     if os.clock() > lastBasicAttack + 0.5 then
  142.         swing = 0
  143.     end
  144.  
  145.     --Combo's and such
  146.     if ts.target ~= nil and ViConfig.active then
  147.         myHero:Attack(ts.target)  
  148.         QPredict = tQ:GetPrediction(ts.target)
  149.         if QPredict ~= nil then
  150.            
  151.             --ItemSupport
  152.             UseItems(ts.target)
  153.             --Vi's R
  154.             if RReady and ViConfig.useult then CastSpell(_R, ts.target) end
  155.            
  156.            
  157.             --Vi's Q
  158.             if QReady then
  159.             targetX, targetZ = QPredict.x,QPredict.z
  160.                 CastSpellQ()
  161.                
  162.             end
  163.                
  164.             myHero:Attack(ts.target)      
  165.             --Auto E after auto attack
  166.             if EReady and QReady == false and os.clock() - lastBasicAttack > swingDelay and GetDistance(ts.target) <= EMinRange + 125 then
  167.                 CastSpell(_E)
  168.             end
  169.         end
  170.     end
  171.  
  172.  if ViConfig.Movement and ViConfig.active and ts.target == nil then myHero:MoveTo(mousePos.x, mousePos.z)
  173.         end
  174. end
  175.  
  176. function OnUnload()
  177.     PrintChat(">> Arrivederci")
  178. end
  179.    
  180. function OnDraw()
  181.    
  182.     DrawCircle(myHero.x, myHero.y, myHero.z, ScanRange, 0xFF0000)
  183.    
  184. end
  185.    
  186. function OnWndMsg(msg,key)
  187. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement