function OnLoad() Menu = scriptConfig("Shaco Orbwalk", "Shaco") Menu:addParam("Active", "Activate the Script", SCRIPT_PARAM_ONKEYDOWN, false, 32) Menu:addSubMenu("Orbwalk Settings", "Move") Menu.Move:addParam("Orbwalk", "Orbwalk", SCRIPT_PARAM_ONOFF, true) Menu.Move:addParam("mtm", "Move To Mouse", SCRIPT_PARAM_ONOFF, false) ts = TargetSelector(TARGET_NEAR_MOUSE, TSRange, DAMAGE_PHYSICAL, false) ts.name = myHero.charName Menu:addTS(ts) end function OnTick() ts:update() Target = ts.target Move() if Menu.Active then StutterStep() end end local safevar = true function Move() if safevar == true and Menu.Move.Orbwalk then Menu.Move.mtm = false safevar = false end if safevar == false and Menu.Move.mtm then Menu.Move.Orbwalk = false safevar = true end end function StutterStep() if not Target then end if Target then if Menu.Move.Orbwalk then OrbWalk2() OrbWalk() end else if Menu.Move.Orbwalk or Menu.Move.mtm then moveToCursor() end end end function OrbWalk() if GetDistance(Target,myHero) > trueRange() then return end if timeToShoot() then myHero:Attack(Target) if shacoClone ~= nil then CastSpell(_R,Target) end elseif heroCanMove() then moveToCursor() end end function OrbWalk2() if GetDistance(Target,myHero) < trueRange() then return end for e=1, heroManager.iCount do local enemy = heroManager:GetHero(e) if ValidTarget(enemy, trueRange()) then local distanceenemy = GetDistance(enemy) if (distanceenemy <= trueRange()) and (GetDistance(Target,myHero) > trueRange()) then if timeToShoot() then myHero:Attack(enemy) if shacoClone ~= nil then CastSpell(_R,enemy) end elseif heroCanMove() then moveToCursor() end end else moveToCursor() end end end function OnProcessSpell(object, spell) if object.isMe then if spell.name:lower():find("attack") then lastAttack = GetTickCount() - GetLatency()/2 lastWindUpTime = spell.windUpTime*1000 lastAttackCD = spell.animationTime*1000 end end end function OnAnimation(unit, animationName) if unit.isMe and lastAnimation ~= animationName then lastAnimation = animationName end end function heroCanMove() return (GetTickCount() + GetLatency()/2 > lastAttack + lastWindUpTime + 20) end function timeToShoot() return (GetTickCount() + GetLatency()/2 > lastAttack + lastAttackCD) end function GetPathDistance(targetPosition) -- return true distance based on unit path path = Movement:CalculatePath(targetPosition) if path == nil or path.points == nil or #path.points == 1 then return math.huge else local distance = 0 for i, point in ipairs(path.points) do if i ~= #path.points then distance = distance + path.points[i]:distance(path.points[i+1]) end end return distance end end function moveToCursor() if GetDistance(mousePos) > 1 or lastAnimation == "Idle1" then local moveToPos = myHero + (Vector(mousePos) - myHero):normalized()*300 myHero:MoveTo(moveToPos.x, moveToPos.z) if shacoClone ~= nil then CastSpell(_R,moveToPos.x,moveToPos.z) end end end function PluginOnCreateObj(object) if object ~= nil and object.name:find("Jester_Copy") then shacoClone = object end end function PluginOnDeleteObj(object) if object ~= nil and object.name:find("Jester_Copy") then shacoClone = nil end end