• 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!

npc not loading

George00

propro
Joined
Jan 11, 2014
Messages
163
Solutions
1
Reaction score
10
Location
propro
in rme map editor i can see the npcs there with spawn radius but when i open the ot i cant see them. i also get this message from forgotten server:
[14/08/2016 09:56:57] [Error - Npc interface]
[14/08/2016 09:56:57] data/npc/scripts/promotion.lua
[14/08/2016 09:56:57] Description:
[14/08/2016 09:56:57] data/npc/scripts/promotion.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:57] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/promotion.lua


[14/08/2016 09:56:57] [Error - Npc interface]
[14/08/2016 09:56:57] data/npc/scripts/bootmaker.lua
[14/08/2016 09:56:57] Description:
[14/08/2016 09:56:57] data/npc/scripts/bootmaker.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:57] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/bootmaker.lua


[14/08/2016 09:56:57] [Error - Npc interface]
[14/08/2016 09:56:57] data/npc/scripts/default.lua
[14/08/2016 09:56:57] Description:
[14/08/2016 09:56:57] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:57] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/furniture.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/furniture.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/furniture.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/default.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/default.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/promotion.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/promotion.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/promotion.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/runes.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/runes.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/runes.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/default.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/loot.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/loot.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/loot.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/runes.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/runes.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/runes.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/default.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/default.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/default.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/default.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/furniture.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/furniture.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/furniture.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/runes.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/runes.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/runes.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/loot.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/loot.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/loot.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/sven.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/sven.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/sven.lua


[14/08/2016 09:56:58] [Error - Npc interface]
[14/08/2016 09:56:58] data/npc/scripts/sven.lua
[14/08/2016 09:56:58] Description:
[14/08/2016 09:56:58] data/npc/scripts/sven.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[14/08/2016 09:56:58] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/sven.lua
 
dofile(getDataDir() .. 'npc/lib/npcsystem/npcsystem.lua')

i added this to the beginning of my npc.lua file and now the npcs are loading

when i say hi to the npc they dont respond to me
 
dofile(getDataDir() .. 'npc/lib/npcsystem/npcsystem.lua')

i added this to the beginning of my npc.lua file and now the npcs are loading

when i say hi to the npc they dont respond to me
You may have to add more directories to the npc's, as I suspect npcsystem.lua doesn't cover everything.

https://otland.net/threads/error-npc-interface.200135/#post-1925651
Limos was an active member for quite awhile and was very adept with the npc system in general.
She has 4 directories listed. Try using all of them.
 
should i copy all of them and paste them in or test one by one ?
You'll want to make sure they are in data/npc/lib/npcsystem/npcsystem.lua

basically your telling the NPC to find npcsystem.lua , which then goes and finds the other 4 directories.
 
i already have those 4 lines in the beginning of my npc system lua

-- Advanced NPC System (Created by Jiddo),
-- Modified by Talaturen.

if(NpcSystem == nil) then
-- Loads the underlying classes of the npcsystem.
dofile(getDataDir() .. 'npc/lib/npcsystem/keywordhandler.lua')
dofile(getDataDir() .. 'npc/lib/npcsystem/queue.lua')
dofile(getDataDir() .. 'npc/lib/npcsystem/npchandler.lua')
dofile(getDataDir() .. 'npc/lib/npcsystem/modules.lua')

-- Global npc constants:

-- Keyword nestling behavior. For more information look at the top of keywordhandler.lua
KEYWORD_BEHAVIOR = BEHAVIOR_NORMAL_EXTENDED

-- Greeting and unGreeting keywords. For more information look at the top of modules.lua
FOCUS_GREETWORDS = {'hi', 'hello', 'hey'}
FOCUS_FAREWELLWORDS = {'bye', 'farewell', 'cya'}

-- The word for requesting trade window. For more information look at the top of modules.lua
SHOP_TRADEREQUEST = {'offer', 'trade'}

-- The word for accepting/declining an offer. CAN ONLY CONTAIN ONE FIELD! For more information look at the top of modules.lua
SHOP_YESWORD = {'yes'}
SHOP_NOWORD = {'no'}

-- Pattern used to get the amount of an item a player wants to buy/sell.
PATTERN_COUNT = '%d+'

-- Talkdelay behavior. For more information, look at the top of npchandler.lua.
NPCHANDLER_TALKDELAY = TALKDELAY_ONTHINK

-- Conversation behavior. For more information, look at the top of npchandler.lua.
NPCHANDLER_CONVBEHAVIOR = CONVERSATION_PRIVATE

-- Constant strings defining the keywords to replace in the default messages.
-- For more information, look at the top of npchandler.lua...
TAG_PLAYERNAME = '|PLAYERNAME|'
TAG_ITEMCOUNT = '|ITEMCOUNT|'
TAG_TOTALCOST = '|TOTALCOST|'
TAG_ITEMNAME = '|ITEMNAME|'
TAG_QUEUESIZE = '|QUEUESIZE|'

NpcSystem = {}

-- Gets an npcparameter with the specified key. Returns nil if no such parameter is found.
function NpcSystem.getParameter(key)
local ret = getNpcParameter(tostring(key))
if((type(ret) == 'number' and ret == 0) or ret == nil) then
return nil
else
return ret
end
end

-- Parses all known parameters for the npc. Also parses parseable modules.
function NpcSystem.parseParameters(npcHandler)
local ret = NpcSystem.getParameter('idletime')
if(ret ~= nil) then
npcHandler.idleTime = tonumber(ret)
end
local ret = NpcSystem.getParameter('talkradius')
if(ret ~= nil) then
npcHandler.talkRadius = tonumber(ret)
end
local ret = NpcSystem.getParameter('message_greet')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_GREET, ret)
end
local ret = NpcSystem.getParameter('message_farewell')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_FAREWELL, ret)
end
local ret = NpcSystem.getParameter('message_decline')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_DECLINE, ret)
end
local ret = NpcSystem.getParameter('message_needmorespace')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDMORESPACE, ret)
end
local ret = NpcSystem.getParameter('message_needspace')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDSPACE, ret)
end
local ret = NpcSystem.getParameter('message_sendtrade')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_SENDTRADE, ret)
end
local ret = NpcSystem.getParameter('message_noshop')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NOSHOP, ret)
end
local ret = NpcSystem.getParameter('message_oncloseshop')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ONCLOSESHOP, ret)
end
local ret = NpcSystem.getParameter('message_onbuy')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ONBUY, ret)
end
local ret = NpcSystem.getParameter('message_onsell')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ONSELL, ret)
end
local ret = NpcSystem.getParameter('message_missingmoney')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_MISSINGMONEY, ret)
end
local ret = NpcSystem.getParameter('message_needmoney')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDMONEY, ret)
end
local ret = NpcSystem.getParameter('message_missingitem')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_MISSINGITEM, ret)
end
local ret = NpcSystem.getParameter('message_needitem')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_NEEDITEM, ret)
end
local ret = NpcSystem.getParameter('message_idletimeout')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_IDLETIMEOUT, ret)
end
local ret = NpcSystem.getParameter('message_walkaway')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_WALKAWAY, ret)
end
local ret = NpcSystem.getParameter('message_alreadyfocused')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_ALREADYFOCUSED, ret)
end
local ret = NpcSystem.getParameter('message_placedinqueue')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_PLACEDINQUEUE, ret)
end
local ret = NpcSystem.getParameter('message_buy')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_BUY, ret)
end
local ret = NpcSystem.getParameter('message_sell')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_SELL, ret)
end
local ret = NpcSystem.getParameter('message_bought')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_BOUGHT, ret)
end
local ret = NpcSystem.getParameter('message_sold')
if(ret ~= nil) then
npcHandler:setMessage(MESSAGE_SOLD, ret)
end

