Untitled
unknown
lua
a year ago
818 B
7
Indexable
addLabel("Label", "Follow Name")
addTextEdit("TxtEdit", storage.fName or "name", function(widget, text)
storage.fName = text
end)
--------------------------
local lastPos = nil
macro(200, "Follow", function()
local leader = getCreatureByName(storage.fName)
local target = g_game.getAttackingCreature()
if leader then
if target and lastPos then
return player:autoWalk(lastPos,{ignoreNonPathable=true})
end
if not g_game.getFollowingCreature() then
return g_game.follow(leader)
end
elseif lastPos then
player:autoWalk(lastPos,{ignoreNonPathable=true})
end
end)
onCreaturePositionChange(function(creature, newPos, oldPos)
local leader = getCreatureByName(storage.fName)
if leader ~= creature or not newPos then return end
lastPos = newPos
end)Editor is loading...
Leave a Comment