16HeX16

Ward Jump

Mar 30th, 2013
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.72 KB | None | 0 0
  1. --[[    Smart Jump 2.0
  2.  
  3. Original Author and All Credits to ikita
  4. Updated by HeX
  5.    
  6. Attempts to ward jump (Stones->Vision->Sight->Wriggles).
  7.  
  8. ]]
  9.  
  10. --[[        Config      ]]
  11. local myObjectsTable = {}
  12. local wardRange = 600
  13. local jumpDelay = 0
  14. local SWard, VWard, SStone, RSStone, Wriggles = 2044, 2043, 2049, 2045, 3154
  15. local SWardSlot, VWardSlot, SStoneSlot, RSStoneSlot, WrigglesSlot = nil, nil, nil, nil, nil
  16. local lastJump = 0
  17. local wardTarget
  18. local jumpReady = false
  19.  
  20. function OnLoad()
  21.     PrintChat("<font color='#CCCCCC'> >> Smart Jump 2.0 loaded! <<</font>")
  22.     PrintChat("<font color='#CCCCCC'> >> Credit to ikita <<</font>")
  23.     PrintChat("<font color='#CCCCCC'> >> Updated by HeX <<</font>")
  24.     SJConfig = scriptConfig("Smart Jump Config", "SmartJump")
  25.     SJConfig:addParam("drawActive", "Draw", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  26.     SJConfig:addParam("jumpActive", "Ward jump", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  27.     SJConfig:permaShow("jumpActive")
  28.     lastJump = 0
  29.    
  30.     if player.charName == "Katarina" then
  31.         jumpSlot = _E
  32.         jumpRange = 700
  33.         elseif player.charName == "Jax" then
  34.         jumpSlot = _Q
  35.         jumpRange = 700
  36.         elseif player.charName == "LeeSin" then
  37.         jumpSlot = _W
  38.         jumpRange = 700
  39.         else
  40.         jumpSlot = nil
  41.         jumpRange = 0
  42.     end
  43.    
  44.     for i = 0, objManager.maxObjects, 1 do
  45.         local object = objManager:GetObject(i)
  46.         if objectIsValid(object) then table.insert(myObjectsTable, object) end
  47.     end
  48. end
  49.  
  50. function OnTick()
  51.     if jumpReady == true and GetTickCount() - lastJump > jumpDelay then
  52.         jumpNowAlready()
  53.     end
  54.     if SJConfig.jumpActive then
  55.         local wardSqr = math.sqrt((mousePos.x - myHero.x)^2+(mousePos.z - myHero.z)^2)
  56.         local x = myHero.x + wardRange*((mousePos.x - myHero.x)/wardSqr)
  57.         local z = myHero.z + wardRange*((mousePos.z - myHero.z)/wardSqr)
  58.         SWardSlot = GetInventorySlotItem(SWard)
  59.         VWardSlot = GetInventorySlotItem(VWard)
  60.         SStoneSlot = GetInventorySlotItem(SStone)
  61.         RSStoneSlot = GetInventorySlotItem(RSStone)
  62.         WrigglesSlot = GetInventorySlotItem(Wriggles)
  63.        
  64.         if RSStoneSlot ~= nil and CanUseSpell(RSStoneSlot) == READY then
  65.             wardSlot = RSStoneSlot else
  66.             if SStoneSlot ~= nil and CanUseSpell(SStoneSlot) == READY then
  67.                 wardSlot = SStoneSlot else
  68.                 if SWardSlot ~= nil then
  69.                     wardSlot = SWardSlot else
  70.                     if VWardSlot ~= nil then
  71.                         wardSlot = VWardSlot else  
  72.                         if WrigglesSlot ~= nil then
  73.                             wardSlot = WrigglesSlot
  74.                             else wardSlot = nil
  75.                         end
  76.                     end
  77.                 end
  78.             end
  79.         end
  80.  
  81.         if wardSlot ~= nil and jumpSlot ~= nil then
  82.             if player:CanUseSpell(jumpSlot) == READY and GetTickCount() - lastJump > 5000 then
  83.                 CastSpell(wardSlot, x, z)
  84.                 jumpReady = true
  85.                 lastJump = GetTickCount()
  86.             end
  87.         end
  88.     end
  89. end
  90.  
  91. --[[        if wardSlot ~= nil and jumpSlot ~= nil then
  92.             if player:CanUseSpell(jumpSlot) == READY and GetTickCount() - lastJump > 2000 then
  93.                 CastSpell(wardSlot, x, z)
  94.                 jumpReady = true
  95.                 lastJump = GetTickCount()
  96.             end
  97.         end
  98.     end]]
  99.  
  100. function objectIsValid(object)
  101.    return object and object.valid and (string.find(object.name, "Ward") ~= nil or string.find(object.name, "Wriggle") ~= nil)
  102. end
  103.  
  104. function jumpNowAlready()
  105.     if SJConfig.jumpActive and jumpReady == true then
  106.         for i,object in ipairs(myObjectsTable) do
  107.             if object ~= nil and object.valid and GetDistance(object) <= jumpRange then
  108.                 if GetDistance(object, mousePos) <= 250 then
  109.                     CastSpell(jumpSlot, object)
  110.                     jumpReady = false
  111.                 end
  112.                 else table.remove(myObjectsTable, i) i = i - 1
  113.             end
  114.         end
  115.     end
  116. end
  117.  
  118. function OnCreateObj(object)
  119.     if objectIsValid(object) then table.insert(myObjectsTable, object) end
  120. end
  121.  
  122. function OnDraw()
  123.     if SJConfig.drawActive and not myHero.dead then
  124.         DrawCircle(myHero.x, myHero.y, myHero.z, wardRange, 0x0000FF)
  125.     end
  126. end
Advertisement
Add Comment
Please, Sign In to add comment