Advertisement
Guest User

thrshgod

a guest
Jul 19th, 2015
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. -- CONSTANTS
  2. local Range_Q = 1075
  3. local Range_W = 950
  4. local Range_E = 400
  5. local Range_R = 450
  6.  
  7. local Thresh = nil
  8. local ThreshPos = nil
  9.  
  10. function AfterObjectLoopEvent(MyHero0)
  11.  
  12. -- Get my hero, not entirely needed now as myHero works just as well
  13. Thresh = MyHero
  14. -- Your hero x,y,z
  15. ThreshPost = GetOrigin(Thresh)
  16. --Your target object
  17. CurrentTarget = GetCurrentTarget()
  18.  
  19. DrawText("Thresh God loaded!",24,10,0,0xffff00ff);
  20.  
  21. --Do when space pressed (if i recall correctly (iirc))
  22. if KeyIsDown(0x20) then -- Barra Espaciadora pulsada ejecutar abajo
  23.  
  24. if CanUseSpell(localHero,_Q) == Ready then
  25.  
  26. if GetDistance(CurrentTarget, Thresh) <= Range_Q then
  27.  
  28. if GetCurrentHP(CurrentTarget) / GetMaxHP(CurrentTarget) < 0.9 then
  29.  
  30. predictandcastq(CurrentTarget)
  31.  
  32. end
  33. end
  34.  
  35. end
  36.  
  37. --guessing it's called threshq or threshqleap but enemy buff?
  38. --if GetBuffName(CurrentTarget,4) == "threshqleap"
  39.  
  40. end
  41.  
  42. end
  43.  
  44. --Function to GetDistance (Can add library for it, but your learning so more code = better right lol)
  45. function GetDistanceSqr(p1,p2)
  46. p2 = p2 or GetMyHeroPos()
  47. local dx = p1.x - p2.x
  48. local dz = (p1.z or p1.y) - (p2.z or p2.y)
  49. return dx*dx + dz*dz
  50. end
  51.  
  52.  
  53. function predictandcastq(CurrentTarget)
  54.  
  55. --Prediction is made up of (The position of current hero, the target, movement speed of target, spell delay (how long it takes to cast), spell range, Spell hit width, then collision check and hitbox)
  56. --These can all be found on forum/league wiki or just ask :)
  57. local QPred = GetPredictionForPlayer(ThreshPost,CurrentTarget,GetMoveSpeed(CurrentTarget),1700,250,RANGE_Q,50,true,true)
  58.  
  59. --The above Qpred will return values for the best x,y,z place for spell
  60. CastSkillShot(_Q,QPred.PredPos.X,QPred.PredPos.Y,QPred.PredPos.Z)
  61.  
  62. end
  63.  
  64. if KeyIsDown(0x20) then
  65. if CanUseSpell(localHero,_E) == Ready then
  66.  
  67. if GetDistance(CurrentTarget, Thresh) <= Range_E then
  68.  
  69. if GetCurrentHP(CurrentTarget) / GetMaxHP(CurrentTarget) < 0.9 then
  70.  
  71. predictandcastE(CurrentTarget)
  72.  
  73. end
  74. end
  75.  
  76. end
  77. end
  78.  
  79. function predictandcaste(CurrentTarget)
  80. -- CastStartPosVec,EnemyChampionPtr,EnemyMoveSpeed,YourSkillshotSpeed,SkillShotDelay,SkillShotRange,SkillShotWidth,MinionCollisionCheck,AddHitBox
  81. local EPred = GetPredictionForPlayer(GetMyHeroPos(),unit,GetMoveSpeed(unit),2000,250,400,110,false,true)
  82.  
  83. CastSkillShot(_Q,QPred.PredPos.X,QPred.PredPos.Y,QPred.PredPos.Z)
  84. end
  85.  
  86. if KeyIsDown(0x20) then
  87. if CanUseSpell(localHero,_R) == Ready then
  88.  
  89. if GetDistance(CurrentTarget, Thresh) <= Range_R then
  90.  
  91. if GetCurrentHP(CurrentTarget) / GetMaxHP(CurrentTarget) < 0.9 then
  92.  
  93. predictandcastR(CurrentTarget)
  94.  
  95. end
  96. end
  97.  
  98. end
  99. end
  100.  
  101. function predictandcastr(CurrentTarget)
  102. -- CastStartPosVec,EnemyChampionPtr,EnemyMoveSpeed,YourSkillshotSpeed,SkillShotDelay,SkillShotRange,SkillShotWidth,MinionCollisionCheck,AddHitBox
  103. local RPred = GetPredictionForPlayer(GetMyHeroPos(),unit,GetMoveSpeed(unit),2000,250,450,110,false,true)
  104.  
  105. CastSkillShot(_Q,QPred.PredPos.X,QPred.PredPos.Y,QPred.PredPos.Z)
  106. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement