Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Veigar's Super FunHouse! 3.7c~ by llama
- Required Libraries:
- comboLib
- ]]
- if myHero.charName ~= "Veigar" then return end
- function OnLoad()
- player = myHero
- --HotKeys
- EHK = string.byte("E") --HK for "E" by default. Auto stun up to 2 targets.
- cageTeamHK = string.byte("G") -- hk for "G" by default. Cage enemy team in event horizon.
- spaceHK = 32 --hk for "spacebar" by default.
- fullComboHK = string.byte("X")
- autoQMinionHK = 118 --hk for "F7"
- --Options
- comboTimeout = 3000
- eCircleColor = 0xB820C3 -- purple by default
- wCircleColor = 0xEA3737 -- orange by default
- qCircleColor = 0x19A712 --green by default
- circleRadius = 100 --radius of circle drawn
- circleThickness = 10 --Higher means more vibrant circle. More cpu usage.
- --Skill attributes
- qrange = 650
- wrange = 890
- wradius = 230 --maximum radius of W
- eradius = 350 -- event horizon's radius has bounds from 300 to 400
- erange = 600
- ecastspeed = 340 --(ms) calculated from tick values before and after cast of even horizon
- --code
- --require"comboLib-Before Edit"
- require"comboLib"
- stealTarget = nil
- comboArray = {}
- oldname = "default"
- timeoutTick = 0
- requiresW = false
- eTarget = nil
- VeigarConfig = scriptConfig("Veigar Combo", "veigarcombo")
- VeigarConfig:addParam("spacebarActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, spaceHK)
- VeigarConfig:addParam("useStunWithSpace", "Use Stun with Combo", SCRIPT_PARAM_ONOFF, true)
- VeigarConfig:addParam("fullCombo", "Full Combo", SCRIPT_PARAM_ONKEYDOWN, false, fullComboHK)
- VeigarConfig:addParam("eCastActive", "E+W", SCRIPT_PARAM_ONKEYDOWN, false, EHK)
- VeigarConfig:addParam("cageTeamActive", "Cage Team", SCRIPT_PARAM_ONKEYDOWN, false, cageTeamHK)
- VeigarConfig:addParam("autoQMinions", "Toggle Auto-Q Minion (F7)", SCRIPT_PARAM_ONKEYTOGGLE, false, autoQMinionHK)
- VeigarConfig:addParam("stealOption", "Steal on Killable", SCRIPT_PARAM_ONOFF, false)
- VeigarConfig:addParam("stunWithStealOption", "Use Stun with Steal", SCRIPT_PARAM_ONOFF, true)
- VeigarConfig:addParam("drawKillable", "Draw Killable", SCRIPT_PARAM_ONOFF, true)
- VeigarConfig:addParam("drawQRange", "Draw Q Range", SCRIPT_PARAM_ONOFF, true)
- VeigarConfig:addParam("drawWRange", "Draw W Range", SCRIPT_PARAM_ONOFF, true)
- VeigarConfig:addParam("drawERange", "Draw E Range", SCRIPT_PARAM_ONOFF, true)
- VeigarConfig:permaShow("autoQMinions")
- VeigarConfig:permaShow("stealOption")
- ts = TargetSelector(TARGET_LOW_HP, erange + eradius, DAMAGE_MAGIC)
- ts.name = "Veigar"
- VeigarConfig:addTS(ts)
- if VIP_USER then
- tp = TargetPredictionVIP(erange + eradius, math.huge, ecastspeed / 1000)
- else
- tp = TargetPrediction(erange + eradius, math.huge, ecastspeed)
- end
- function customE()
- if myHero:CanUseSpell(_E) == READY then return true else return false end
- end
- fullCombo = { _Q, _W, _R }
- --combo 1 is the stun combo
- comboLib:newSkill("Q", (wrange + wradius), 1)
- comboLib:newSkill("DFG", (wrange + wradius), 1)
- comboLib:newSkill("HXG", (wrange + wradius), 1)
- comboLib:newSkill("BWC", (wrange + wradius), 1)
- comboLib:newSkill("RUINEDKING", (wrange + wradius), 1)
- comboLib:newSkill("TIAMAT", (wrange + wradius), 1)
- comboLib:newSkill("HYDRA", (wrange + wradius), 1)
- comboLib:newSkill("W", (wrange + wradius), 1, customE, true)
- comboLib:newSkill("R", (wrange + wradius), 1)
- comboLib:newSkill("ignite", (wrange + wradius), 1)
- --global combo 3 for draw killable with stun
- comboLib:newSkill("Q", 30000, 3)
- comboLib:newSkill("W", 30000, 3, customE, true)
- comboLib:newSkill("DFG", 30000, 3)
- comboLib:newSkill("BWC", 30000, 3)
- comboLib:newSkill("RUINEDKING", 30000, 3)
- comboLib:newSkill("TIAMAT", 30000, 3)
- comboLib:newSkill("HYDRA", 30000, 3)
- comboLib:newSkill("HXG", 30000, 3)
- comboLib:newSkill("R", 30000, 3)
- comboLib:newSkill("ignite", 30000, 3)
- --global combo for draw killable without stun
- enemyMinions = minionManager(MINION_ENEMY, qrange, player, MINION_SORT_HEALTH_ASC)
- PrintChat(" >>Veigar's Super FunHouse Loaded!")
- end
- function GetDistanceTo(target1, target2)
- local dis
- if target2 ~= nil and target1 ~= nil then
- dis = math.sqrt((target2.x - target1.x) ^ 2 + (target2.z - target1.z) ^ 2)
- end
- return dis
- end
- function targetvalid(target)
- return target ~= nil and target.team ~= player.team and target.visible and not target.dead and GetDistanceTo(player, target) <= (erange + eradius)
- end
- function targetsinradius(target1, target2)
- local dis, dis1, dis2, predicted1, predicted2
- if VIP_USER then
- predicted1 = tp:GetPrediction(target1)
- predicted2 = tp:GetPrediction(target2)
- else
- predicted1 = GetPredictionPos(target1,ecastspeed + GetLatency()/2)
- predicted2 = GetPredictionPos(target2,ecastspeed + GetLatency()/2)
- end
- if predicted1 and predicted2 then
- dis = math.sqrt((predicted2.x - predicted1.x) ^ 2 + (predicted2.z - predicted1.z) ^ 2) --find the distance between the two targets
- dis1 = math.sqrt((predicted1.x - player.x) ^ 2 + (predicted1.z - player.z) ^ 2) --distance from player to predicted target 1
- dis2 = math.sqrt((predicted2.x - player.x) ^ 2 + (predicted2.z - player.z) ^ 2) --distance from player to predicted target 2
- end
- return dis ~= nil and dis <= (eradius * 2) and dis1 <= (eradius + erange) and dis2 <= (eradius + erange)
- end
- function calcdoublestun(target1, target2)
- local CircX, CircZ, predicted1, predicted2
- if VIP_USER then
- predicted1 = tp:GetPrediction(target1)
- predicted2 = tp:GetPrediction(target2)
- else
- predicted1 = GetPredictionPos(target1,ecastspeed + GetLatency()/2)
- predicted2 = GetPredictionPos(target2,ecastspeed + GetLatency()/2)
- end
- if predicted1 and predicted2 then
- local h1 = predicted1.x
- local k1 = predicted1.z
- local h2 = predicted2.x
- local k2 = predicted2.z
- local u = (h1) ^ 2 + (h2) ^ 2 - 2 * (h1) * (h2) - (k1) ^ 2 + (k2) ^ 2
- local w = k1 - k2
- local v = h2 - h1
- local a = 4 * (w ^ 2 + v ^ 2)
- local b = 4 * (u * w - 2 * ((v) ^ 2) * (k1))
- local c = (u) ^ 2 - 4 * ((v ^ 2)) * (eradius ^ 2 - k1 ^ 2)
- local Z1 = ((-b) + math.sqrt((b) ^ 2 - 4 * a * c)) / (2 * a) --Z coord for first solution
- local Z2 = ((-b) - math.sqrt((b) ^ 2 - 4 * a * c)) / (2 * a) --Z coord for second solution
- local d = (Z1 - k1) ^ 2 - (eradius) ^ 2
- local e = (Z1 - k2) ^ 2 - (eradius) ^ 2
- local X1 = ((h2) ^ 2 - (h1) ^ 2 - d + e) / (2 * v) -- X Coord for first solution
- local p = (Z2 - k1) ^ 2 - (eradius) ^ 2
- local q = (Z2 - k2) ^ 2 - (eradius) ^ 2
- local X2 = ((h2) ^ 2 - (h1) ^ 2 - p + q) / (2 * v) --X Coord for second solution
- --determine if these 2 points are within range, and which is closest
- local dis1 = math.sqrt((X1 - player.x) ^ 2 + (Z1 - player.z) ^ 2)
- local dis2 = math.sqrt((X2 - player.x) ^ 2 + (Z2 - player.z) ^ 2)
- if dis1 <= (eradius + erange) and dis1 <= dis2 then
- CircX = X1
- CircZ = Z1
- end
- if dis2 <= (eradius + erange) and dis2 < dis1 then
- CircX = X2
- CircZ = Z2
- end
- end
- return CircX, CircZ
- end
- function calcsinglestun()
- if (ts.target ~= nil) and player:CanUseSpell(SPELL_3) == READY then
- local predicted
- if VIP_USER then
- predicted = tp:GetPrediction(ts.target)
- else
- predicted = GetPredictionPos(ts.target,ecastspeed + GetLatency()/2)
- end
- if predicted then
- local CircX, CircZ
- local dis = math.sqrt((player.x - predicted.x) ^ 2 + (player.z - predicted.z) ^ 2)
- CircX = predicted.x + eradius * ((player.x - predicted.x) / dis)
- CircZ = predicted.z + eradius * ((player.z - predicted.z) / dis)
- return CircX, CircZ
- end
- end
- end
- function OnWndMsg(msg, wParam)
- if msg == KEY_DOWN then
- if wParam == autoQMinionHK then
- if VeigarConfig.autoQMinions == true then
- PrintChat("Auto-Q Minions Enabled")
- elseif VeigarConfig.autoQMinions == false then
- PrintChat("Auto-Q Minions Disabled")
- end
- end
- end
- end
- function castESpellOnTarget(object)
- if player:CanUseSpell(_E) then
- local target1 = object
- local CircX, CircZ, returnTarget
- local players = heroManager.iCount
- for j = 1, players, 1 do
- local target2 = heroManager:getHero(j)
- if targetvalid(target1) and targetvalid(target2) and target1.name ~= target2.name then --make sure both targets are valid enemies and in spell range
- if targetsinradius(target1, target2) and CircX == nil and CircZ == nil then --true if a double stun is possible
- CircX, CircZ = calcdoublestun(target1, target2) --calculates coords for stun
- if CircX and CircZ then
- break
- end
- end
- end
- end
- if CircX == nil or CircZ == nil then --true if double stun coords were not found
- if targetvalid(object) then
- CircX, CircZ = calcsinglestun() --calculate stun coords for a single target
- end
- end
- if CircX and CircZ then --true if any coords were found
- CastSpell(SPELL_3, CircX, CircZ)
- end
- end
- end
- function useStunCombo(object)
- local spellPos
- if player:CanUseSpell(_E) == READY and not object.dead then
- castESpellOnTarget(object)
- end
- if player:CanUseSpell(_W) == READY and not object.dead then
- if object and targetvalid(object) then
- if object.canMove == false then
- spellPos = FindGroupCenterNearTarget(object, wradius, wrange)
- if spellPos then
- CastSpell(_W, spellPos.center.x, spellPos.center.z)
- else
- CastSpell(_W, object)
- end
- end
- end
- end
- end
- function hasW(array)
- local test
- for i = 1, #array, 1 do
- if array[i].skill == _W then
- test = true
- else
- test = test or false
- end
- end
- return test
- end
- function performcombo(target, stealflag)
- local eComboFlag = false
- if oldname ~= target.name or GetTickCount() > timeoutTick then --find NEW combo if target has changed(dead, out of range) or if all skills in previous combo were used.
- comboArray = comboLib:findBestCombo(target, 1) --find combo
- if comboArray == nil or #comboArray == 0 then --combo not found for target in range
- requiresW = false
- if stealflag == true then
- stealTarget = nil
- end
- elseif comboArray and #comboArray > 0 then --combo without stun worked!
- requiresW = hasW(comboArray)
- oldname = target.name
- timeoutTick = GetTickCount() + comboTimeout
- end
- end
- if comboArray and #comboArray > 0 then
- if requiresW and player:CanUseSpell(_W) == READY and ((VeigarConfig.spacebarActive and VeigarConfig.useStunWithSpace) or (VeigarConfig.stealOption and VeigarConfig.spacebarActive == false and VeigarConfig.stunWithStealOption)) then
- useStunCombo(target)
- else
- eComboFlag = true --E+W has been used
- end
- if eComboFlag == true then
- for i = 1, #comboArray, 1 do
- if player:CanUseSpell(comboArray[i].skill) == READY and comboArray[i].name ~= "W" then
- CastSpell(comboArray[i].skill, target)
- end
- end
- end
- else
- if VeigarConfig.spacebarActive and not VeigarConfig.fullCombo and player:CanUseSpell(_Q) == READY then
- CastSpell(_Q, target)
- end
- if VeigarConfig.fullCombo and VeigarConfig.spacebarActive == false then
- for i = 1, #fullCombo, 1 do
- if player:CanUseSpell(_W) == READY then
- useStunCombo(target)
- else
- eComboFlag = true
- end
- if eComboFlag == true then
- for i = 1, #fullCombo, 1 do
- if player:CanUseSpell(fullCombo[i]) == READY and fullCombo[i] ~= _W then
- CastSpell(fullCombo[i], target)
- end
- end
- end
- end
- end
- end
- if stealflag == true and not targetvalid(target) then
- stealTarget = nil
- end
- end
- function autoCastQ()
- for i = 1, #enemyMinions.objects do
- local targetMinion = enemyMinions.objects[i]
- if ValidTarget(targetMinion, qrange) and string.find(targetMinion.name, "Minion_") then
- if targetMinion.health < player:CalcMagicDamage(targetMinion, 45 * (player:GetSpellData(_Q).level - 1) + 80 + (.6 * player.ap)) then
- CastSpell(_Q, targetMinion)
- end
- end
- end
- end
- function OnDraw()
- local players, drawtarget
- local requiresW = false
- local drawComboArray
- if not player.dead then
- if VeigarConfig.drawQRange == true then
- DrawCircle(player.x, player.y, player.z, qrange, qCircleColor)
- end
- if VeigarConfig.drawWRange == true then
- DrawCircle(player.x, player.y, player.z, wrange, wCircleColor)
- end
- if VeigarConfig.drawERange == true then
- DrawCircle(player.x, player.y, player.z, erange + eradius, eCircleColor)
- end
- if VeigarConfig.drawKillable == true then
- players = heroManager.iCount
- for i = 1, players, 1 do
- drawtarget = heroManager:getHero(i)
- if drawtarget ~= nil then
- if drawtarget.team ~= player.team and drawtarget.visible and not drawtarget.dead then
- drawComboArray = comboLib:findBestCombo(drawtarget, 3)
- requiresW = drawComboArray and hasW(drawComboArray)
- if drawComboArray and #drawComboArray > 0 then
- for j = 0, circleThickness do
- DrawCircle(drawtarget.x, drawtarget.y, drawtarget.z, circleRadius + j * 1.5, 0xFFFF0000)
- end
- if requiresW == true then
- DrawCircle(drawtarget.x, drawtarget.y, drawtarget.z, 150, 0x00FFFF00)
- end
- end
- end
- end
- end
- end
- end
- end
- function OnTick()
- local players = heroManager.iCount
- ts:update()
- enemyMinions:update()
- --lp:tick()
- if VeigarConfig.eCastActive == true and not player.dead and VeigarConfig.spacebarActive == false and VeigarConfig.cageTeamActive == false then
- if eTarget then
- if not targetvalid(eTarget) then
- eTarget = nil
- end
- end
- if eTarget == nil then
- if ts.target then
- eTarget = ts.target
- else
- for i = 1, heroManager.iCount, 1 do
- local testTarget = heroManager:getHero(i)
- if targetvalid(testTarget) then
- eTarget = testTarget
- end
- end
- end
- end
- if eTarget then
- useStunCombo(eTarget)
- end
- end
- if (VeigarConfig.spacebarActive == true or VeigarConfig.fullCombo == true) and targetvalid(ts.target) and ts.target.bMagicImunebMagicImune ~= true and ts.target.bInvulnerable ~= true and not player.dead and VeigarConfig.eCastActive == false and VeigarConfig.cageTeamActive == false then
- performcombo(ts.target, false)
- end
- if VeigarConfig.stealOption == true and not player.dead and VeigarConfig.spacebarActive == false and VeigarConfig.eCastActive == false and VeigarConfig.cageTeamActive == false then
- if stealTarget == nil then
- for i = 1, players, 1 do
- local testTarget = heroManager:getHero(i)
- if targetvalid(testTarget) and testTarget.bMagicImunebMagicImune ~= true and testTarget.bInvulnerable ~= true then
- stealTarget = testTarget
- performcombo(stealTarget, true)
- end
- end
- else
- performcombo(stealTarget, true)
- end
- end
- if VeigarConfig.cageTeamActive == true and ts.target ~= nil and not player.dead then
- local spellPos = FindGroupCenterFromNearestEnemies(eradius, erange)
- if spellPos ~= nil then
- CastSpell(SPELL_3, spellPos.center.x, spellPos.center.z)
- end
- end
- if VeigarConfig.autoQMinions == true and not player.dead then
- autoCastQ()
- end
- end
- class'Circle'
- function Circle:__init(center, radius)
- assert((VectorType(center) or center == nil) and (type(radius) == "number" or radius == nil), "Circle: wrong argument types (expected <Vector> or nil, <number> or nil)")
- self.center = Vector(center) or Vector()
- self.radius = radius or 0
- end
- function Circle:Contains(v)
- assert(VectorType(v), "Contains: wrong argument types (expected <Vector>)")
- return math.close(self.center:dist(v), self.radius)
- end
- function Circle:__tostring()
- return "{center: " .. tostring(self.center) .. ", radius: " .. tostring(self.radius) .. "}"
- end
Advertisement
Add Comment
Please, Sign In to add comment