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

OTHst

New Member
Joined
May 10, 2019
Messages
32
Solutions
1
Reaction score
4
Hello!

I got some problems with my npc's and can't get them to work properly. The main one is causing a lot of npc to not spawn att all and the error given in the console is the following:
data/npc/scripts/Zerbrus.lua:29: attempt to call method 'addAliasKeyword' stack traceback: [C]: in function 'addAliasKeyword'

I've made sure that I have the addAliasKeyword in my npc scripts and it looks like this:

Lua:
function KeywordNode:addAliasKeyword(keywords)
        if #self.children == 0 then
            print('KeywordNode:addAliasKeyword no previous node found')
            return false
        end

        local prevNode = self.children[#self.children]
        local new = KeywordNode:new(keywords, prevNode.callback, prevNode.parameters, prevNode.condition, prevNode.action)
        for i = 1, #prevNode.children do
            new:addChildKeywordNode(prevNode.children[i])
        end
        return self:addChildKeywordNode(new)
    end

The other problem happens when I try to ask for tasks. The console gives the following error:
data/npc/scripts/Grizzly Adams.lua:onCreatureSay data/npc/scripts/Grizzly Adams.lua:120: attempt to call method 'getTasks' (a nil value) stack traceback: data/npc/scripts/Grizzly Adams.lua:120: in function 'callback' data/npc/lib/npcsystem/npchandler.lua:412: in function 'onCreatureSay' data/npc/scripts/Grizzly Adams.lua:7: in function <data/npc/scripts/Grizzly Adams.lua:7>

I'm using TFS 1.3 cloned and compiled two days ago.
 
You are missing getTasks function in either your NPC lua file or in your lib lua file.
as stated in the error data/npc/scripts/Grizzly Adams.lua:120: attempt to call method 'getTasks' (a nil value)
 
You are missing getTasks function in either your NPC lua file or in your lib lua file.
as stated in the error data/npc/scripts/Grizzly Adams.lua:120: attempt to call method 'getTasks' (a nil value)
Ok cool, thank you for taking your time to help me! :) Any idea on the eventhandler? It really affects a lot of npc's
 
You might want to move the function KeywordNode:addAliasKeyword(keywords) into data/npc/lib/npcsystem/keywordhandler.lua
The npcs are probably not meant for your datapack, it might throw even more errors afterwards.
 
Back
Top