Ir para conteúdo
  • 0

[BUG]Npc da task mais de uma vez.


Pergunta

dentro do meu servidor tem um npc que da a task mais de uma vez... tipo queria que quando acabasse a task, não pudesse pegar denovo.Mais no npc assim que acaba ele entrega o premio, e pode pegar quantas vezes quiser a task novamente.

obs:uso base CYAN.

XML 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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

local task = {
["Misty"] = {{"Brave Blastoise", 100}, {"War Gyarados", 100}, {"Tribal Feraligatr", 100}},
}

if msgcontains(msg, 'task') or msgcontains(msg, 'Task') then
if isMyTaskComplete(cid, getNpcCid()) then
selfSay("Nossa, voce completou minha task! Ok, pegue sua recompensa!", cid)
doPlayerAddExperience(cid, 8000000) --premio --Quase 2 leveis no nivel 101
doPlayerAddItem(cid, 2160, 5) --premio
local sto = getMyTaskSto(cid, getNpcCid())
setPlayerStorageValue(cid, sto, -1)
talkState[talkUser] = 0
return true
else
selfSay("Ola, eu tenho uma task para voce, voce tera que matar {100 Tribal Feraligatr, 100 War Gyarados and 100 Brave Blastoise}, voce aceita a task?", cid)
talkState[talkUser] = 2
end
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'Yes')) and talkState[talkUser] == 2 then
if getMyTaskSto(cid, getNpcCid()) ~= -1 then
selfSay("You are already doing my task! go end it!", cid)
talkState[talkUser] = 0
return true
end
local sto = getFreeTaskStorage(cid)
if sto == -1 then
selfSay("You can't catch more tasks! You are already with the maximum of "..(maxTasks).." tasks!", cid)
talkState[talkUser] = 0
return true
end

selfSay("OK then... Go kill your targets!", cid)
setStorageArray(cid, sto, task)
talkState[talkUser] = 0
return true
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

Link para o comentário
https://xtibia.com/forum/topic/240024-bugnpc-da-task-mais-de-uma-vez/
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

...

 

 

  Mostrar conteúdo oculto

 

Link para o comentário
https://xtibia.com/forum/topic/240024-bugnpc-da-task-mais-de-uma-vez/#findComment-1689063
Compartilhar em outros sites

×
×
  • Criar Novo...