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.
153
Walk on monster soul #64
This will walk on monster souls when added to map.
911b | 34 lines.
local iPos = nil
local iID = 34132
macro(500, "Walk on Monster Soul", function()
    if iPos then
        autoWalk(iPos, 100, { ignoreNonPathable = true })
    end
end)
UI.Button("Clear Position", function()
    iPos = nil
end)
onAddThing(function(tile, thing)
    if thing:getId() == iID then
        local tmpPosition = tile:getPosition()
        local pPosition = pos()

        if tmpPosition and pPosition then
            if tmpPosition.z == pPosition.z and getDistanceBetween(pos(), tmpPosition) <= 7 then
                iPos = tmpPosition
                return
            end
        end
    end
end)

onRemoveThing(function(tile, thing)
    if thing:getId() == iID then
        if tmpPosition and pPosition then
            if tmpPosition.z == pPosition.z and getDistanceBetween(pos(), tmpPosition) <= 7 then
                iPos = nil
                return
            end
        end
    end
end)

14 Oct 2021