Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
2.3K
Suggestions
Move green text to channel | 01/01/20 | 2.9K
Container Config | 23/11/21 | 6.9K
Firebomb Behind | 05/10/24 | 886
In-game timers | 04/10/24 | 3.9K
TargetBot Toggle | 04/10/24 | 2.8K
Walk on monster soul | 14/10/21 | 1.6K
Smarter skull targeting #12

This will target creatures with a black skull first, then other skulls and then lowest health found.

1.03kb | 27 lines.
--[[
  Script made by Lee (Discord: l33_) - www.trainorcreations.com
  If you want to support my work, feel free to donate at https://trainorcreations.com/donate
  PS. Stop ripping off my work and selling it as your own.
]]--
macro(100, "Smart Skull Targeting", function()
    if isInPz() then return end

    local skulls = { [1] = true, [2] = true, [3] = true, [4] = true, [5] = true, [6] = true }
    local target, lowest_health, max_distance, closest_distance = nil, 101, 6, 6

    for _, spec in pairs(getSpectators()) do
        local distance = getDistanceBetween(player:getPosition(), spec:getPosition())

        if spec:isMonster() and distance <= max_distance then
            local skull = spec:getSkull()

            if skull == 5 then
                target, closest_distance = spec, distance
                break
            elseif skulls[skull] and distance < closest_distance then
                target, closest_distance = spec, distance
            elseif not target and spec:getHealthPercent() < lowest_health then
                lowest_health, target, closest_distance = spec:getHealthPercent(), spec, distance
            end
        end
    end

    if target and g_game.getAttackingCreature() ~= target then
        g_game.attack(target)
    end
end)

04 Oct 2024
Ads