• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved All Npcs Do not speak

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 :(:(

WhVvuhQm.png

Please Help Me :)
 
i added
function NpcHandler:isInRange(cid)
local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid))
if(distance == -1) then
return false
end

return (distance <= self.talkRadius)
end
in my NpcHandler file but its not worked :/ :/
 
Just replace that function..

Find this in npchandler.lua
Code:
  function NpcHandler:isInRange(cid)
     local distance = getDistanceTo(cid) or -1
     if(distance == -1) then
       return false
     end

     return (distance <= self.talkRadius)
   end
Remove that.

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))
 
Just replace that function..

Find this in npchandler.lua
Code:
  function NpcHandler:isInRange(cid)
     local distance = getDistanceTo(cid) or -1
     if(distance == -1) then
       return false
     end

     return (distance <= self.talkRadius)
   end
Remove that.

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))
Doesnt work...
 
Instead of "doesn't work", give an explanation of your problem, what happens after you made those changes?
it gives me same error message
My npchandler.lua

Code:
-- 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
 
Then you did it wrong, post your npchandler.lua.
After you made the changes, you have to save it and restart the server.
 
It can't give the same error since getDistanceTo is no longer in the script.
Make sure you saved the right script.
 
In 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.
 
Back
Top