16HeX16

Poppy Assistant

Oct 26th, 2013
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. --[[    Poppy Assistant by HeX  ]]--
  2.  
  3. if myHero.charName ~= "Poppy" then return end
  4.  
  5. require "MapPosition"
  6.  
  7. if VIP_USER then
  8.     require "Prodiction"
  9.     local Prodiction = ProdictManager.GetInstance()
  10.     tp = Prodiction:AddProdictionObject(_E, 525, 1600, 0.25, 10, myHero)
  11. else
  12.     tp = TargetPrediction(rangeMax, 1600, 250)
  13. end
  14.  
  15. --[[    Code    ]]--
  16. local stunDistance, eRange = 300, 525
  17.  
  18. function OnLoad()
  19.     PrintChat("<font color='#CCCCCC'> >> Poppy Assistant loaded! <<</font>")
  20.     PSConfig = scriptConfig("Poppy Assistant", "PoppyAssistant")
  21.     PSConfig:addParam("autoStun", "Auto-Stun", SCRIPT_PARAM_ONOFF, true)
  22.     PSConfig:permaShow("autoStun")
  23.     mapPosition = MapPosition()
  24. end
  25.  
  26. function OnTick()
  27.     if PSConfig.autoStun and myHero:CanUseSpell(_E) == READY then
  28.         for i=1, heroManager.iCount do
  29.             Target = heroManager:getHero(i)
  30.             if Target and ValidTarget(Target) and GetDistance(Target) <= eRange then
  31.                 if AgainstWall(Target) then
  32.                     if GetDistance(Target) <= eRange then
  33.                         CastSpell(_E, Target)
  34.                     end
  35.                 end
  36.             end
  37.         end
  38.     end
  39. end
  40.  
  41. function AgainstWall(target)
  42.     local ePred = tp:GetPrediction(target)
  43.     if ePred then
  44.         TargetPos = Vector(ePred.x, ePred.y, ePred.z)
  45.         MyPos = Vector(myHero.x, myHero.y, myHero.z)
  46.         StunPos = TargetPos + (TargetPos - MyPos)*((stunDistance/GetDistance(ePred)))
  47.         if StunPos and mapPosition:intersectsWall(Point(StunPos.x, StunPos.z)) then return true end
  48.     end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment