Eu queria que esse script fizesse o NPC vender itens no shop e tb dar quests pros players, só que quando ligo o servidor da um erro no console, < unknown script file > e o NPC não responde. Alguém sabe resolver?
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'lemonade', 'lemondrink', 'limonada'}, 2006, 2, 5, 'lemonade')
shopModule:addBuyableItem({'beer', 'cerveja'}, 2006, 3, 3, 'beer')
shopModule:addBuyableItem({'milk', 'leite'}, 2006, 2, 6, 'milk')
shopModule:addBuyableItem({'rum'}, 2006, 3, 27, 'rum')
shopModule:addBuyableItem({'bread'}, 2689, 3)
shopModule:addBuyableItem({'ham'}, 2671, 5)
shopModule:addBuyableItem({'meat'}, 2666, 5)
shopModule:addBuyableItem({'grapes'}, 2681, 3)
shopModule:addBuyableItem({'red apple'}, 2674, 3)
npcHandler:addModule(FocusModule:new())
local boromir = 6000
local boromir2 = 6001
local boromir3 = 61254
text = "5 Meat 5 Bread 10 Blueberries" -- Texto do papel
lid = 1954 -- ID do Papel
if msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 1) then
npcHandler:say("Você pode conseguir um pouco de comida para mim? Estou muito ocupado e não tenho tempo para ir procurar.", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then
setPlayerStorageValue(cid, boromir, 1)
setPlayerStorageValue(cid, boromir3, 2)
setPlayerStorageValue(cid, boromir2, 1)
letter = doPlayerAddItem(cid, lid)
doSetItemText(letter, text)
doPlayerPopupFYI(cid, "Nova quest iniciada! Quest Log atualizado: Ajudando Zio")
npcHandler:say("Tudo que preciso está escrito neste papel.", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 2) then
npcHandler:say("Você conseguiu todos os itens da lista?", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and (getPlayerStorageValue(cid, 61254) == 2) then
npcHandler:say("Muito obrigado, aqui está sua recompensa.", cid)
talkState[talkUser] = 0
setPlayerStorageValue(cid, boromir2, 2)
setPlayerStorageValue(cid, boromir3, 3)
elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and (getPlayerStorageValue(cid, 61254) == 3) then
npcHandler:say("Você já me ajudou, por enquanto não preciso da sua ajuda.", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 3) then
npcHandler:say("Você já me ajudou, por enquanto não preciso da sua ajuda.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Pergunta
NewAge 0
Eu queria que esse script fizesse o NPC vender itens no shop e tb dar quests pros players, só que quando ligo o servidor da um erro no console, < unknown script file > e o NPC não responde. Alguém sabe resolver?
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 local shopModule = ShopModule:new() npcHandler:addModule(shopModule) shopModule:addBuyableItem({'lemonade', 'lemondrink', 'limonada'}, 2006, 2, 5, 'lemonade') shopModule:addBuyableItem({'beer', 'cerveja'}, 2006, 3, 3, 'beer') shopModule:addBuyableItem({'milk', 'leite'}, 2006, 2, 6, 'milk') shopModule:addBuyableItem({'rum'}, 2006, 3, 27, 'rum') shopModule:addBuyableItem({'bread'}, 2689, 3) shopModule:addBuyableItem({'ham'}, 2671, 5) shopModule:addBuyableItem({'meat'}, 2666, 5) shopModule:addBuyableItem({'grapes'}, 2681, 3) shopModule:addBuyableItem({'red apple'}, 2674, 3) npcHandler:addModule(FocusModule:new()) local boromir = 6000 local boromir2 = 6001 local boromir3 = 61254 text = "5 Meat 5 Bread 10 Blueberries" -- Texto do papel lid = 1954 -- ID do Papel if msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 1) then npcHandler:say("Você pode conseguir um pouco de comida para mim? Estou muito ocupado e não tenho tempo para ir procurar.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then setPlayerStorageValue(cid, boromir, 1) setPlayerStorageValue(cid, boromir3, 2) setPlayerStorageValue(cid, boromir2, 1) letter = doPlayerAddItem(cid, lid) doSetItemText(letter, text) doPlayerPopupFYI(cid, "Nova quest iniciada! Quest Log atualizado: Ajudando Zio") npcHandler:say("Tudo que preciso está escrito neste papel.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 2) then npcHandler:say("Você conseguiu todos os itens da lista?", cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and (getPlayerStorageValue(cid, 61254) == 2) then npcHandler:say("Muito obrigado, aqui está sua recompensa.", cid) talkState[talkUser] = 0 setPlayerStorageValue(cid, boromir2, 2) setPlayerStorageValue(cid, boromir3, 3) elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') and (getPlayerStorageValue(cid, 61254) == 3) then npcHandler:say("Você já me ajudou, por enquanto não preciso da sua ajuda.", cid) talkState[talkUser] = 0 elseif msgcontains(msg, 'ajudar') and (getPlayerStorageValue(cid, 61254) == 3) then npcHandler:say("Você já me ajudou, por enquanto não preciso da sua ajuda.", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())Link para o comentário
https://xtibia.com/forum/topic/202527-script-n%C3%A3o-funciona/Compartilhar em outros sites
7 respostass a esta questão
Posts Recomendados