API:
WP_Moving(unit) - return boolean true/false - unit is moving or not WP_Time(unit) - return number - last changed path, game time/ticks WP_Path(unit) - return table with current path -WP_Path(unit)[1] - startpos,WP_Path(unit)[#WP_Path(unit)] - endpos WP_DistOnPath(unit) - return number - current distance from startpos to unitpos ON PATH! WP_TravelDist(unit) - return number - distance fromWP_Path(unit)[1] to WP_Path(unit)[2] + ... +WP_Path(unit)[#WP_Path(unit)-1] to WP_Path(unit)[#WP_Path(unit)] WP_GetExtendedPointOnPath(unit, s) - return Extended Vector from unit to position on path WP_InterceptionTime(source, startP, endP, unitspeed, spellspeed) - return Interception of Two Moving Objects, source - spell or player or ball etc. position, startp - unit position, endp - unit future position on path WP_GetPredPointOnPath(source, unit, speed, width, delay) - return Predicted Position, source - object from, unit - object to WP_ExtendedPosition(vec1, vec2, s) - return Extended Position from vec2 to vec1, s - distance WP_NormalizeVector(vec) - return normalized Vector WP_DistPointLineSegment(a, b, c) - return number - distance from segment line (a-b) to point (c) WP_MCollision(source, castpos, range, speed, width, delay) - return table with collisionable minions, castpos - interception point. #WP_MCollision(source, castpos, range, speed, width, delay) -> collision count WP_HCollision(source, unit, castpos, range, speed, width, delay) - return table with collisionable enemy heroes, unit - eliminate current target, castpos - interception point. #WP_HCollision(source, castpos, range, speed, width, delay) -> collision count
Examples:
-- EXTENDED MYHERO POSITION require "gsopath" OnDraw(function() local expos = WP_GetExtendedPointOnPath(myHero, 1000) if expos and expos.x then DrawCircle(expos, 30, 1, 1, GoS.White) end end) -- DRAW collisionable minions (red circle) + Predict Position for Ryze Q (white circle - if no collision) require "gsopath" local Q = { range = 1000, speed = 1700, width = 60, delay = 0.25 } OnDraw(function() local unit = GetCurrentTarget() if unit and ValidTarget(unit, Q.range) then local predpos = WP_GetPredPointOnPath(myHero, unit, Q.speed, Q.width, Q.delay) if predpos and predpos.x then if math.sqrt( (predpos.x-myHero.pos.x)^2 + (predpos.z-myHero.pos.z)^2 ) < Q.range - (Q.width/2) then local mcolcount = WP_MCollision(myHero, predpos, Q.range, Q.speed, Q.width, Q.delay) if #mcolcount > 0 then for i = 1, #mcolcount, 1 do DrawCircle(GetOrigin(mcolcount[i]), 30, 1, 1, GoS.Red) end else DrawCircle(predpos, 30, 1, 1, GoS.White) end end end end end) -- CAST Ryze Q require "gsopath" local Q = { range = 1000, speed = 1700, width = 60, delay = 0.25 } OnTick(function() CastQ() end) function CastQ() if not IsReady(_Q) then return end local unit = GetCurrentTarget() if unit and ValidTarget(unit, Q.range) then local predpos = WP_GetPredPointOnPath(myHero, unit, Q.speed, Q.width, Q.delay) if predpos and predpos.x then if math.sqrt( (predpos.x-myHero.pos.x)^2 + (predpos.z-myHero.pos.z)^2 ) < Q.range - (Q.width/2) then local mcolcount = WP_MCollision(myHero, predpos, Q.range, Q.speed, Q.width, Q.delay) if #mcolcount == 0 then CastSkillShot(_Q, predpos) end end end end end
Library: https://pastebin.com/3FWSZb73
Edited by gamsteron, 21 September 2018 - 07:37 .