magdy capone
Tibia-Egypt.com
- Joined
- Jan 12, 2014
- Messages
- 34
- Reaction score
- 0
Hello
My all Npcs Do not speak To me when say hi Do not speak
Please Help Me
My all Npcs Do not speak To me when say hi Do not speak
Please Help Me
function NpcHandler:isInRange(cid)
local distance = getDistanceTo(cid) or -1
if(distance == -1) then
return false
end
return (distance <= self.talkRadius)
end
function NpcHandler:isInRange(cid)
local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid))
if(distance == -1) then
return false
end
return (distance <= self.talkRadius)
end
local distance = getDistanceTo(cid) or -1
local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid))
Doesnt work...Just replace that function..
Find this in npchandler.lua
Remove that.Code:function NpcHandler:isInRange(cid) local distance = getDistanceTo(cid) or -1 if(distance == -1) then return false end return (distance <= self.talkRadius) end
Then add this instead.
Code:function NpcHandler:isInRange(cid) local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid)) if(distance == -1) then return false end return (distance <= self.talkRadius) end
Or just replace
Code:local distance = getDistanceTo(cid) or -1
With
Code:local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid))
it gives me same error messageInstead of "doesn't work", give an explanation of your problem, what happens after you made those changes?
-- Returns true if cid is within the talkRadius of this npc.
function NpcHandler:isInRange(cid)
local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid))
if(distance == -1) then
return false
end
return (distance <= self.talkRadius)
end
local sx, sy, sz = selfGetPosition()
local dx = math.abs(sx-playerPos.x)
local dy = math.abs(sy-playerPos.y)
local dz = math.abs(sz-playerPos.z)
local dist = (dx^2 + dy^2)^0.5
return (dist <= self.talkRadius and dz == 0)
end
The server was offline when i saved it.Then you did it wrong, post your npchandler.lua.
After you made the changes, you have to save it and restart the server.
maybe its not same error messageIt can't give the same error since getDistanceTo is no longer in the script.
Make sure you saved the right script.
https://imgur.com/cXIleJYIn the script you posted in pastebin, getDistanceTo is not in the script, so it can't give that error.
If you still get the same error, it means you didn't save it or you edited the wrong script.
Or you didn't restart your server.If you still get the same error, it means you didn't save it or you edited the wrong script.