Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if myHero.charName ~= "Karthus" then return end
- require "VPrediction"
- require "SOW"
- function OnLoad()
- PrintChat(">> Challenger Karthus loaded")
- InitiateVariables()
- CreateMenu()
- end
- function OnTick()
- OnTickChecks()
- Combo()
- Harass()
- end
- function OnDraw()
- DrawCircles()
- DrawComboKiller()
- end
- function OnProcessSpell(unit, spell)
- if unit.isMe and spell.name == "KarthusDefileSoundDummy2" then
- lastEActivation = os.clock()
- end
- end
- function InitiateVariables()
- --menu
- menu = nil
- --skills
- ignite = nil
- flash = nil
- qReady = false
- wReady = false
- eReady = false
- rReady = false
- igniteReady = false
- flashReady = false
- qRange = 900
- qWidth = 100
- qDelay = 0.7
- qSpeed = math.huge
- wRange = 1000
- wWidth = 450
- wDelay = 0.5
- wSpeed = math.huge
- eRange = 475
- lastEActivation = 0
- igniteRange = 600
- flashRange = 400
- --prediction
- VP = VPrediction(true)
- --orbwalker
- NSOW = SOW(VP)
- --targets
- target = nil
- flashTarget = nil
- targetRange = qRange
- --target selector
- enemyCharNameList = {}
- enemyList = {}
- enemyPriorityList = {}
- enemyNum = 0
- GetEnemys()
- --summoners
- GetSummoners()
- end
- function CreateMenu()
- menu = scriptConfig("Challenger Karthus", "Challenger Karthus")
- menu:addSubMenu("Main","main")
- menu.main:addParam("combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
- menu.main:addParam("useW", "Use W", SCRIPT_PARAM_ONKEYTOGGLE, false, 77)
- menu.main:addParam("harass", "Harass Enemy", SCRIPT_PARAM_ONKEYTOGGLE, false, 86)
- menu.main:addParam("priority5", "Attack Priority 5", SCRIPT_PARAM_ONKEYTOGGLE, false, 72)
- menu:addSubMenu("Draw","draw")
- menu.draw:addParam("drawCircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
- menu.draw:addParam("drawComboKiller", "Draw Combo Killer", SCRIPT_PARAM_ONOFF, true)
- menu:addSubMenu("Target Selector","targetSelector")
- for i = 1, enemyNum do
- menu.targetSelector:addParam("enemy" .. i, enemyCharNameList[i], SCRIPT_PARAM_SLICE, 0, 0, 5, 0)
- end
- menu:addSubMenu("Orb Walking", "orbWalking")
- NSOW:LoadToMenu(menu.orbWalking)
- menu.main:permaShow("harass")
- menu.main:permaShow("priority5")
- end
- function OnTickChecks()
- qReady = myHero:CanUseSpell(_Q) == READY
- wReady = myHero:CanUseSpell(_W) == READY
- eReady = myHero:CanUseSpell(_E) == READY
- rReady = myHero:CanUseSpell(_R) == READY
- flashReady = flash and myHero:CanUseSpell(flash) == READY
- igniteReady = ignite and myHero:CanUseSpell(ignite) == READY
- target = GetBestTarget(targetRange)
- flashTarget = GetBestTarget(flashRange + wRange + 500)
- enemyPriorityList[1] = menu.targetSelector.enemy1
- enemyPriorityList[2] = menu.targetSelector.enemy2
- enemyPriorityList[3] = menu.targetSelector.enemy3
- enemyPriorityList[4] = menu.targetSelector.enemy4
- enemyPriorityList[5] = menu.targetSelector.enemy5
- end
- --noch machen
- function Combo()
- rKillable()
- if menu.main.combo and ValidTargetA(target) then
- Cast("Q", target)
- Cast("W", target)
- Cast("E")
- end
- end
- function Harass()
- if menu.main.harass and ValidTargetA(target) then
- Cast("Q", target)
- end
- end
- function Cast(spell, target)
- if spell == "Q" then
- if qReady and GetDistance(target) <= qRange then
- local castPosition, hitChance, position = VP:GetCircularCastPosition(target, qDelay, qWidth, qRange)
- if hitChance >= 2 then
- CastSpell(_Q, castPosition.x, castPosition.z)
- end
- end
- elseif spell == "W" then
- if wReady and GetDistance(target) <= wRange and menu.main.useW then
- local castPosition, hitChance, position = VP:GetLineCastPosition(target, wDelay, wWidth, wRange)
- if hitChance >= 2 then
- CastSpell(_W, castPosition.x, castPosition.z)
- end
- end
- elseif spell == "E" then
- if eReady and lastEActivation == 0 and EnemysInRange(eRange) > 0 then
- CastSpell(_E)
- end
- if eReady and lastEActivation ~= 0 and os.clock()-lastEActivation > 2 and EnemysInRange(eRange) == 0 then
- CastSpell(_E)
- lastEActivation = 0
- end
- elseif spell == "R" then
- if rReady then
- CastSpell(_R)
- end
- elseif spell == "IGNITE" then
- if igniteReady and GetDistance(target) <= igniteRange then
- CastSpell(ignite, target)
- end
- end
- end
- function DrawComboKiller()
- if menu.draw.drawComboKiller then
- for _, enemy in pairs(GetEnemyHeroes()) do
- if enemy and ValidTargetA(enemy) then
- local position = GetHPBarPos2(enemy)
- DrawText(tostring(math.floor(100 * (2 * getDmg("Q", enemy, myHero) + getDmg("R", enemy, myHero)) / enemy.health + 0.5)), 15, position.x, position.y, ARGB(255, 0, 255, 0))
- end
- end
- end
- end
- function DrawCircles()
- if menu.draw.drawCircles then
- if flashTarget ~= nil and ValidTargetA(flashTarget) then
- DrawCircle2(flashTarget.x, flashTarget.y, flashTarget.z, 100, ARGB(255,255,0,0))
- end
- DrawCircle2(myHero.x, myHero.y, myHero.z, qRange, ARGB(255, 125, 0, 225))
- DrawCircle2(myHero.x, myHero.y, myHero.z, wRange + flashRange, ARGB(255, 125, 0, 225))
- end
- end
- function GetBestTarget(range)
- local lessToKill = 100
- local lessToKilli = 0
- local toKill = 0
- local damageToHero = 0
- local targetArg = nil
- for priority = 0, 4 do
- if targetArg ~= nil then
- break
- end
- for i = 1, enemyNum do
- if enemyPriorityList[i] == priority and ValidTargetA(enemyList[i], range) then
- damageToHero = myHero:CalcMagicDamage(enemyList[i], 200)
- toKill = enemyList[i].health / damageToHero
- if ((toKill < lessToKill) or (lessToKilli == 0)) then
- lessToKill = toKill
- lessToKilli = i
- targetArg = enemyList[i]
- end
- end
- end
- end
- lessToKill = 1
- for _, enemy in ipairs(GetEnemyHeroes()) do
- if ValidTargetA(enemy, range) then
- toKill = (getDmg("Q", enemy, myHero)) / enemy.health
- if toKill > lessToKill then
- lessToKill = toKill
- targetArg = enemy
- end
- end
- end
- if targetArg == nil and menu.main.priority5 then
- lessToKill = 100
- lessToKilli = 0
- for i, enemy in ipairs(GetEnemyHeroes()) do
- if ValidTargetA(enemy, range) then
- damageToHero = myHero:CalcMagicDamage(enemy, 200)
- toKill = enemy.health / damageToHero
- if ((toKill < lessToKill) or (lessToKilli == 0)) then
- lessToKill = toKill
- lessToKilli = i
- targetArg = enemy
- end
- end
- end
- end
- return targetArg
- end
- --noch machen
- function GetSummoners()
- if string.lower(myHero:GetSpellData(SUMMONER_1).name) == "summonerdot" then
- ignite = SUMMONER_1
- elseif string.lower(myHero:GetSpellData(SUMMONER_2).name) == "summonerdot" then
- ignite = SUMMONER_2
- else
- ignite = nil
- end
- if string.lower(myHero:GetSpellData(SUMMONER_1).name) == "summonerflash" then
- flash = SUMMONER_1
- elseif string.lower(myHero:GetSpellData(SUMMONER_2).name) == "summonerflash" then
- flash = SUMMONER_2
- else
- flash = nil
- end
- end
- function GetEnemys()
- local i = 1
- for j = 1, heroManager.iCount do
- local obj = heroManager:getHero(j)
- if obj ~= nil and obj.team ~= myHero.team then
- enemyCharNameList[i] = obj.charName
- enemyList[i] = obj
- enemyNum = i
- i = i + 1
- end
- end
- return i
- end
- function EnemysInRange(range)
- local i = 0
- for j = 1, heroManager.iCount do
- local obj = heroManager:getHero(j)
- if ValidTargetA(obj, range) then
- i = i + 1
- end
- end
- return i
- end
- function rKillable()
- for j = 1, heroManager.iCount do
- local obj = heroManager:getHero(j)
- if obj ~= nil then
- local rDmg = 0
- if rReady then
- rDmg = getDmg("R", obj, myHero)
- end
- if ValidTargetA(obj) and rDmg + 1 > obj.health then
- print("ULLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTTTTTTT")
- print("ULLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTTTTTTT")
- print("ULLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTTTTTTT")
- print("ULLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTTTTTTT")
- print("ULLLLLLLLLLLLLLLLLLLLLLLLLLLLTTTTTTTTTTTT")
- end
- end
- end
- end
- function ValidTargetA(target, range)
- if target ~= nil and target.type == myHero.type and target.team ~= myHero.team and not target.dead and target.health > 0 then
- if range ~= nil and GetDistance(target) <= range then
- return true
- elseif range ~= nil then
- return false
- end
- return true
- else
- return false
- end
- end
- function GetHPBarPos2(enemy)
- local barPos = WorldToScreen(D3DXVECTOR3(enemy.x, enemy.y, enemy.z))
- local pos = { x = barPos.x - 35, y = barPos.y - 50 }
- return pos
- end
- -- copied functions
- -- barasia, vadash, viseversa
- function DrawCircleNextLvl(x, y, z, radius, width, color, chordlength)
- radius = radius or 300
- quality = math.max(8,math.floor(180/math.deg((math.asin((chordlength/(2*radius)))))))
- quality = 2 * math.pi / quality
- radius = radius*.92
- local points = {}
- for theta = 0, 2 * math.pi + quality, quality do
- local c = WorldToScreen(D3DXVECTOR3(x + radius * math.cos(theta), y, z - radius * math.sin(theta)))
- points[#points + 1] = D3DXVECTOR2(c.x, c.y)
- end
- DrawLines2(points, width or 1, color or 4294967295)
- end
- function DrawCircle2(x, y, z, radius, color)
- local vPos1 = Vector(x, y, z)
- local vPos2 = Vector(cameraPos.x, cameraPos.y, cameraPos.z)
- local tPos = vPos1 - (vPos1 - vPos2):normalized() * radius
- local sPos = WorldToScreen(D3DXVECTOR3(tPos.x, tPos.y, tPos.z))
- if OnScreen({ x = sPos.x, y = sPos.y }, { x = sPos.x, y = sPos.y }) then
- DrawCircleNextLvl(x, y, z, radius, 1, color, 75)
- end
- end
- -- zikkah
- function GetHPBarPos(enemy)
- enemy.barData = GetEnemyBarData()
- local barPos = GetUnitHPBarPos(enemy)
- local barPosOffset = GetUnitHPBarOffset(enemy)
- local barOffset = { x = enemy.barData.PercentageOffset.x, y = enemy.barData.PercentageOffset.y }
- local barPosPercentageOffset = { x = enemy.barData.PercentageOffset.x, y = enemy.barData.PercentageOffset.y }
- local BarPosOffsetX = 171
- local BarPosOffsetY = 46
- local CorrectionY = 0
- local StartHpPos = 31
- barPos.x = barPos.x + (barPosOffset.x - 0.5 + barPosPercentageOffset.x) * BarPosOffsetX + StartHpPos
- barPos.y = barPos.y + (barPosOffset.y - 0.5 + barPosPercentageOffset.y) * BarPosOffsetY + CorrectionY
- local StartPos = Vector(barPos.x , barPos.y, 0)
- local EndPos = Vector(barPos.x + 108 , barPos.y , 0)
- return Vector(StartPos.x, StartPos.y, 0), Vector(EndPos.x, EndPos.y, 0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement