Advertisement
Kevinkev

ViLoaded 1.2.lua

Jan 11th, 2013
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.01 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.  
  11. ]]
  12. if myHero.charName ~= "Vi" then return end
  13.    
  14.  
  15. function OnLoad()
  16.     --makeFile(path)
  17.     --Hotkeys
  18.     comboKey = 32
  19.     nextTick = 0
  20.     --Do not touch
  21.     qTick = 0
  22.     castQ = false
  23.     TimeIsRight = false
  24.     swingDelay  = 0.24
  25.     EMaxRange   = 600
  26.     EMinRange   = 125
  27.     ScanRange   = 700
  28.     RRange      = 700
  29.     RWidth      = 200
  30.     DFGSSlot    = nil
  31.     DFGReady    = false
  32.     sexyahhahh  = 0 --Copyright variable name by x7x
  33.     iPressedQ   = false
  34.     buffer      = 0 --So it doesn't undershoot Q
  35.     debugTime   = 0
  36.     targetX,targetZ = 0,0
  37.     lastBasicAttack = 0    
  38.     --600 is good on stationary targets (faster)
  39.     --Decreasing increases charge time so you can actually reach enemies running away
  40.     invisibleTime   = 300 --Decrease this number to increase the charge duration
  41.     ts = TargetSelector(TARGET_LOW_HP,700,DAMAGE_PHYSICAL,false)
  42.     tQ = TargetPrediction(700, 1, 0, 700, 50)
  43.     --Menu
  44.     ViConfig = scriptConfig("Vi Combo", "ViCombo")
  45.     ViConfig:addParam("active", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, comboKey)
  46.     ViConfig:addParam("useult", "Use Ultimate", SCRIPT_PARAM_ONOFF, true)
  47.     ViConfig:permaShow("active")
  48.     ts.name = "Vi"
  49.     ViConfig:addTS(ts)
  50.     PrintChat(">> ViLoaded!")
  51. end
  52.  
  53.  
  54. function CastSpellQ() --Cast Vi's Q workaround since it's bugged. Ty eXtragoZ!
  55.     if myHero:CanUseSpell(_Q) == READY then
  56.         if not iPressedQ and GetTickCount() - qTick + invisibleTime > HoldForHowLong(targetX, targetZ) then
  57.             CastSpell(_Q, targetX, targetZ)
  58.             CastSpell(10)
  59.             swing = 0
  60.             qTick = GetTickCount()
  61.         end
  62.  
  63.         if iPressedQ and GetTickCount() - qTick + invisibleTime > HoldForHowLong(targetX, targetZ) then
  64.             CastSpell(_Q, targetX, targetZ)
  65.             qTick = GetTickCount()
  66.         end
  67.     end
  68. end
  69.  
  70. function OnProcessSpell(unit, spell)
  71.     if unit.isMe and (spell.name:find("BasicAttack" or "CritAttack") ~= nil) then
  72.         swing = 1
  73.         lastBasicAttack = os.clock()
  74.     end
  75. end
  76.  
  77.  
  78. function OnCreateObj(object)
  79.     if object.name == "Vi_Q_Channel_L.troy" then iPressedQ = true end
  80. end
  81.  
  82. function OnDeleteObj(object)
  83.     if object.name == "Vi_Q_Channel_L.troy" then iPressedQ = false end
  84. end
  85.    
  86. function HoldForHowLong(x,z)
  87.     result = 0
  88.     distance = pythag(myHero.x - x, myHero.z - z) + buffer
  89.     if distance < 250 then
  90.         return result
  91.     elseif distance > 725 then
  92.         return result + 1250
  93.     else
  94.         result = (distance-250)/0.38
  95.         return result
  96.     end
  97.    
  98. end
  99.    
  100. function pythag(x,y)
  101.  
  102.     return math.floor(math.sqrt((x)^2 + (y)^2))
  103.  
  104. end
  105.    
  106. function OnTick()
  107.  
  108.     ts:update()
  109.     DFGSlot = GetInventorySlotItem(3128)
  110.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  111.     QReady = (myHero:CanUseSpell(_Q) == READY)
  112.     EReady = (myHero:CanUseSpell(_E) == READY)
  113.     RReady = (myHero:CanUseSpell(_R) == READY)
  114.    
  115.     if os.clock() > lastBasicAttack + 0.5 then
  116.         swing = 0
  117.     end
  118.  
  119.     --Combo's and such
  120.     if ts.target ~= nil and ViConfig.active then
  121.         myHero:Attack(ts.target)  
  122.         QPredict = tQ:GetPrediction(ts.target)
  123.         if QPredict ~= nil then
  124.             --Vi's R
  125.             if RReady and ViConfig.useult then CastSpell(_R, ts.target) end
  126.            
  127.            
  128.             --Vi's Q
  129.             if QReady then
  130.             targetX, targetZ = QPredict.x,QPredict.z
  131.                 CastSpellQ()
  132.                
  133.             end
  134.                
  135.             myHero:Attack(ts.target)      
  136.             --Auto E after auto attack
  137.             if EReady and QReady == false and os.clock() - lastBasicAttack > swingDelay and GetDistance(ts.target) <= EMinRange + 125 then
  138.                 CastSpell(_E)
  139.             end
  140.         end
  141.     end
  142. end
  143.  
  144. function OnUnload()
  145.     PrintChat(">> Arrivederci")
  146. end
  147.    
  148. function OnDraw()
  149.    
  150.     DrawCircle(myHero.x, myHero.y, myHero.z, ScanRange, 0xFF0000)
  151.    
  152. end
  153.    
  154. function OnWndMsg(msg,key)
  155. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement