Postado Abril 21, 2017 8 anos Eu estava testando uns npcs que postaram aqui no tk e um me chamou atenção Testei no meu servidor que estou montando e funcionou tudo corretamente, exceto por uma coisa Pelo visto só é possivel fazer a tarefa 1x por Account , tipo eu sabia que no char que eu fiz n dava mais Ai loguei outro e fui falar com o npc, mas o npc disse que eu ja tinha feito, loguei outro...deu na mesma, alguem poderia analizar o sistema e corrigir isso pra mim por favor ?
Postado Abril 21, 2017 8 anos poderia fazer o seguinte Mods: Task Kill.xml <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Task Kill" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="KillM_func"><![CDATA[ tsk = { storages = {68754,68755}, task = {"dragon", 10}, -- nome do bixo e quantidade exp = 200, item = {2123,1} } ]]></config> <event type="login" name="AreKill" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "CountTask") return true end]]></event> <event type="kill" name="CountTask" event="script"><![CDATA[ domodlib('KillM_func') function onKill(cid, target) if isMonster(target) then local n = string.lower(getCreatureName(target)) if n == tsk.task[1] and getPlayerStorageValue(cid, tsk.storages[2]) >= 1 then local contagem = getPlayerStorageValue(cid, tsk.storages[1]) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > tsk.task[2] then return true end setPlayerStorageValue(cid, tsk.storages[1], contagem+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == tsk.task[2] and "Congratulations! You finished the task of "..n.."." or "defeated. Total [" .. contagem .. "/" .. tsk.task[2] .. "] " .. n .. ".").."") end end return true end]]></event> </mod> e em npc domodlib('KillM_func') 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 talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"task","mission","missao"}, msg) then if not tonumber(getPlayerStorageValue(cid, tsk.storages[1])) then npcHandler:say("Você já terminou a task!", cid) elseif getPlayerStorageValue(cid, tsk.storages[2]) >= 1 then npcHandler:say("Você já matou "..tsk.task[2].." "..tsk.task[1].."? {yes}", cid) talkState[talkUser] = 2 else npcHandler:say("Você deseja fazer uma missão de matar "..tsk.task[2].." "..tsk.task[1].." e receber "..tsk.exp.." de experience e "..tsk.item[2].." "..getItemNameById(tsk.item[1]).."? {yes}", cid) talkState[talkUser] = 1 end elseif isInArray({"yes","sim"}, msg) and talkState[talkUser] > 0 then if talkState[talkUser] == 1 then npcHandler:say("Parabéns! Agora você está participando da task, volte quanto tiver terminado!", cid) setPlayerStorageValue(cid, tsk.storages[2], 1) else if getPlayerStorageValue(cid, tsk.storages[1]) >= tsk.task[2] then npcHandler:say("Obrigado guerreiro, aqui está sua recompensa!", cid) setPlayerStorageValue(cid, tsk.storages[1], "Finished") doPlayerAddExp(cid, tsk.exp) doPlayerAddItem(cid, tsk.item[1], tsk.item[2]) else npcHandler:say("Você ainda não terminou a sua task!", cid) end end talkState[talkUser] = 0 elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Abril 21, 2017 8 anos Autor 2 minutos atrás, frank007 disse: poderia fazer o seguinte Mods: Task Kill.xml <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Task Kill" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="KillM_func"><![CDATA[ tsk = { storages = {68754,68755}, task = {"dragon", 10}, -- nome do bixo e quantidade exp = 200, item = {2123,1} } ]]></config> <event type="login" name="AreKill" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "CountTask") return true end]]></event> <event type="kill" name="CountTask" event="script"><![CDATA[ domodlib('KillM_func') function onKill(cid, target) if isMonster(target) then local n = string.lower(getCreatureName(target)) if n == tsk.task[1] and getPlayerStorageValue(cid, tsk.storages[2]) >= 1 then local contagem = getPlayerStorageValue(cid, tsk.storages[1]) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > tsk.task[2] then return true end setPlayerStorageValue(cid, tsk.storages[1], contagem+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == tsk.task[2] and "Congratulations! You finished the task of "..n.."." or "defeated. Total [" .. contagem .. "/" .. tsk.task[2] .. "] " .. n .. ".").."") end end return true end]]></event> </mod> e em npc domodlib('KillM_func') 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 talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"task","mission","missao"}, msg) then if not tonumber(getPlayerStorageValue(cid, tsk.storages[1])) then npcHandler:say("Você já terminou a task!", cid) elseif getPlayerStorageValue(cid, tsk.storages[2]) >= 1 then npcHandler:say("Você já matou "..tsk.task[2].." "..tsk.task[1].."? {yes}", cid) talkState[talkUser] = 2 else npcHandler:say("Você deseja fazer uma missão de matar "..tsk.task[2].." "..tsk.task[1].." e receber "..tsk.exp.." de experience e "..tsk.item[2].." "..getItemNameById(tsk.item[1]).."? {yes}", cid) talkState[talkUser] = 1 end elseif isInArray({"yes","sim"}, msg) and talkState[talkUser] > 0 then if talkState[talkUser] == 1 then npcHandler:say("Parabéns! Agora você está participando da task, volte quanto tiver terminado!", cid) setPlayerStorageValue(cid, tsk.storages[2], 1) else if getPlayerStorageValue(cid, tsk.storages[1]) >= tsk.task[2] then npcHandler:say("Obrigado guerreiro, aqui está sua recompensa!", cid) setPlayerStorageValue(cid, tsk.storages[1], "Finished") doPlayerAddExp(cid, tsk.exp) doPlayerAddItem(cid, tsk.item[1], tsk.item[2]) else npcHandler:say("Você ainda não terminou a sua task!", cid) end end talkState[talkUser] = 0 elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) vlw, vou tentar arrumar aquele, e se n der vo usar o de task msm.
Postado Abril 21, 2017 8 anos não esqueça de marcar como melhor resposta para q posa ajudar outros com o mesmo problema!
Postado Abril 21, 2017 8 anos Autor 23 minutos atrás, frank007 disse: poderia fazer o seguinte Mods: Task Kill.xml <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Task Kill" version="1.0" author="Vodkart" contact="tibiaking.com" enabled="yes"> <config name="KillM_func"><![CDATA[ tsk = { storages = {68754,68755}, task = {"dragon", 10}, -- nome do bixo e quantidade exp = 200, item = {2123,1} } ]]></config> <event type="login" name="AreKill" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "CountTask") return true end]]></event> <event type="kill" name="CountTask" event="script"><![CDATA[ domodlib('KillM_func') function onKill(cid, target) if isMonster(target) then local n = string.lower(getCreatureName(target)) if n == tsk.task[1] and getPlayerStorageValue(cid, tsk.storages[2]) >= 1 then local contagem = getPlayerStorageValue(cid, tsk.storages[1]) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > tsk.task[2] then return true end setPlayerStorageValue(cid, tsk.storages[1], contagem+1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == tsk.task[2] and "Congratulations! You finished the task of "..n.."." or "defeated. Total [" .. contagem .. "/" .. tsk.task[2] .. "] " .. n .. ".").."") end end return true end]]></event> </mod> e em npc domodlib('KillM_func') 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 talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if isInArray({"task","mission","missao"}, msg) then if not tonumber(getPlayerStorageValue(cid, tsk.storages[1])) then npcHandler:say("Você já terminou a task!", cid) elseif getPlayerStorageValue(cid, tsk.storages[2]) >= 1 then npcHandler:say("Você já matou "..tsk.task[2].." "..tsk.task[1].."? {yes}", cid) talkState[talkUser] = 2 else npcHandler:say("Você deseja fazer uma missão de matar "..tsk.task[2].." "..tsk.task[1].." e receber "..tsk.exp.." de experience e "..tsk.item[2].." "..getItemNameById(tsk.item[1]).."? {yes}", cid) talkState[talkUser] = 1 end elseif isInArray({"yes","sim"}, msg) and talkState[talkUser] > 0 then if talkState[talkUser] == 1 then npcHandler:say("Parabéns! Agora você está participando da task, volte quanto tiver terminado!", cid) setPlayerStorageValue(cid, tsk.storages[2], 1) else if getPlayerStorageValue(cid, tsk.storages[1]) >= tsk.task[2] then npcHandler:say("Obrigado guerreiro, aqui está sua recompensa!", cid) setPlayerStorageValue(cid, tsk.storages[1], "Finished") doPlayerAddExp(cid, tsk.exp) doPlayerAddItem(cid, tsk.item[1], tsk.item[2]) else npcHandler:say("Você ainda não terminou a sua task!", cid) end end talkState[talkUser] = 0 elseif msg == "no" then selfSay("Tudo bem então", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) a parte do npc, so criar outro npc no xml ?
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.