09-17-2021, 04:28 PM
Auto follow player and walk on fields
local Player = ''
local Monsters = { '' }
local FIELDS_IDS = { 2118, 2119, 2123, 2124, 2131, 2132, 2137, 2138, 2121, 2127, 2134, 2136, 2122, 2126, 2135 }
local monsters_around = maroundreachable(0, table.unpack(Monsters))
if monsters_around == 0 and target().id == 0 then
local creature = getcreature(Player)
if creature.id > 0 and creature.dist > 1 then
local tile = gettile(creature.posx, creature.posy, creature.posz)
local foundFields = false
if tile ~= nil and tile.posx > 0 then
for _, item in ipairs(tile.items) do
if table.find(FIELDS_IDS, item.id) ~= nil then
foundFields = true
break
end
end
end
if foundFields then
while creature.id > 0 and creature.dist > 1 do
reachcreature(Player)
creature = getcreature(Player)
end
else
local follow_creature = followed()
if follow_creature.id == 0 or (follow_creature.id > 0 and follow_creature.name:lower() ~= Player:lower()) then
follow(Player)
wait(1000)
end
end
elseif monsters_around > 0 and followed().id > 0 then
stop()
end