• 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 scripts not working.

XxDeathAvenger

New Member
Joined
May 5, 2011
Messages
95
Reaction score
2
Hey guys, I think the npc scripts for my server version are too new, so the codes aren't recognized.

here is one of them.

Code:
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
        -- OTServ event handling functions end
       
       
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
    local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can bring you to our base in Liberty Bay for 400 gold. Is that what you want?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 400, destination = {x=32285, y=32892, z=6} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
           
            local travelNode = keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can bring you to our base in Liberty Bay for 400 gold. Is that what you want?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 400, destination = {x=32285, y=32892, z=6} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'We would like to serve you some time.'})
           
           
        keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Liberty Bay.'})
        keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
        keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
      

        npcHandler:addModule(FocusModule:new())
 
I am not good at LUA at all anymore, but I do know it could be useful if you post what server version you use.
 
I'm using TFS 0.2.10

Code:
[18/09/2015 23:39:45] Lua Script Error: [Npc interface]
[18/09/2015 23:39:45] data/npc/scripts/Captain Cookie.lua
[18/09/2015 23:39:45] data/npc/scripts/Captain Cookie.lua:1: attempt to index global 'KeywordHandler' (a nil value)
[18/09/2015 23:39:45] stack traceback:
[18/09/2015 23:39:45]     [C]: in function '__index'
[18/09/2015 23:39:45]     data/npc/scripts/Captain Cookie.lua:1: in main chunk
[18/09/2015 23:39:45] [Warning - NpcScript::NpcScript] Can not load script: data/npc/scripts/Captain Cookie.lua
 
Do you have the keywordhandler file in the npcsystem folder? If yes, is it default or custom?
 
Yeahi I have no clue anymore.. lol It's still 8.6 i thought. But I jst want to update to tfs 0.3.7. my stuff is all messed up

Does 0.2.10 exist for 8.60? Can only find 8.70, and my test server uses 8.70 as well 0.2.10 and your script works just fine for me.
So you want this script to work with tfs 0.3.7? Isn't it even better to update it to even 0.4 then? Now when it is not require premium on otland?

https://otland.net/threads/backup-of-some-old-sources.199436/
 
Back
Top