Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CONSTANTS
- local Range_Q = 1075
- local Range_W = 950
- local Range_E = 400
- local Range_R = 450
- local Thresh = nil
- local ThreshPos = nil
- function AfterObjectLoopEvent(MyHero0)
- -- Get my hero, not entirely needed now as myHero works just as well
- Thresh = MyHero
- -- Your hero x,y,z
- ThreshPost = GetOrigin(Thresh)
- --Your target object
- CurrentTarget = GetCurrentTarget()
- DrawText("Thresh God loaded!",24,10,0,0xffff00ff);
- --Do when space pressed (if i recall correctly (iirc))
- if KeyIsDown(0x20) then -- Barra Espaciadora pulsada ejecutar abajo
- if CanUseSpell(localHero,_Q) == Ready then
- if GetDistance(CurrentTarget, Thresh) <= Range_Q then
- if GetCurrentHP(CurrentTarget) / GetMaxHP(CurrentTarget) < 0.9 then
- predictandcastq(CurrentTarget)
- end
- end
- end
- --guessing it's called threshq or threshqleap but enemy buff?
- --if GetBuffName(CurrentTarget,4) == "threshqleap"
- end
- end
- --Function to GetDistance (Can add library for it, but your learning so more code = better right lol)
- function GetDistanceSqr(p1,p2)
- p2 = p2 or GetMyHeroPos()
- local dx = p1.x - p2.x
- local dz = (p1.z or p1.y) - (p2.z or p2.y)
- return dx*dx + dz*dz
- end
- function predictandcastq(CurrentTarget)
- --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)
- --These can all be found on forum/league wiki or just ask :)
- local QPred = GetPredictionForPlayer(ThreshPost,CurrentTarget,GetMoveSpeed(CurrentTarget),1700,250,RANGE_Q,50,true,true)
- --The above Qpred will return values for the best x,y,z place for spell
- CastSkillShot(_Q,QPred.PredPos.X,QPred.PredPos.Y,QPred.PredPos.Z)
- end
- if KeyIsDown(0x20) then
- if CanUseSpell(localHero,_E) == Ready then
- if GetDistance(CurrentTarget, Thresh) <= Range_E then
- if GetCurrentHP(CurrentTarget) / GetMaxHP(CurrentTarget) < 0.9 then
- predictandcastE(CurrentTarget)
- end
- end
- end
- end
- function predictandcaste(CurrentTarget)
- -- CastStartPosVec,EnemyChampionPtr,EnemyMoveSpeed,YourSkillshotSpeed,SkillShotDelay,SkillShotRange,SkillShotWidth,MinionCollisionCheck,AddHitBox
- local EPred = GetPredictionForPlayer(GetMyHeroPos(),unit,GetMoveSpeed(unit),2000,250,400,110,false,true)
- CastSkillShot(_Q,QPred.PredPos.X,QPred.PredPos.Y,QPred.PredPos.Z)
- end
- if KeyIsDown(0x20) then
- if CanUseSpell(localHero,_R) == Ready then
- if GetDistance(CurrentTarget, Thresh) <= Range_R then
- if GetCurrentHP(CurrentTarget) / GetMaxHP(CurrentTarget) < 0.9 then
- predictandcastR(CurrentTarget)
- end
- end
- end
- end
- function predictandcastr(CurrentTarget)
- -- CastStartPosVec,EnemyChampionPtr,EnemyMoveSpeed,YourSkillshotSpeed,SkillShotDelay,SkillShotRange,SkillShotWidth,MinionCollisionCheck,AddHitBox
- local RPred = GetPredictionForPlayer(GetMyHeroPos(),unit,GetMoveSpeed(unit),2000,250,450,110,false,true)
- CastSkillShot(_Q,QPred.PredPos.X,QPred.PredPos.Y,QPred.PredPos.Z)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement