Postado Março 9, 2015 10 anos Bom, estou tendo um erro em um npc que tentei criar. Erro é esse: [Error - LuaScriptInterface::loadFile] data/npc/scripts/kingjester.lua:45: '<eof>' expected near 'function' [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/kingjester.lua data/npc/scripts/kingjester.lua:45: '<eof>' expected near 'function' Script do npc: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 playerHaveItems(cid, itemid) local items = type(itemid) == "table" and itemid or {itemid} for i = 1, #items do if getPlayerItemCount(cid, items) <= 0 then return false end end return true end function doPlayerRemoveItems(cid, itemid, count) local items = type(itemid) == "table" and itemid or {itemid} for i = 1, #items do doPlayerRemoveItem(cid, items, count ~= nil and count or 1) end return nil end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end end if msgcontains(msg, "addon doll") then if playerHaveItems(cid, {9694, 9695, 9696, 9697, 9698, 9699}) then doPlayerRemoveItems(cid, {9694, 9695, 9696, 9697, 9698, 9699}, 1) doPlayerAddItem(cid, 9693, 1) else selfSay("Você não tem os itens necessarios para fazer um addon doll.") end end return true function ndnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) end Se alguém puder me ajudar. Editado Março 9, 2015 10 anos por Ovini (veja o histórico de edições)
Postado Março 9, 2015 10 anos Tente assim: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 playerHaveItems(cid, itemid) local items = type(itemid) == "table" and itemid or {itemid} for i = 1, #items do if getPlayerItemCount(cid, items[i]) <= 0 then return false end end return true end function doPlayerRemoveItems(cid, itemid, count) local items = type(itemid) == "table" and itemid or {itemid} for i = 1, #items do doPlayerRemoveItem(cid, items[i], count ~= nil and count or 1) end return nil end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, "addon doll") then if playerHaveItems(cid, {9694, 9695, 9696, 9697, 9698, 9699}) then doPlayerRemoveItems(cid, {9694, 9695, 9696, 9697, 9698, 9699}, 1) doPlayerAddItem(cid, 9693, 1) else selfSay("Você não tem os itens necessarios para fazer um addon doll.") end end return true end function ndnpcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) end Atenciosamente, Bruno Minervino
Postado Março 9, 2015 10 anos Autor Arrumei, mas quando eu crio o npc in-game da debug. Ja criei outro char e quando fui perto do npc também da debug. @edited. Bom, mudei o looktype do npc e parou o debug, mas o npc não responde ao - Hi. Editado Março 9, 2015 10 anos por Ovini (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.