BrunooMaciell 84 Postado Abril 5, 2013 Share Postado Abril 5, 2013 Estou com um bug na meu npc de task ... BUG [05/04/2013 16:22:45] [Error - Npc interface] [05/04/2013 16:22:45] data/npc/scripts/task/Task 4.lua:onThink [05/04/2013 16:22:45] Description: [05/04/2013 16:22:46] (luaGetCreatureName) Creature not found [05/04/2013 16:22:46] [Error - Npc interface] [05/04/2013 16:22:46] data/npc/scripts/task/Task 4.lua:onThink [05/04/2013 16:22:47] Description: [05/04/2013 16:22:47] data/npc/lib/npcsystem/npchandler.lua:308: bad argument #3 to 'gsub' (string/function/table expected) [05/04/2013 16:22:47] stack traceback: [05/04/2013 16:22:48] [C]: in function 'gsub' [05/04/2013 16:22:48] data/npc/lib/npcsystem/npchandler.lua:308: in function 'parseMessage' [05/04/2013 16:22:48] data/npc/lib/npcsystem/npchandler.lua:549: in function 'onWalkAway' [05/04/2013 16:22:48] data/npc/lib/npcsystem/npchandler.lua:491: in function 'onThink' [05/04/2013 16:22:49] data/npc/scripts/task/Task 4.lua:75: in function <data/npc/scripts/task/Task 4.lua:75> SCRIPT local config = { requirements = { storage = 35565, requiredlevel = true, level = 55, requiredpremium = false, itemsrequired = { [11442] = {amount = 1}, -- entre [] pon el id de water stone -- [12170] = {amount = 100}, -- entre [] pon el id de las water pendant -- [12161] = {amount = 1000}, -- entre [] pon el id de las water gem -- }, }, rewards = { expvalue = 700, expcolor = 35, money = 350000, reward = { [2392] = {amount = 30}, -- entre [] pon el id de las ultra ball's -- }, } } local function getRequiredThings(cid) local msg = "" local itemsleft = { } for i,x in pairs(config.requirements.itemsrequired) do local item = getPlayerItemCount(cid, i) if (item < x.amount) then table.insert(itemsleft, x.amount - item.. "x "..getItemNameById(i)) end end msg = #itemsleft > 0 and "Items: "..table.concat(itemsleft, ", ") or "" return msg end local itemscap = 0 for i,x in pairs (config.requirements.itemsrequired) do itemscap = itemscap + getItemWeightById(i, x.amount) end local requir = {} for i,x in pairs(config.requirements.itemsrequired) do table.insert (requir, x.amount .. "x "..getItemNameById(i)) end 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 creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local cap = getPlayerFreeCap(cid) local s = getPlayerStorageValue(cid, config.requirements.storage) == 1 and true or false local lv = getPlayerLevel(cid) local prm = isPremium(cid) local msgs = { requirements = "Well, i need help to get some items. I need "..table.concat(requir, ", ").. ". Could you help me to get "..(#requir > 1 and "them" or "it").. "?.", reward = "Thanks for helping me, here is your reward!", done = "You have already done this mission.", notpremium = "Sorry, only players with premium account can make this mission.", notitems = "Sorry, you don't have all the items required for this mission "..getRequiredThings(cid), notlevel = "Sorry, you don't have the required level for make this mission {"..config.requirements.level.."}", wrong = "Huh?", negation = "Ok, maybe next time.." } local rq = getRequiredThings(cid) if (msgcontains(msg, 'mission')) then if (config.requirements.requiredpremium == true and not prm ) then return selfSay(msgs.notpremium, cid) end if (s == true)then return selfSay(msgs.done, cid) end if (config.requirements.requiredlevel == true and lv < config.requirements.level) then return selfSay(msgs.notlevel, cid) end selfSay(msgs.requirements,cid) talk_state = 1 elseif (msgcontains(msg, "yes")) and talk_state == 1 then if ( rq == "" ) then if (cap < itemscap) then return selfSay("Sorry, you don't have enough capacity to carry the reward. All weights items.cap", cid) end if (config.rewards.expvalue ~= false) then doPlayerAddExp(cid, config.rewards.expvalue) if (config.rewards.expcolor > 255 or config.rewards.expcolor <= 0) then config.rewards.expcolor = math.random(255) end doSendAnimatedText(getThingPos(cid), config.rewards.expvalue, config.rewards.expcolor) end if (config.rewards.money ~= false) then doPlayerAddMoney(cid, config.rewards.money) end if (config.rewards.reward ~= false) then for i,x in pairs (config.rewards.reward) do doPlayerAddItem(cid, i, x.amount) end end for i,x in pairs (config.requirements.itemsrequired) do doPlayerRemoveItem(cid, i, x.amount) end doPlayerSetStorageValue(cid, config.requirements.storage, 1) selfSay(msgs.reward.."".. rq, cid) talk_state = 0 else selfSay("Sorry, you don't have all items, you still need "..rq, cid) talk_state = 0 end elseif (msgcontains(msg, "no") and talk_state == 1 ) then selfSay(msgs.negation, cid) talk_state = 0 else selfSay(msgs.wrong, cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Rep+ Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/ Compartilhar em outros sites More sharing options...
Roksas 846 Postado Abril 5, 2013 Share Postado Abril 5, 2013 Tenta assim: local config = { requirements = { storage = 35565, requiredlevel = true, level = 55, requiredpremium = false, itemsrequired = { [11442] = {amount = 1}, -- entre [] pon el id de water stone -- [12170] = {amount = 100}, -- entre [] pon el id de las water pendant -- [12161] = {amount = 1000}, -- entre [] pon el id de las water gem -- }, }, rewards = { expvalue = 700, expcolor = 35, money = 350000, reward = { [2392] = {amount = 30}, -- entre [] pon el id de las ultra ball's -- }, } } local function getRequiredThings(cid) local msg = "" local itemsleft = { } for i,x in pairs(config.requirements.itemsrequired) do local item = getPlayerItemCount(cid, i) if (item < x.amount) then table.insert(itemsleft, x.amount - item.. "x "..getItemNameById(i)) end end msg = #itemsleft > 0 and "Items: "..table.concat(itemsleft, ", ") or "" return msg end local itemscap = 0 for i,x in pairs (config.requirements.itemsrequired) do itemscap = itemscap + getItemWeightById(i, x.amount) end local requir = {} for i,x in pairs(config.requirements.itemsrequired) do table.insert (requir, x.amount .. "x "..getItemNameById(i)) end 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 creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local cap = getPlayerFreeCap(cid) local s = getPlayerStorageValue(cid, config.requirements.storage) == 1 and true or false local lv = getPlayerLevel(cid) local prm = isPremium(cid) local msgs = { requirements = "Well, i need help to get some items. I need "..table.concat(requir, ", ").. ". Could you help me to get "..(#requir > 1 and "them" or "it").. "?.", reward = "Thanks for helping me, here is your reward!", done = "You have already done this mission.", notpremium = "Sorry, only players with premium account can make this mission.", notitems = "Sorry, you don't have all the items required for this mission "..getRequiredThings(cid), notlevel = "Sorry, you don't have the required level for make this mission {"..config.requirements.level.."}", wrong = "Huh?", negation = "Ok, maybe next time.." } local rq = getRequiredThings(cid) if (msgcontains(msg, 'mission')) then if (config.requirements.requiredpremium == true and not prm ) then return selfSay(msgs.notpremium, cid) end if (s == true)then return selfSay(msgs.done, cid) end if (config.requirements.requiredlevel == true and lv < config.requirements.level) then return selfSay(msgs.notlevel, cid) end selfSay(msgs.requirements,cid) talk_state = 1 elseif (msgcontains(msg, "yes")) and talk_state == 1 then if ( rq == "" ) then if (cap < itemscap) then return selfSay("Sorry, you don't have enough capacity to carry the reward. All weights items.cap", cid) end if (config.rewards.expvalue ~= false) then doPlayerAddExp(cid, config.rewards.expvalue) if (config.rewards.expcolor > 255 or config.rewards.expcolor <= 0) then config.rewards.expcolor = math.random(255) end doSendAnimatedText(getThingPos(cid), config.rewards.expvalue, config.rewards.expcolor) end if (config.rewards.money ~= false) then doPlayerAddMoney(cid, config.rewards.money) end if (config.rewards.reward ~= false) then for i,x in pairs (config.rewards.reward) do doPlayerAddItem(cid, i, x.amount) end end for i,x in pairs (config.requirements.itemsrequired) do doPlayerRemoveItem(cid, i, x.amount) end doPlayerSetStorageValue(cid, config.requirements.storage, 1) selfSay(msgs.reward.."".. rq, cid) talk_state = 0 else selfSay("Sorry, you don't have all items, you still need "..rq, cid) talk_state = 0 end elseif (msgcontains(msg, "no") and talk_state == 1 ) then selfSay(msgs.negation, cid) talk_state = 0 else selfSay(msgs.wrong, cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498644 Compartilhar em outros sites More sharing options...
BrunooMaciell 84 Postado Abril 5, 2013 Autor Share Postado Abril 5, 2013 so uma coisa onde vc mudo em que linha vc mudo pq tenho este npc bugado e mais 3 com o mesmo erro so mi passa a linha que tu mudo ou troco ^^ Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498648 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Abril 5, 2013 Share Postado Abril 5, 2013 Ok, mas antes teste para ver se funcionou, se funcionar já te digo, se não seria desnecessário ^^ Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498650 Compartilhar em outros sites More sharing options...
BrunooMaciell 84 Postado Abril 5, 2013 Autor Share Postado Abril 5, 2013 aeaeaeae ^^ se arrumo !! Rep+ Agora pode falar ;D Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498654 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Abril 5, 2013 Share Postado Abril 5, 2013 Apenas retire essa linha amigão: function onThink() npcHandler:onThink() end Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498658 Compartilhar em outros sites More sharing options...
BrunooMaciell 84 Postado Abril 5, 2013 Autor Share Postado Abril 5, 2013 pronto vlw ^^ ja tidei rep+ duvida sanada ;D Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498661 Compartilhar em outros sites More sharing options...
Roksas 846 Postado Abril 5, 2013 Share Postado Abril 5, 2013 Tópico movido para a seção de dúvidas e pedidos resolvidos. Link para o comentário https://xtibia.com/forum/topic/211439-encerrado-bug-npc-de-task/#findComment-1498664 Compartilhar em outros sites More sharing options...
Stigal 584 Postado Abril 21, 2018 Share Postado Abril 21, 2018 A questão neste tópico de 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/211439-encerrado-bug-npc-de-task/#findComment-1734087 Compartilhar em outros sites More sharing options...
Posts Recomendados