So, I decided to post my first lua script because it helped me a lot to play with mutiples Tibia Clients. It's a really basic script to follow other players.
Commands:
follow "player name"
start
stop
If you are following one player and wants to follow another one, you must stop it first then use the command follow again.
Code:local target = ""
Module("autoFollow", function(module)
local player = Creature(target)
print(target)
if player:isOnScreen(true) then
Creature.Follow(target)
end
end, false)
function onSpeak(chat, msg)
chat:SendYellowMessage(Self.Name(), msg)
if (msg == "start") then
Module("autoFollow"):Start()
chat:SendOrangeMessage("Console", string.format("Started following %s.", target ))
elseif (msg == "stop") then
Module("autoFollow"):Stop()
chat:SendOrangeMessage("Console", "Stoped following.")
elseif msg:match("^name") then
local name = msg:match("^follow (.+)")
if name then
Module("autoFollow"):Stop()
target = name
chat:SendOrangeMessage("Control", "New player added.")
end
end
end
function onClose() end
local chat = Channel("autoFollow", onSpeak, onClose)