Ir para conteúdo

Posts Recomendados

Quando tento acrescentar um script novo para NPC no server, começa a dar um erro.
O script é esse:
 

Spoiler

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
 
local storage1 = 60093
local storage2 = 60095
local global_storage = 63105
 
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
     
 
    if msgcontains(msg, 'mission') or msgcontains(msg, 'help') then
        if getPlayerStorageValue(cid, storage1) <= 0 then
            if getPlayerStorageValue(cid, storage2) <= 0 then
                selfSay("Well, left some herbs, you will need to bring me more 100, ok?",cid)
                talkState[talkUser] = 1
            elseif getPlayerStorageValue(cid, storage2) == 1 then
                selfSay("Did you have the 100 blood herbs?", cid)
                talkState[talkUser] = 1
            elseif getPlayerStorageValue(cid, storage2) == 2 then
                selfSay("Ta pronto pra terminar agora?", cid)
                talkState[talkUser] = 1
            else
                selfSay("You already bring me the herbs. Thank you again.", cid)
                talkState[talkUser] = 0
            end
        else
            selfSay("I have nothing to you.", cid)
            talkState[talkUser] = 0
        end
        npcHandler:addFocus(cid)
    end
 
    if msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
        if getPlayerStorageValue(cid, storage2) <= 0 then
            selfSay("Ok then. Come back when you have them.", cid)
            setPlayerStorageValue(cid, storage2, 1)
        elseif getPlayerStorageValue(cid, storage2) == 1 then
            selfSay("Oh, thanks mate. You've helpful.", cid)
            doPlayerRemoveItem(cid, 2160, 10)
            setPlayerStorageValue(cid, storage2, 2)
            setPlayerStorageValue(cid, storage1, 2)
        else
            selfSay("Is missing some herbs.", cid)
        elseif getPlayerStorageValue(cid, storage2) == 2 and getGlobalStorageValue(global_storage) <= 0 then
            doBroadcastMessage('O player '..getCreatureName(cid)..' acabou de terminar todas as quests agora, ele é o primeiro.')
            doPlayerAddItem(cid, 2124, 1)
            setGlobalStorageValue(global_storage, 1)
        else
            selfSay("Parabéns por terminar as tasks, essa é sua recompensa final.", cid)
            doPlayerAddItem(cid, 2173, 1)
        end
    elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
        selfSay("Ok then.", cid)
        talkState[talkUser] = 0  
    end
    return true
    end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Esse é o erro:

[Error - NpcScript Interface]
<Unknown script file>
Description:
attempt to call a nil value

TFS 0.4 rev 3884 v8.60
Obrigado desde já.

Link para o comentário
https://xtibia.com/forum/topic/247222-encerrado-erro-npcscript-interface/
Compartilhar em outros sites

  • 2 months later...
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
https://xtibia.com/forum/topic/247222-encerrado-erro-npcscript-interface/#findComment-1741374
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...