Log in

View Full Version : Follow Npc



szczeryy
11-14-2015, 07:33 PM
Hello, i need script for follow NPC and script for say in trade.

Creature.Follow("Sebastian") -- dont work

Rif
11-15-2015, 11:22 AM
Make sure that you play on real tiba.

paste into script


local toFollow = 'Sebastian' -- npc to follow

Module.New('Follow', function()
getNpc = function(name)
getInfo = {}
npc = Creature.New(name)
if npc:ID() ~= (0 or nil) then
if npc:isOnScreen() then
getInfo = {pos = {x = npc:Position().x, y = npc:Position().y, z = npc:Position().z}, id = npc:ID(), creature = npc}
end
end
return getInfo
end
for x = -1, 1 do
for y = -1, 1 do
local set = getNpc(toFollow)
if set.creature ~= nil then
if set.creature:DistanceFromSelf() > 1 then
if Map.IsTileWalkable(set.pos.x+x, set.pos.y+y, set.pos.z) then
Self.WalkTo(set.pos.x+x, set.pos.y+y, set.pos.z)
wait(1000, 1500)
break
end
end
end
end
end
end, false)

working smooth on label

function checking(label)
if label == 'start' then
Module.New('Follow'):Start()
elseif label =='stop' then
Module.New('Follow'):Stop()
end
end
registerEventListener(WALKER_SELECTLABEL, 'checking')

szczeryy
11-15-2015, 07:25 PM
Okay thank.