• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Lua Script error:¨(npc interface)

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
2,035
Solutions
9
Reaction score
361
Location
Chile
Help me with this problem i don't know to do please explain
im using avesta 7,54 server with 7.6 database (avesta) and mastercores 7.4 releases (npc)
BUT NPCS WON'T LOAD AND APPEAR INGAME HELP
7pLQCoa.png
 
Last edited by a moderator:
Hi limos :D !
i've download the avesta wich i started so look :
- i don't see npc load or anything avesta 6.4.0 i can't load fibula map i don't why
(in Remeres map editor).
even this server have not greeting.lua i check it alot file by file
the begining server :
WkNcJGp.png

to this server i changed it for avesta 7.6 database and added 7.4 mastercores release (npc only)

So i download this server wich i started and change the libs.
and starting shwoign this error :
60TdYOB.png


and like i saw the server wich i started haven't greeting.lua i remove it and show the same error o_O :
60TdYOB.png


i cheked it like twice and deleting or stading the file in the carpet seems shows that.
I shall add that the server that i show you in the start is compilation date from sepemteber/2/2011 and the server where i got everything changed is from compilation
date abril/9/2012 i don't know if that matter .
Add : i've founded the exactly server compilation date and have not the file :C
thanks for alot your time limos seriusly ! im very gratefully with you
@Limos
 
Last edited:
@Ezzz Hey hello man
i wonder if u can tell me what i can do i saw u are very active in forum and know things im workin in this and i can't make npc load pls help me
 
You can look in a lua script from an npc that came with that server, I assume there are more things don't exist besides FocusModule.
So you can look there what you can use instead with that npcsystem.
 
@Limos hiho again nothing happened i don't know how do that if i send
the server files u can make npcs works?
msg me
i saw that is posibly make dijidos npc system in avesta but i stinks
 
You can upload the (working) default npc lua scripts that came with the server and posts the npcs that give these errors.
 
Hiho again
@Limos xD
there are all the files


This was the lastest error that i get.
60TdYOB.png




http://www.megafileupload.com/9fp/npcglobalerror.rar < npcs that give me error in avesta exe

http://www.megafileupload.com/9fr/npcavesta.rar <Original npcs of avesta

i have to add i was reading i saw that
http://www.megafileupload.com/9fs/npc_cpp_h.rar < npc.cpp and npc.h files
a guy was saying that compilin the avesta with this files would make npc work with jiddo system i dunno is that true.

https://otland.net/threads/7-4-avesta.39366/page-16#post-1878723
 
I can't find Elane.lua or Cipfried.lua, but I assume they all have the same errors.
This is edvard.lua
Code:
_delay = 750

function getNext()
   nextPlayer = getQueuedPlayer()
   if (nextPlayer ~= nil) then
     if (getDistanceToCreature(nextPlayer) <= 4) then
       setFocus(nextPlayer)
       greet(nextPlayer, _delay * 2)
       updateIdle()
       return
     else
       getNext()
     end
   end
 
   setFocus(0)
   resetIdle()
end

function _selfSay(message)
   selfSay(message, _delay)
   updateIdle()
end

local function greet(cid, delay)
   selfSay('Welcome to Edron Furniture Store, ' .. getCreatureName(cid) .. '.', delay)
end

function onCreatureAppear(cid)
end

function onCreatureDisappear(cid)
   if (getFocus() == cid) then
     selfSay('Good bye. Recommend us, if you were satisfied with our service.')
     getNext()
   else
     unqueuePlayer(cid)
   end
end

function onCreatureMove(cid, oldPos, newPos)
   if (getFocus() == cid) then
     faceCreature(cid)
   end
end

function onCreatureSay(cid, type, msg)
   if (getFocus() == 0) then
     if ((msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and getDistanceToCreature(cid) <= 4) then
       setFocus(cid)
       updateIdle()
       greet(cid, _delay)
     end
   
   elseif (getFocus() ~= cid) then
     if ((msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and getDistanceToCreature(cid) <= 4) then
       selfSay('One moment please, ' .. getCreatureName(cid) .. '.', _delay)
       queuePlayer(cid)
     end
   
   else
     if (msgcontains(msg, 'bye') or msgcontains(msg, 'farewell')) then
       selfSay('Good bye.', _delay)
       getNext()
   
     elseif (msgcontains(msg, 'name')) then
       _selfSay('My name is Edvard. I run this store.')
   
     elseif (msgcontains(msg, 'job')) then
       _selfSay('Have you moved to a new home? I\'m the specialist for equipping it.')
   
     elseif (msgcontains(msg, 'time')) then
       _selfSay('It is ' .. getTibiaTime() .. '. Do you need a clock for your house?')
   
     elseif (msgcontains(msg, 'news')) then
       _selfSay('You mean my specials, don\'t you?')
   
     elseif (msgcontains(msg, 'special')) then
       _selfSay('My offers are permanently extraordinary cheap.')
   
     elseif (msgcontains(msg, 'offer') or msgcontains(msg, 'goods') or
       msgcontains(msg, 'furniture') or msgcontains(msg, 'equipment')) then
       _selfSay('I sell statues, tables, chairs, flowers, pillows, pottery, instruments, decoration, tapestries and containers.')
     end
   end
end

function onThink()
   if (getFocus() ~= 0) then
     if (isIdle() or getDistanceToCreature(getFocus()) > 4) then
       selfSay('Good bye.', _delay)
       getNext()
     end
   end
end
You can use that as example and change the elseif msgcontains messages to what the npc is supposed to respond on and do after that.
Or you can indeed also try to compile it with those source files.
 
hiho @Limos here is cipfried lua

please men can u tell me a name of a compiler? i wanna try compile that files in the avesta but i dunno compiler names give me ones please
and again thanks for everything :)
Code:
dofile(getDataDir() .. 'global/greeting.lua')

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid)                npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)             npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)     npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                         npcHandler:onThink() end

npcHandler:setMessage(MESSAGE_GREET, "Hello, |PLAYERNAME|! Feel free to ask me for help.")

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I am just a humble monk. Ask me if you need help or healing."})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "My name is Cipfried."})
keywordHandler:addKeyword({'monk'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I sacrifice my life to serve the good gods of Tibia."})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "That's where we are. The world of Tibia."})
keywordHandler:addKeyword({'rook'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The gods have chosen this isle as the point of arrival for the newborn souls."})
keywordHandler:addKeyword({'god'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They created Tibia and all life on it. Visit our library and learn about them."})
keywordHandler:addKeyword({'life'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "The gods decorated Tibia with various forms of life. Plants, the citizens, and even the monsters."})
keywordHandler:addKeyword({'plant'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Just walk around. You will see grass, trees, and bushes."})
keywordHandler:addKeyword({'citizen'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Only few people live here. Walk around and talk to them."})
keywordHandler:addKeyword({'obi'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a local shop owner."})
keywordHandler:addKeyword({'al dee'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a local shop owner."})
keywordHandler:addKeyword({'seymour'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Seymour is a loyal follower of the king and responsibe for the academy."})
keywordHandler:addKeyword({'academy'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You should visit Seymour in the academy and ask him about a mission."})
keywordHandler:addKeyword({'willie'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "He is a fine farmer. The farm is located to the left of the temple."})
keywordHandler:addKeyword({'monster'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "They are a constant threat. Learn to fight by hunting rabbits, deers and sheeps. Then try to fight rats, bugs and perhaps spiders."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
keywordHandler:addKeyword({'hint'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
keywordHandler:addKeyword({'task'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
keywordHandler:addKeyword({'what'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
keywordHandler:addKeyword({'do'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you should try to get some gold and buy better equipment."})
keywordHandler:addKeyword({'gold'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "You have to slay monsters and take their gold. Or sell food at Willie's farm."})
keywordHandler:addKeyword({'money'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you need money, you have to slay monsters and take their gold. Look for spiders and rats."})
keywordHandler:addKeyword({'rat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "In the north of this temple you find a sewer grate. Use it to enter the sewers if you feel prepared. Don't forget a torch; you'll need it."})
keywordHandler:addKeyword({'sewer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "In the north of this temple you find a sewer grate. Use it to enter the sewers if you feel prepared. Don't forget a torch; you'll need it."})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "First you need some armor and perhaps a better weapon or a shield. A real adventurer needs a rope, a shovel, and a fishing pole, too."})
keywordHandler:addKeyword({'fight'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Take a weapon in your hand, activate your combat mode, and select a target. After a fight you should eat something to heal your wounds"})
keywordHandler:addKeyword({'slay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Take a weapon in your hand, activate your combat mode, and select a target. After a fight you should eat something to heal your wounds"})
keywordHandler:addKeyword({'eat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want to heal your wounds you should eat something. Willie sells excellent meals. But if you are very weak, come to me and ask me to heal you."})
keywordHandler:addKeyword({'food'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "If you want to heal your wounds you should eat something. Willie sells excellent meals. But if you are very weak, come to me and ask me to heal you."})
keywordHandler:addKeyword({'time'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "Now, it is |TIME|, my child."})

function creatureSayCallback(cid, type, msg)
    if(cid ~= npcHandler.focus) then
        return false
    end

    if msgcontains(msg, 'heal') then
        if hasCondition(cid, CONDITION_FIRE) == TRUE then
            npcHandler:say('You are burning. I will help you.')
            doRemoveCondition(cid, CONDITION_FIRE)
            doSendMagicEffect(getCreaturePosition(cid), 14)
        elseif hasCondition(cid, CONDITION_POISON) == TRUE then
            npcHandler:say('You are poisoned. I will help you.')
            doRemoveCondition(cid, CONDITION_POISON)
            doSendMagicEffect(getCreaturePosition(cid), 13)
        elseif getCreatureHealth(cid) < 65 then
            npcHandler:say('You are looking really bad. Let me heal your wounds.')
            doCreatureAddHealth(cid, 65 - getCreatureHealth(cid))
            doSendMagicEffect(getCreaturePosition(cid), 12)
        else
            npcHandler:say('You aren\'t looking really bad, ' .. getCreatureName(cid) .. '. I can only help in cases of real emergencies. Raise your health simply by eating food.')
        end
        return TRUE
    end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
@Limos Hiho bro again
hey i can't compile i think cause my pc is shit when i laod something its frezzes
u can compile it for me? just need change npc.h and npc.cpp
msg me pls :)
 
Last edited by a moderator:
Back
Top