Advertisement
Kevinkev

ViLoaded.lua

Dec 26th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.32 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.     RRange = 700
  22.     RWidth = 200
  23.     ts = TargetSelector(TARGET_LOW_HP,700,DAMAGE_PHYSICAL,false)
  24.     tr = TargetPrediction(700, 1, 0, 700, 50)
  25.     DFGSSlot = nil
  26.     DFGReady = false
  27.     sexyahhahh = 0 --Copyright variable name by x7x
  28.     iPressedQ = false
  29.     invisibleTime = 500 --Probably the delay when it detects objects being created iono.
  30.     buffer = 0 --So it doesn't undershoot Q
  31.     debugTime =0
  32.  
  33.     --Menu
  34.     ViConfig = scriptConfig("Vi Combo", "ViCombo")
  35.     ViConfig:addParam("active", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, comboKey)
  36.     ViConfig:addParam("useult", "Use Ultimate", SCRIPT_PARAM_ONOFF, true)
  37.     ViConfig:permaShow("active")
  38.     ts.name = "Vi"
  39.     ViConfig:addTS(ts)
  40.     PrintChat(">> ViLoaded!")
  41. end
  42.  
  43. function OnCreateObj(object)
  44.     --PrintChat(object.name)
  45.     if object.name == "Vi_Q_Channel_L.troy" then
  46.         iPressedQ = true
  47.  
  48.     end
  49. end
  50.  
  51. function OnDeleteObj(object)
  52.     --PrintChat(object.name)
  53.     if object.name == "Vi_Q_Channel_L.troy" then
  54.         iPressedQ = false
  55.  
  56.     end
  57. end
  58.    
  59. function HoldForHowLong(x,z)
  60.     result = 0
  61.     distance = mathStuff(myHero.x - x, myHero.z - z) + buffer
  62.     if distance < 250 then
  63.         PrintChat("type1")
  64.         return result
  65.     elseif distance > 725 then
  66.         PrintChat("type2")
  67.         return result + 1250
  68.     else
  69.         result = result + (distance-250)/0.38
  70.         --PrintChat(tostring(result))
  71.         return result --Distance needed/distance * seconds
  72.     end
  73.    
  74. end
  75.    
  76. function mathStuff(x,y)
  77.  
  78.     return math.floor(math.sqrt((x)^2 + (y)^2))
  79.  
  80. end
  81.    
  82. function OnTick()
  83.     ts:update()
  84.     DFGSlot = GetInventorySlotItem(3128)
  85.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  86.     QReady = (myHero:CanUseSpell(_Q) == READY)
  87.     EReady = (myHero:CanUseSpell(_E) == READY)
  88.     RReady = (myHero:CanUseSpell(_R) == READY)
  89.     TargetPrediction__OnTick()
  90.     if ts.target ~= nil and ViConfig.active then
  91.         rpred = tr:GetPrediction(ts.target)
  92.         if rpred ~= nil then
  93.             if RReady and ViConfig.useult then CastSpell(_R, ts.target) end
  94.             myHero:Attack(ts.target)
  95.             if QReady then
  96.  
  97.                
  98.                 if iPressedQ == false then
  99.                     CastSpell(_Q,ts.target.x,ts.target.z) --Needed a direction
  100.                     sexyahhahh = GetTickCount()
  101.                    
  102.                 end
  103.                 if GetTickCount() + invisibleTime >= HoldForHowLong(ts.target.x,ts.target.z) + sexyahhahh and iPressedQ == true then
  104.                     --PrintChat("now")
  105.                     CastSpell(_Q,ts.target.x,ts.target.z)
  106.                     myHero:Attack(ts.target)
  107.                     if EReady then CastSpell(_E) end
  108.                 end
  109.                 myHero:Attack(ts.target)
  110.             end
  111.         end
  112.     end
  113. end
  114.  
  115. function OnUnload()
  116.     PrintChat(">> Arrivederci")
  117. end
  118.    
  119. function OnDraw()
  120.     SC__OnDraw()
  121. end
  122.    
  123. function OnWndMsg(msg,key)
  124.     SC__OnWndMsg(msg,key)
  125. end
  126.    
  127. function OnSendChat(msg)
  128.     TargetSelector__OnSendChat(msg)
  129.     ts:OnSendChat(msg, "pri")
  130. end
  131.  
  132. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement