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

Lua Npc bug

marcosbozi

New Member
Joined
Jan 1, 2016
Messages
3
Reaction score
0
how can i fix this erro in my log
Lua Script Error: [Npc interface]
data/npc/scripts/default.lua:eek:nThink
data/npc/lib/npcsystem/npchandler.lua:530: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/npc/lib/npcsystem/npchandler.lua:530: in function 'onWalkAway'
data/npc/lib/npcsystem/npchandler.lua:496: in function 'onThink'
data/npc/scripts/default.lua:8: in function

Lua Script Error: [Npc interface]
data/npc/scripts/Captain Breezelda.lua:eek:nThink
data/npc/lib/npcsystem/npchandler.lua:530: attempt to index a nil value
stack traceback:
[C]: in function '__index'
data/npc/lib/npcsystem/npchandler.lua:530: in function 'onWalkAway'
data/npc/lib/npcsystem/npchandler.lua:496: in function 'onThink'
data/npc/scripts/Captain Breezelda.lua:18: in function
 
This most likely isnt a problem with your NPC system, but with the NPC you use. (You're calling a value that is returned as 0)
Post your NPC script.
 
Last edited:
This most likely isnt a problem with your NPC system, but with the NPC you use. (You're calling a value that is returned as 0)
Post your NPC script.

Bzzzz.. it's so many NPCS cause this error ;S... Boat NPCS, Market NPCS, etc...
The last are here...

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


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

function creatureSayCallback(cid, type, msg)
    if(not(npcHandler:isFocused(cid))) then
        return false
    end
   
   
    if(msgcontains(msg, "passage")) then
        if(getPlayerStorageValue(cid, 1015) >= 24) then
            npcHandler:say("You want trip to Izzle of Zztrife?", cid)
            npcHandler.topic[cid] = 1
        end
    elseif(msgcontains(msg, "yes")) then
        if(npcHandler.topic[cid] == 1) then
            npcHandler:say("It'zz your doom you travel to.", cid)
            doTeleportThing(cid, {x = 33103, y = 31055, z = 7})
            doSendMagicEffect({x = 33103, y = 31055, z = 7}, CONST_ME_TELEPORT)
            npcHandler.topic[cid] = 0
        end
    end
    return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Zurak" script="Zurak.lua" walkinterval="0" floorchange="0">
    <health now="150" max="150"/>
         <look type="114" corpse="6040"/>
    <parameters>
        <parameter key="module_travel" value="1"/>
        <parameter key="message_greet" value="Hello |PLAYERNAME|. If you don't know where to flow, say {travel}."/>
        <parameter key="travel_destinations" value="isle of strife,33114,31060,7,0;"/>
    </parameters>
</npc>
 
Interesting. I don't see any errors in the code. Are you trying to use a tfs 1.1 NPC in a 0.3~ server?

Otherwise, post your
npc/lib/npcsystem/npchandler.lua
 
Back
Top