manciuszz

Simple Automatic Target Selector Priority Arranger

May 14th, 2013
5,330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.93 KB | None | 0 0
  1. --[[
  2.     Simple TS Priority Arranger
  3.     Credits: Manciuszz & eXtragoZ
  4.  
  5.     Changelog:
  6.         > Updated priorityTable with new champion Aatrox, made Alistar, Nunu,Taric "Tank" priority.
  7.         > Now works in games with below 5 players.
  8.         > Target Selector mode switched from TARGET_LOW_HP_PRIORITY to TARGET_LESS_CAST_PRIORITY, because it is more reliable.
  9.             > Reduced 20 lines of code.
  10.  
  11.  ]] --
  12.  
  13. local priorityTable = {
  14.  
  15.     AP = {
  16.         "Ahri", "Akali", "Anivia", "Annie", "Brand", "Cassiopeia", "Diana", "Evelynn", "FiddleSticks", "Fizz", "Gragas", "Heimerdinger", "Karthus",
  17.         "Kassadin", "Katarina", "Kayle", "Kennen", "Leblanc", "Lissandra", "Lux", "Malzahar", "Mordekaiser", "Morgana", "Nidalee", "Orianna",
  18.         "Rumble", "Ryze", "Sion", "Swain", "Syndra", "Teemo", "TwistedFate", "Veigar", "Viktor", "Vladimir", "Xerath", "Ziggs", "Zyra", "MasterYi",
  19.     },
  20.     Support = {
  21.         "Blitzcrank", "Janna", "Karma", "Leona", "Lulu", "Nami", "Sona", "Soraka", "Thresh", "Zilean",
  22.     },
  23.  
  24.     Tank = {
  25.         "Amumu", "Chogath", "DrMundo", "Galio", "Hecarim", "Malphite", "Maokai", "Nasus", "Rammus", "Sejuani", "Shen", "Singed", "Skarner", "Volibear",
  26.         "Warwick", "Yorick", "Zac", "Nunu", "Taric", "Alistar",
  27.     },
  28.  
  29.     AD_Carry = {
  30.         "Ashe", "Caitlyn", "Corki", "Draven", "Ezreal", "Graves", "Jayce", "KogMaw", "MissFortune", "Pantheon", "Quinn", "Shaco", "Sivir",
  31.         "Talon", "Tristana", "Twitch", "Urgot", "Varus", "Vayne", "Zed", "Jinx"
  32.  
  33.     },
  34.  
  35.     Bruiser = {
  36.         "Darius", "Elise", "Fiora", "Gangplank", "Garen", "Irelia", "JarvanIV", "Jax", "Khazix", "LeeSin", "Nautilus", "Nocturne", "Olaf", "Poppy",
  37.         "Renekton", "Rengar", "Riven", "Shyvana", "Trundle", "Tryndamere", "Udyr", "Vi", "MonkeyKing", "XinZhao", "Aatrox"
  38.     },
  39.  
  40. }
  41.  
  42. function SetPriority(table, hero, priority)
  43.     for i=1, #table, 1 do
  44.         if hero.charName:find(table[i]) ~= nil then
  45.             TS_SetHeroPriority(priority, hero.charName)
  46.         end
  47.     end
  48. end
  49.  
  50. function arrangePrioritys(enemies)
  51.     local priorityOrder = {
  52.         [2] = {1,1,2,2,2},
  53.         [3] = {1,1,2,3,3},
  54.         [4] = {1,2,3,4,4},
  55.         [5] = {1,2,3,4,5},
  56.     }
  57.     for i, enemy in ipairs(GetEnemyHeroes()) do
  58.         SetPriority(priorityTable.AD_Carry, enemy, priorityOrder[enemies][1])
  59.         SetPriority(priorityTable.AP,       enemy, priorityOrder[enemies][2])
  60.         SetPriority(priorityTable.Support,  enemy, priorityOrder[enemies][3])
  61.         SetPriority(priorityTable.Bruiser,  enemy, priorityOrder[enemies][4])
  62.         SetPriority(priorityTable.Tank,     enemy, priorityOrder[enemies][5])
  63.     end
  64. end
  65.  
  66. function OnLoad()
  67.     if #GetEnemyHeroes() <= 1 then
  68.         PrintChat("No enemies, can't arrange priority's!")
  69.     else
  70.         TargetSelector(TARGET_LESS_CAST_PRIORITY, 0) -- Create a dummy target selector
  71.         arrangePrioritys(#GetEnemyHeroes())
  72.         PrintChat(" >> Arranged priority's!")
  73.     end
  74. end
Advertisement
Add Comment
Please, Sign In to add comment