local Objects = {435, 1948, 7771} local Doors = {7727, 8265, 1629, 1632, 8266, 7728, 1211, 1220, 1224, 1228, 1233, 1238, 1242, 1246, 1251, 1256, 1260, 1540, 3546, 3548, 3550, 3552, 4915, 5083, 5109, 5111, 5113, 5115, 5127, 5129, 5131, 5133, 5142, 5145, 5283, 5285, 5289, 5293, 5516, 5737, 5749, 6194, 6199, 6203, 6207, 6251, 6256, 6260, 6264, 6798, 6802, 6902, 6904, 6906, 6908, 7044, 7046, 7048, 7050, 7055, 8543, 8548, 8552, 8556, 9167, 9172, 9269, 9274, 9274, 9269, 9278, 9282, 10270, 10275, 10279, 10283, 10479, 10481, 10485, 10483, 10786, 12101, 12199, 19851, 19853, 19991, 19993, 20284, 20286, 17238, 13021, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290, 22825, 22827, 22829, 22831, 1214, 1222, 1226, 1230, 1236, 1240, 1244, 1248, 1254, 1258, 1262, 1542, 3537, 3539, 3541, 3543, 4918, 5085, 5100, 5102, 5104, 5106, 5118, 5120, 5122, 5124, 5136, 5139, 5280, 5287, 5291, 5295, 5518, 5734, 5746, 6197, 6201, 6205, 6209, 6254, 6258, 6262, 6266, 6796, 6800, 6893, 6895, 6897, 6899, 7035, 7037, 7039, 7041, 7057, 8546, 8550, 8554, 8558, 9170, 9174, 9272, 9276, 9280, 9284, 10273, 10277, 10281, 10285, 10470, 10472, 10476, 10474, 10777, 12094, 12190, 19842, 19844, 19982, 19984, 20275, 20277, 17236, 18209, 13023, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281, 22816, 22818, 22820, 22822, 1224, 1226, 1228, 1230, 1242, 1244, 1246, 1248, 1256, 1258, 1260, 1262, 3541, 3543, 3550, 3552, 5104, 5106, 5113, 5115, 5122, 5124, 5131, 5133, 5289, 5291, 5293, 5295, 6203, 6205, 6207, 6209, 6260, 6262, 6264, 6266, 6897, 6899, 6906, 6908, 7039, 7041, 7048, 7050, 8552, 8554, 8556, 8558, 9176, 9178, 9180, 9182, 9278, 9280, 9282, 9284, 10279, 10281, 10283, 10285, 10474, 10476, 10483, 10485, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290, 1223, 1225, 1241, 1243, 1255, 1257, 3542, 3551, 5105, 5114, 5123, 5132, 5288, 5290, 5745, 5748, 6202, 6204, 6259, 6261, 6898, 6907, 7040, 7049, 8551, 8553, 9175,9177, 9277, 9279, 10278, 10280, 10475, 10484, 10782, 12097, 19847, 19987, 20280, 10791, 12104, 12204, 12195, 19856, 19996, 20289, 22821, 22830, 1227, 1229, 1245, 1247, 1259, 1261, 3540, 3549, 5103, 5112, 5121, 5130, 5292, 5294, 6206, 6208, 6263, 6265, 6896, 6905, 7038, 7047, 8555, 8557,9179, 9181, 9281, 9283, 10282, 10284, 10473, 10482, 10780, 10789, 10780, 12095, 12195, 19845, 19985, 20278, 10789, 12102, 12193, 12202, 19854, 19994, 20287} followName = "Name" if not storage[followName] then storage[followName] = { player = 'name'} end local toFollowPos = {} UI.Separator() UI.Label("Auto Follow") followTE = UI.TextEdit(storage[followName].player or "name", function(widget, newText) storage[followName].player = newText end) local followChange = macro(200, "Follow Change", function() end) local followMacro = macro(20, "Follow", function() local position = pos() local target = getCreatureByName(storage[followName].player) if target then local tpos = target:getPosition() toFollowPos[tpos.z] = tpos end if not player:isWalking() and target and (getDistanceBetween(pos(), target:getPosition()) >2) then for i,interact in ipairs(Doors) do if (player:getDirection() == 1 or player:getDirection() == 3) then for x=-1,2,2 do position["x"] = posx() + x position["y"] = posy() for y=-1,3,2 do if g_map.getTile(position) then for u,item in ipairs(g_map.getTile(position):getItems()) do if item:getId() == interact then g_game.use(item) return end end position["y"] = posy()+y end end end end position = pos() if (player:getDirection() == 0 or player:getDirection() == 2) then for y=-1,2,2 do position["x"] = posx() position["y"] = posy()+y for x=-1,3,2 do for u,item in ipairs(g_map.getTile(position):getItems()) do if item:getId() == interact then g_game.use(item) return end end position["x"] = posx()+x end end end position = pos() end elseif not player:isWalking() and not target and toFollowPos[posz()] then for i,interact in ipairs(Objects) do for x=-1,2,1 do for y=-1,2,1 do position["x"] = toFollowPos[posz()].x + x position["y"] = toFollowPos[posz()].y + y if getDistanceBetween(pos(), position) <= 8 and g_map.getTile(position) then for u,item in ipairs(g_map.getTile(position):getItems()) do if item:getId() == interact then g_game.use(item) delay(500) end end end end end end end local p = toFollowPos[posz()] if not p then return end if autoWalk(p, 20, { ignoreNonPathable = true, precision = 1}) then delay(100) end end) UI.Separator() onPlayerPositionChange(function(newPos, oldPos) if followChange:isOff() then return end if (g_game.isFollowing()) then tfollow = g_game.getFollowingCreature() if tfollow then if tfollow:getName() ~= storage[followName].player then followTE:setText(tfollow:getName()) storage[followName].player = tfollow:getName() end end end end) onCreaturePositionChange(function(creature, newPos, oldPos) if creature:getName() == storage[followName].player and newPos then toFollowPos[newPos.z] = newPos end end)