Advertisement
Guest User

trikata

a guest
May 24th, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.10 KB | None | 0 0
  1. --[[
  2. BouncingBlades 1.1 by eXtragoZ
  3.  
  4. The script calculates if the skill used to an creep hit a champion
  5. The script can consume a lot of cpu
  6. Code of monitoring of creeps taken from Minion Marker
  7.  
  8. Green circle on the creep: 1 bounce to hit him
  9. Blue circle on the creep: 2 bounces to hit him
  10. Light blue circle on the creep: 3 bounces to hit him
  11. Violet circle on the creep: 4 bounces to hit him
  12.  
  13. press C to hit the enemy without moving (prioritizes number of bounces)
  14. ]]
  15. local player = GetMyHero()
  16. if player.charName == "Katarina" then
  17. --[[            Config          ]]
  18. local BBHK=67 -- C
  19. local drawcircles = true
  20. --[[            Code            ]]
  21. local range = 2000
  22. local qrange = 675
  23. local maxbouncerange = 400
  24. local distanceenemy = 500
  25. local distancemax = 500
  26. --
  27. local minionTable1, minionTable2, minionTable3, minionTable4 = {}, {}, {}, {}
  28. local objminionTable, objminionTable2 = {}, {}
  29. local minion = nil
  30. local minion2 = nil
  31. local minion3 = nil
  32. local minion4 = nil
  33. -- Active
  34. local BBActive = false
  35. local qcast = false
  36. --
  37.  
  38. function OnTick()
  39.  
  40.         minionTable1, minionTable2, minionTable3, minionTable4 = {}, {}, {}, {}
  41.         objminionTable2 = {}
  42.         if not player.dead then
  43.                 for i,object in ipairs(objminionTable) do
  44.                         if object and object.team ~= player.team and object.type == "obj_AI_Minion" and object.dead == false and player:GetDistance(object) < range then
  45.                                 table.insert(objminionTable2, object)
  46.                         end
  47.                 end
  48.                 for i,object in ipairs(objminionTable2) do
  49.                         distancemax = 500
  50.                         minion = nil
  51.                         for e,object2 in ipairs(objminionTable2) do
  52.                                 if object.name ~= object2.name then
  53.                                         distanceenemy = math.sqrt((object2.x-object.x)^2 + (object2.z-object.z)^2)
  54.                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  55.                                                 distancemax = distanceenemy
  56.                                                 minion = object2
  57.                                         end
  58.                                 end    
  59.                         end
  60.                         for e=1, heroManager.iCount do
  61.                                 local enemy = heroManager:GetHero(e)
  62.                                 if enemy.team ~= player.team and enemy.visible and enemy.dead == false and player:GetDistance(enemy) < range then
  63.                                         distanceenemy = math.sqrt((enemy.x-object.x)^2 + (enemy.z-object.z)^2)
  64.                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  65.                                                 distancemax = distanceenemy
  66.                                                 minion = enemy
  67.                                         end
  68.                                 end
  69.                         end
  70.                         if minion ~= nil then
  71.                                 if minion.type == "obj_AI_Minion" then
  72.                                         distancemax = 500
  73.                                         minion2 = nil
  74.                                         for h,object3 in ipairs(objminionTable2) do
  75.                                                 if object3.name ~= object.name and object3.name ~= minion.name then
  76.                                                         distanceenemy = math.sqrt((object3.x-minion.x)^2 + (object3.z-minion.z)^2)
  77.                                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  78.                                                                 distancemax = distanceenemy
  79.                                                                 minion2 = object3
  80.                                                         end
  81.                                                 end    
  82.                                         end
  83.                                         for h=1, heroManager.iCount do
  84.                                                 local enemy = heroManager:GetHero(h)
  85.                                                 if enemy.team ~= player.team and enemy.visible and enemy.dead == false and player:GetDistance(enemy) < range then
  86.                                                         distanceenemy = math.sqrt((enemy.x-minion.x)^2 + (enemy.z-minion.z)^2)
  87.                                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  88.                                                                 distancemax = distanceenemy
  89.                                                                 minion2 = enemy
  90.                                                         end
  91.                                                 end
  92.                                         end
  93.                                         if minion2 ~= nil then
  94.                                                 if minion2.type == "obj_AI_Minion" then
  95.                                                         distancemax = 500
  96.                                                         minion3 = nil
  97.                                                         for k,object4 in ipairs(objminionTable2) do
  98.                                                                 if object4.name ~= object.name and object4.name ~= minion.name and object4.name ~= minion2.name then
  99.                                                                         distanceenemy = math.sqrt((object4.x-minion2.x)^2 + (object4.z-minion2.z)^2)
  100.                                                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  101.                                                                                 distancemax = distanceenemy
  102.                                                                                 minion3 = object4
  103.                                                                         end
  104.                                                                 end    
  105.                                                         end
  106.                                                         for k=1, heroManager.iCount do
  107.                                                                 local enemy = heroManager:GetHero(k)
  108.                                                                 if enemy.team ~= player.team and enemy.visible and enemy.dead == false and player:GetDistance(enemy) < range then
  109.                                                                         distanceenemy = math.sqrt((enemy.x-minion2.x)^2 + (enemy.z-minion2.z)^2)
  110.                                                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  111.                                                                                 distancemax = distanceenemy
  112.                                                                                 minion3 = enemy
  113.                                                                         end
  114.                                                                 end
  115.                                                         end
  116.                                                         if minion3 ~= nil then
  117.                                                                 if minion3.type == "obj_AI_Minion" then
  118.                                                                         distancemax = 500
  119.                                                                         minion4 = nil
  120.                                                                         for j,object5 in ipairs(objminionTable2) do
  121.                                                                                 if object5.name ~= object.name and object5.name ~= minion.name and object5.name ~= minion2.name and object5.name ~= minion3.name then
  122.                                                                                         distanceenemy = math.sqrt((object5.x-minion3.x)^2 + (object5.z-minion3.z)^2)
  123.                                                                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  124.                                                                                                 distancemax = distanceenemy
  125.                                                                                                 minion4 = object5
  126.                                                                                         end
  127.                                                                                 end    
  128.                                                                         end
  129.                                                                         for j=1, heroManager.iCount do
  130.                                                                                 local enemy = heroManager:GetHero(j)
  131.                                                                                 if enemy.team ~= player.team and enemy.visible and enemy.dead == false and player:GetDistance(enemy) < range then
  132.                                                                                         distanceenemy = math.sqrt((enemy.x-minion3.x)^2 + (enemy.z-minion3.z)^2)
  133.                                                                                         if distancemax > distanceenemy and maxbouncerange > distanceenemy then
  134.                                                                                                 distancemax = distanceenemy
  135.                                                                                                 minion4 = enemy
  136.                                                                                         end
  137.                                                                                 end
  138.                                                                         end
  139.                                                                         if minion4 ~= nil then
  140.                                                                                 if minion4.type == "obj_AI_Minion" then
  141.                                                                                 else
  142.                                                                                         table.insert(minionTable4, object)
  143.                                                                                 end
  144.                                                                         end
  145.                                                                 else
  146.                                                                         table.insert(minionTable3, object)
  147.                                                                 end
  148.                                                         end
  149.                                                 else
  150.                                                         table.insert(minionTable2, object)
  151.                                                 end
  152.                                         end
  153.                                 else
  154.                                         table.insert(minionTable1, object)
  155.                                 end
  156.                         end
  157.                 end
  158.                
  159.                 qcast = false
  160.                 if BBActive and player:CanUseSpell(_Q) == READY then
  161.                         for i=1, heroManager.iCount do
  162.                                 local enemy = heroManager:GetHero(i)
  163.                                 if enemy.team ~= player.team and enemy.visible and enemy.dead == false and player:GetDistance(enemy) < qrange and qcast == false then
  164.                                         CastSpell(_Q, enemy)
  165.                                         qcast = true
  166.                                 end
  167.                         end
  168.                         if qcast == false then
  169.                                 for i,object in ipairs(minionTable1) do
  170.                                         if player:GetDistance(object) < qrange and qcast == false then
  171.                                                 CastSpell(_Q, object)
  172.                                                 qcast = true
  173.                                         end
  174.                                 end
  175.                         end
  176.                         if qcast == false then
  177.                                 for i,object in ipairs(minionTable2) do
  178.                                         if player:GetDistance(object) < qrange and qcast == false then
  179.                                                 CastSpell(_Q, object)
  180.                                                 qcast = true
  181.                                         end
  182.                                 end
  183.                         end
  184.                         if qcast == false then
  185.                                 for i,object in ipairs(minionTable3) do
  186.                                         if player:GetDistance(object) < qrange and qcast == false then
  187.                                                 CastSpell(_Q, object)
  188.                                                 qcast = true
  189.                                         end
  190.                                 end
  191.                         end
  192.                         if qcast == false then
  193.                                 for i,object in ipairs(minionTable4) do
  194.                                         if player:GetDistance(object) < qrange and qcast == false then
  195.                                                 CastSpell(_Q, object)
  196.                                                 qcast = true
  197.                                         end
  198.                                 end
  199.                         end
  200.                 end
  201.         end
  202. end
  203.  
  204. function OnDraw()
  205.         if drawcircles and not player.dead then
  206.                 --DrawCircle(player.x, player.y, player.z, qrange, 0x19A712)
  207.                 for i, object in ipairs(minionTable1) do
  208.                         if object and object.dead == false then
  209.                                 DrawCircle(object.x, object.y, object.z, 100, 0x19A712)
  210.                         end
  211.         end
  212.                 for i, object in ipairs(minionTable2) do
  213.                         if object and object.dead == false then
  214.                                 DrawCircle(object.x, object.y, object.z, 100, 0x0000FF)
  215.                         end
  216.         end
  217.                 for i, object in ipairs(minionTable3) do
  218.                         if object and object.dead == false then
  219.                                 DrawCircle(object.x, object.y, object.z, 100, 0xFFFFFF)
  220.                         end
  221.         end
  222.                 for i, object in ipairs(minionTable4) do
  223.                         if object and object.dead == false then
  224.                                 DrawCircle(object.x, object.y, object.z, 100, 0xFF00FF)
  225.                         end
  226.         end
  227.         end
  228. end
  229.  
  230. function OnCreateObj(obj)
  231.         if obj and obj.type == "obj_AI_Minion" then
  232.                 if (string.find(obj.name,"T200") or string.find(obj.name,"Red")) and player.team == TEAM_BLUE then
  233.                         table.insert(objminionTable, obj)
  234.                 elseif (string.find(obj.name,"T100") or string.find(obj.name,"Blue")) and player.team == TEAM_RED then
  235.                         table.insert(objminionTable, obj)
  236.                 end
  237.         end
  238. end
  239.  
  240. function OnDeleteObj(obj)
  241.         for i,v in ipairs(objminionTable) do
  242.                 if string.find(obj.name, v.name) then
  243.                         table.remove(objminionTable,i)
  244.                 end
  245.         end
  246. end
  247.  
  248. function BBLoadMinions()
  249.         local count = objManager.maxObjects
  250.         for i=1, count do
  251.                 local object = objManager:getObject(i)
  252.                 if object and object.team ~= player.team and object.type == "obj_AI_Minion" and object.dead == false then
  253.                         table.insert(objminionTable, object)
  254.                 end
  255.         end
  256. end
  257. function OnWndMsg(msg,key)
  258.         if key == BBHK then
  259.                 BBActive = (msg == KEY_DOWN)
  260.         end    
  261. end
  262.  
  263. function OnLoad()
  264.         BBLoadMinions()
  265. end
  266. PrintChat(" >> BouncingBlades 1.1 loaded!")
  267. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement