PDA

View Full Version : Follow Npc



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

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

Rif
11-15-2015, 10: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')

Rydan
11-15-2015, 10:37 AM
szczeryy
function customFollow(name)
for n, c in Creature.iNpcs() do
if n:lower() == name:lower() and c:isOnScreen() then
c:Follow()
break
end
end
end
Usage:
customFollow("Sebastian")
Rif Yours will not work either, the issue here is that there is a duplicate of Sebastian which means creating an object with the NPC's name will always take the first that appears in battlelist (i.e. the first version you saw after you opened your client). To make it work you have to iterate through the battlelist and take the version that is on your screen.

Rif
11-15-2015, 11:18 AM
Rydan fixed, thanks

szczeryy
11-15-2015, 04:32 PM
Rydan


szczeryy
function customFollow(name)
for n, c in Creature.iNpcs() do
if n:lower() == name:lower() and c:isOnScreen() then
c:Follow()
break
end
end
end
Usage:
customFollow("Sebastian")
Rif Yours will not work either, the issue here is that there is a duplicate of Sebastian which means creating an object with the NPC's name will always take the first that appears in battlelist (i.e. the first version you saw after you opened your client). To make it work you have to iterate through the battlelist and take the version that is on your screen.





registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
if (labelName == "Follow") then
customFollow("Sebastian")
end


function onWalkerSelectLabel(labelName)

function customFollow(name)
for n, c in Creature.iNpcs() do
if n:lower() == name:lower() and c:isOnScreen() then
c:Follow()
break
end
end
end
end





Dont work on hexera.net


Rif
U Script also dont work

Rydan
11-15-2015, 05:00 PM
szczeryy
function customFollow(name)
for n, c in Creature.iNpcs() do
if n:lower() == name:lower() and c:isOnScreen() then
c:Follow()
break
end
end
end

registerEventListener(WALKER_SELECTLABEL, "onWalkerSelectLabel")
function onWalkerSelectLabel(labelName)
if (labelName == "Follow") then
customFollow("Sebastian")
end
end

szczeryy
11-15-2015, 05:29 PM
Rydan

12914

Dont work ;/

Rydan
11-15-2015, 06:07 PM
Please run this one and post the result.

local creaturesFound = {}
for n, c in Creature.iNpcs() do
if n:lower() ~= "" then
creaturesFound[#creaturesFound+1] = n..":"..c:ID()
end
end
print("NPCs found: "..table.concat(creaturesFound, ", "))

local creaturesFound = {}
for i = 0, 1300 do
local c = Creature.New(i)
local n = c:Name()
if n:lower() ~= "" then
creaturesFound[#creaturesFound+1] = n..":"..c:ID()
end
end
print("Creatures found: "..table.concat(creaturesFound, ", "))

szczeryy
11-15-2015, 06:09 PM
Rydan

20:10 NPCs found:
20:10 Creatures found: Szczery:270178965, Nelovsky:270163147, O Quack:270209693, Wasp:1075046878, Skywalker Master:269205975, Asds:270204390, Koulin Alas:270232227, Zlotyy:269303608, Nox Panda:270227214, Amp:269142502, Nastia:270272210

shadowart
11-15-2015, 06:12 PM
As far as I know there's no way to follow an NPC on Hexera - or even get an object representing an NPC. They simple do not exist in the battle list that Xeno has access too. Rydan The OX Server has the same bug.

Rydan
11-15-2015, 06:20 PM
shadowart
Yeah, I've just noticed. Tested it myself real quick.

szczeryy
There is no way to follow the NPC right now, the only possibility would be to create a Stand waypoint in the center of its spawn position and keep trying to talk to him until you travelled successfully.

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