Advertisement
Kevinkev

ViLoaded.lua

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