Untitled

 avatar
unknown
plain_text
a year ago
829 B
11
Indexable
UI.Label("Auto Follow")

addTextEdit("followleader", storage.followLeader or "player name", function(widget, text)
  storage.followLeader = text
end)

--Code
local toFollowPos = {}
local followMacro = macro(20, "Follow", function()
  local target = getCreatureByName(storage.followLeader)
  if target then
    local tpos = target:getPosition()
    toFollowPos[tpos.z] = tpos
  end

  if player:isWalking() then return end
  local p = toFollowPos[posz()]
  if not p then return end

  if autoWalk(p, 20, {ignoreNonPathable=false, precision=1, marginMin=2, marginMax=2}) then
    delay(100)
  end
end)

local function checkPos(x, y)
 xyz = g_game.getLocalPlayer():getPosition()
 xyz.x = xyz.x + x
 xyz.y = xyz.y + y
 tile = g_map.getTile(xyz)
 if tile then
  return g_game.use(tile:getTopUseThing())  
 else
  return false
 end
end
Editor is loading...
Leave a Comment