Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Request API


  • Please log in to reply
No replies to this topic

#1
gamsteron

gamsteron

    Advanced Member

  • Scripts Developer
  • 931 posts

Game.IsCursorOnTarget() -> important for draven, melee orbwalker

 

Custom

local CURSOR_TARGETS = {}
local GameHeroCount, GameHero, GameMinionCount, GameMinion, GameTurretCount, GameTurret = Game.HeroCount, Game.Hero, Game.MinionCount, Game.Minion, Game.TurretCount, Game.Turret
function CURSOR.IsCursorOnTarget(pos)
    pos = Vector(pos)
    if #CURSOR_TARGETS == 0 then
        for i = 1, GameHeroCount() do
            local unit = GameHero(i)
            if unit and unit.valid and not unit.isAlly and unit.alive and unit.isTargetable and unit.visible and unit.distance < 2500 then
                TableInsert(CURSOR_TARGETS, { unit.pos, unit.boundingRadius + 120 })
            end
        end
        for i = 1, GameMinionCount() do
            local unit = GameMinion(i)
            if unit and unit.valid and not unit.isAlly and unit.alive and unit.isTargetable and unit.visible and unit.distance < 2500 then
                TableInsert(CURSOR_TARGETS, { unit.pos, unit.boundingRadius + 120 })
            end
        end
        for i = 1, GameTurretCount() do
            local unit = GameTurret(i)
            if unit and unit.valid and not unit.isAlly and unit.alive and unit.isTargetable and unit.visible and unit.distance < 2500 then
                TableInsert(CURSOR_TARGETS, { unit.pos, unit.boundingRadius + 50 })
            end
        end
    end
    for i = 1, #CURSOR_TARGETS do
        local item = CURSOR_TARGETS[i]
        if pos:DistanceTo(item[1]) < item[2] then
            return true
        end
    end
    return false
end
Callback.Add('Load', function()
    Callback.Add('Tick', function()
        CURSOR_TARGETS = {}
    end)
end)

  • 1




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users