ta ae o npc ^^
dalila.xml
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dalila" script="NpcMulti.lua" walkinterval="350000" floorchange="0" speed="0" lookdir="2">
<health now="150" max="150"/>
<look type="640" head="91" body="114" legs="86" feet="0"/>
<parameters>
<parameter key="message_greet" value="Olá |PLAYERNAME|, você gostaria de fazer uma {missao}?"/>
</parameters>
</npc>
npc/scripts/NpcMulti.lua
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 qntdade = 600
local stoTime = 96586
local stoKill = 96587
local premio = 100000 --em exp!
local msg = string.lower(msg)
local left = math.ceil((getPlayerStorageValue(cid, stoTime) - os.time())/(24 * 60 * 60)) --nao mexe!
if (msgcontains(msg, 'tarefa') or msgcontains(msg, 'missao')) then
if getPlayerStorageValue(cid, stoTime) ~= -1 and left > 0 and getPlayerStorageValue(cid, stoKill) > 0 then
local faltaMatar = getPlayerStorageValue(cid, stoKill)
local jaMatou = math.abs(getPlayerStorageValue(cid, stoKill)-qntdade)
local prazo = os.date("%d/%m/%y %X", getPlayerStorageValue(cid, stoTime))
selfSay("Você ainda não matou os "..qntdade.." multis, atualmente você matou ".. (jaMatou)..", resta "..faltaMatar..". Seu prazo é de até "..prazo..".", cid)
talkState[talkUser] = 0
return true
elseif getPlayerStorageValue(cid, stoTime) ~= -1 and left <= 0 and getPlayerStorageValue(cid, stoKill) ~= -1 then
selfSay("Infelismente você não matou as "..qntdade.." multis a tempo. Se você quiser, você pode tentar fazer denovo a missao.", cid)
setPlayerStorageValue(cid, stoTime, -1)
setPlayerStorageValue(cid, stoKill, -1)
talkState[talkUser] = 0
return true
elseif getPlayerStorageValue(cid, stoTime) ~= -1 and left > 0 and getPlayerStorageValue(cid, stoKill) == -1 then
local prazo = os.date("%d/%m/%y %X", getPlayerStorageValue(cid, stoTime))
selfSay("Você tem que esperar pelo menos 1 semana para poder pegar essa tarefa denovo. O prazo de acaba dia ".. prazo..".", cid)
talkState[talkUser] = 0
return true
elseif getPlayerStorageValue(cid, stoTime) ~= -1 and left > 0 and getPlayerStorageValue(cid, stoKill) == 0 then
selfSay("Obrigado! você matou os "..qntdade.." multis em menos de 1 semana. Aqui esta sua recompensa! Lembre-se que você pode fazer esta task quantas vezes quiser,desde que tenha concluído 1 semana contado a partir do dia de inicio.", cid)
doPlayerAddExp(cid, premio) --premio
setPlayerStorageValue(cid, stoKill, -1)
talkState[talkUser] = 0
return true
else
if getPlayerStorageValue(cid, stoTime) ~= -1 and getPlayerStorageValue(cid, stoKill) == -1 then
setPlayerStorageValue(cid, stoTime, -1) --soh pra evitar problemas...
end
selfSay("Você quer me ajudar a acabar com poderosas gosmas chamadas Multi?", cid)
talkState[talkUser] = 1
end
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then
selfSay("Ótimo! Você precisa matar pelo menos "..qntdade.." Multis em um prazo de 1 semana para eu te dar a recompensa. Aceita?", cid)
talkState[talkUser] = 2
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 2 then
local semana = 7 * 24 * 60 * 60
setPlayerStorageValue(cid, stoTime, os.time()+semana)
setPlayerStorageValue(cid, stoKill, qntdade)
local sto = getPlayerStorageValue(cid, stoTime)
selfSay("Você já pode começar a matar os multis, mas cuidado! É uma criatura muito forte. Volte aqui quando matar "..qntdade.." multis para ser recompensado. O prazo é até ".. os.date("%d/%m/%y %X", sto) ..".", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
creaturescripts/scripts/TaskMulti.lua
function onDeath(cid, corpse, deathList)
local qntdade = 600
local stoTime = 96586
local stoKill = 96587
if getCreatureName(cid) == "Kadabra" then
for a = 1, #deathList do
local pk = deathList[a]
local left = math.ceil((getPlayerStorageValue(pk, stoTime) - os.time())/(24 * 60 * 60))
if left > 0 and getPlayerStorageValue(pk, stoKill) > 0 then
if getDamageMapPercent(pk, cid) >= 0.3 then -- o player tem q tirar pelo menos 30% da life do bixo para contar a task!
setPlayerStorageValue(pk, stoKill, getPlayerStorageValue(pk, stoKill) - 1)
local sto = getPlayerStorageValue(pk, stoKill)
local jaMatou = math.abs(getPlayerStorageValue(pk, stoKill)-qntdade)
if sto == 0 then
doPlayerSendTextMessage(pk, 22, "[Multi Task Finalizada] ("..qntdade.."/"..qntdade..")")
else
doPlayerSendTextMessage(pk, 22, "[Multi Task] ("..jaMatou.."/"..qntdade..")")
end
end
end
end
end
return true
end
vai no creaturescripts/scripts/login.lua e coloca isso la tb..
registerCreatureEvent(cid, "TaskMulti")
creaturescripts/craturescripts.xml
<event type="death" name="TaskMulti" event="script" value="TaskMulti.lua"/>
dai vai no .xml do Multi e coloca isso la no final do .xml antes do </monster>
<script> <event name="TaskMulti"/> </script>
qlqr duvida/bugs soh flar...







info
Grupo: Visconde
Registrado: 21/08/11
Posts: 470
Reputação: +5
Char no Tibia: ...
Galera Queria Um Sistema De Task Exatamente Do Geito Que Postarei Abaixo.
.Npc Desse Geito.
Dalila: Olá Din Grey. Você quer me ajudar acabar com poderosas gosmas chamadas multi?
Dalila: Ótimo! Você precisa matar pelo menos 600 multis em um prazo de 1 semana para te dar recompensa. Aceita?
Dalila: Você já pode começar a matar os multis, mas cuidado! É uma criatura muito forte. Volte aqui quando matar 600 multis para ser recompensado. O prazo é até 25/08/2012 16:57:40.
Dalila: Você ainda não matou os 600 multis, atualmente você matou 0, resta 600. Seu prazo é de até 25/08/2012 16:57:40.
Dalila: Obrigado! você matou os 600 multis em menos de 1 semana.Aqui esta sua recompensa! Lembre-se que você pode fazer esta task quantas vezes quiser,desde que tenha concluído 1 semana contado a partir do dia de inicio.
Dalila: Parabéns! Você já concluiu esta task 4 vezes
.
Aparecer na tela pro player que está fazendo a task as mensagems em cor branca assim
[Multi Task] (1/600).
[Multi Task Finalizada] (600/600).
O Premio È Em Exp.
Ajudem Ae Vlw REP + Pra Quem AJudar.