-- Parse modules.
for parameter, module in pairs(Modules.parseableModules) do
local ret = NpcSystem.getParameter(parameter)
if(ret ~= nil) then
local number = tonumber(ret)
if(number ~= nil and number ~= 0) then
npcHandler:addModule(module:new())
end
end
end
end
end
 
try to use [.code]script here[./code] without the dots, to post your codes.

Did you check if those files exist at those directory locations?

If yes, have you checked if there are additional error's in the console when you attempt to communicate with the npc's?
 
[14/08/2016 12:00:56] [Error - Npc interface]
[14/08/2016 12:00:56] data/npc/scripts/runes.lua:eek:nCreatureSay
[14/08/2016 12:00:56] Description:
[14/08/2016 12:00:56] data/npc/lib/npc.lua:42: attempt to call global 'errors' (a nil value)
[14/08/2016 12:00:56] stack traceback:
[14/08/2016 12:00:56] data/npc/lib/npc.lua:42: in function 'getDistanceTo'
[14/08/2016 12:00:56] data/npc/lib/npcsystem/npchandler.lua:558: in function 'isInRange'
[14/08/2016 12:00:56] data/npc/lib/npcsystem/npchandler.lua:381: in function 'onCreatureSay'
[14/08/2016 12:00:56] data/npc/scripts/runes.lua:8: in function <data/npc/scripts/runes.lua:8>



Saying "hi" to eryn
 
replace the function near line 558 with
Code:
    function NpcHandler:isInRange(cid)
        local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid)) or -1
        if(distance == -1) then
            return false
        end

        return (distance <= self.talkRadius)
    end
 
Dont laugh at me please but which function are you talking about ? lines 558 how do i get there ctrl+ g ? can you mark it for me or teach me how do understand what youre meaning
 
its in your error
[14/08/2016 12:00:56] data/npc/lib/npcsystem/npchandler.lua:558: in function 'isInRange'
 
yes and i appreciate that but when im in that file how do i find the line like everything looks the same and i dont know if i remove too much and fuck the whole thing up like ive done a thousand times how do i find line 558
 
yes and i appreciate that but when im in that file how do i find the line like everything looks the same and i dont know if i remove too much and fuck the whole thing up like ive done a thousand times how do i find line 558
do you not use notepad++ or sublime text? they show the line number
 
so shall it look something like this ?
Code:
-- Tries to greet the player with the given cid.
    function NpcHandler:isInRange(cid)
        local distance = getDistanceBetween(getCreaturePosition(getNpcCid()), getCreaturePosition(cid)) or -1
        if(distance == -1) then
            return false
        end

        return (distance <= self.talkRadius)
    end

                    local msg = self:getMessage(MESSAGE_PLACEDINQUEUE)
                    local parseInfo = { [TAG_PLAYERNAME] = getCreatureName(cid), [TAG_QUEUESIZE] = self.queue:getSize() }
                    msg = self:parseMessage(msg, parseInfo)
                    self:say(msg)
                end
            end
        end
    end

    -- Simply calls the underlying unGreet function.
    function NpcHandler:onFarewell(cid)
        self:unGreet(cid)
    end

    -- Should be called on this npc's focus if the distance to focus is greater then talkRadius.
    function NpcHandler:onWalkAway(cid)
        if(self:isFocused(cid)) then
            local callback = self:getCallback(CALLBACK_CREATURE_DISAPPEAR)
            if(callback == nil or callback(cid)) then
                if(self:processModuleCallback(CALLBACK_CREATURE_DISAPPEAR, cid)) then
                    if(self.queue == nil or not self.queue:greetNext()) then
                        local msg = self:getMessage(MESSAGE_WALKAWAY)
                        local parseInfo = { [TAG_PLAYERNAME] = getPlayerName(cid) }
                        msg = self:parseMessage(msg, parseInfo)

                        self:say(msg, cid)
                        self:releaseFocus(cid)
                        self:say(msg)
                    end
                end
            end
        end
    end

    -- Returns true if cid is within the talkRadius of this npc.
 
Back
Top