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

My script is broken =//

Status
Not open for further replies.

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
[Error - NpcScript Interface]
<Unknown script file>
Description:
attempt to call a nil value
stack traceback:

LUA:
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

-- Storage IDs --


local newaddon    = 'Tome, pegue isto, pertencia a meu marido!'
local noitems        = 'Ahn?'
local already        = 'Eu lhe daria este nobleman addon, mas parece que você já tem... Vou guardar como lembrança do meu marido, se não se importa!'
        
-- NOBLEMAN START --

function NoblemanSecond(cid, message, keywords, parameters, node)

    if(not npcHandler:isFocused(cid)) then
        return false
    end

    if isPremium(cid) then
    addon = getPlayerStorageValue(cid,10016)
    if addon == -1 then
        if doPlayerRemoveItem(cid,12660,1) then
            selfSay(newaddon)
             
            doSendMagicEffect(getCreaturePosition(cid), 13)
            doPlayerAddOutfit(cid, 153, 2)
            doPlayerAddOutfit(cid, 157, 2)
            setPlayerStorageValue(cid,10016,1)
        end
        else
            selfSay(noitems)
        end
    else
        selfSay(already)
    end

end
-- NOBLEMAN END --

local node1 = keywordHandler:addKeyword({'mardoc dalton letter'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Sim, ele era meu marido... Espere... Ele... Morreu?! Não é possível!! Uma carta? Deixe-me ver... {yes}'})
    node1:addChildKeyword({'yes'}, NoblemanSecond, {npcHandler = npcHandler, onlyFocus = true, text = 'Não!! Não é possível... Obrigada, obrigada, por me trazer isso, é uma tragédia, mas é melhor viver sabendo o que lhe aconteceu... Tome, guardei isto antes dele sumir, espero que lhe seja de alguma utilidade.', reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Há! Só podia ser uma mentira!.', reset = true})

return TRUE
end

npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Can anyone see the error in this?
 
Last edited:
Status
Not open for further replies.
Back
Top