A função onDeath no tfs 1.x não é mais assim:
onDeath(cid, corpse, deathList)
vc terá que adaptar para esse formato:
onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
Por julhinhuu, 02 de mar. de 2016 em Scripts
A função onDeath no tfs 1.x não é mais assim:
onDeath(cid, corpse, deathList)
vc terá que adaptar para esse formato:
onDeath(cid, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified, mostdamageunjustified)
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

Sei nem por onde começar. Poderia adaptar este script para mim, já havia a percebido que tinha mudado a função por isso não funcionava haha.
Editado Março 2 por julhinhokullitz
muda o callback para onKill e add esse codigo:
local task = {
['multi'] = {total = 600, stoTime = 96586, stoKill = 96587, amount = 1}
}
function onKill(cid, target)
local player = Player(cid)
local monstro = Monster(target)
if not monstro then
return true
end
if monstro:getMaster() then
return true
end
local multi = task[monstro:getName():lower()]
if player:getStorageValue(multi.stoTime) >= os.time() then
if player:getStorageValue(multi.stoKill) < 0 then
player:setStorageValue(multi.stoKill,0)
end
player:setStorageValue(multi.stoKill, player:getStorageValue(multi.stoKill) + multi.amount)
if player:getStorageValue(multi.stoKill) >= multi.total then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task Finalizada] (%d/%d)',monstro:getName(),multi.total,multi.total))
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task] (%d/%d)',monstro:getName(),player:getStorageValue(multi.stoKill),multi.total))
end
end
return true
end
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

muda o callback para onKill e add esse codigo:
local task = { ['multi'] = {total = 600, stoTime = 96586, stoKill = 96587, amount = 1} } function onKill(cid, target) local player = Player(cid) local monstro = Monster(target) if not monstro then return true end if monstro:getMaster() then return true end local multi = task[monstro:getName():lower()] if player:getStorageValue(multi.stoTime) >= os.time() then if player:getStorageValue(multi.stoKill) < 0 then player:setStorageValue(multi.stoKill,0) end player:setStorageValue(multi.stoKill, player:getStorageValue(multi.stoKill) + multi.amount) if player:getStorageValue(multi.stoKill) >= multi.total then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task Finalizada] (%d/%d)',monstro:getName(),multi.total,multi.total)) else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task] (%d/%d)',monstro:getName(),player:getStorageValue(multi.stoKill),multi.total)) end end return true end
Bem não contou os monstros ao matar, vou te enviar o sistema completo para você dar uma olhada.
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 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())
O sistema todo é só isso mesmo HAHAH'.
em creaturescripts.xml mude o tipo de "death" para "kill"
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

em creaturescripts.xml mude o tipo de "death" para "kill"
Mudei sim, no onDeath necessario registrar no monstro e no onKill também é necessário? Testei das duas formas só para ressaltar mais nada. Nenhum erro deu com onKill.
Ta registrado no login.lua?
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

Registrei da forma do 0.4, talvez seja isso ?
isso não muda em nada, passa essas etapa:
- creaturescripts.xml
- login.lua
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

isso não muda em nada, passa essas etapa:
- creaturescripts.xml
- login.lua
Login:
-- ordered as in creaturescripts.xml
local events = {
'pythiusDead',
'bossesGrayIsland',
'ElementalSpheres',
'ElementalSpheresKill',
'ElementalSpheresLogin',
'WarzoneThree',
'WarzoneTwo',
'bossesWarzone',
'SvargrondArenaKill',
'PharaoKillPortal',
'inServiceOfYalaharQuestsDiseased',
'inServiceOfYalaharQuestsMorik',
'inServiceOfYalaharQuestsQuara',
'inquisitionQuestBosses',
'inquisitionQuestUngreez',
'killingInTheNameOfQuestKills',
'TaskCustom',
'Yielothax',
'Energized',
'Raging',
'MastersVoiceServants',
'wrathBoss',
'wrathZalamon',
'PlayerDeath',
'ThievesGuildNomad',
'AdvanceSave',
'SpikeDrillworm',
'SecretServiceBlackKnight'
}
registerCreatureEvent(cid, "TaskMulti")
function onLogin(cid)
local player = Player(cid)
local loginStr = 'Bem-vindo ao ' .. configManager.getString(configKeys.SERVER_NAME) .. ' Tibia Server!'
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. ' Por favor, escolha a sua roupa.'
player:sendTutorial(1)
else
if loginStr ~= '' then
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
end
loginStr = string.format('Sua última visita foi em %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
db.query("UPDATE `players` SET `cast` = 0 WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
for i = 1, #events do
player:registerEvent(events[i])
end
return true
end
Creaturescript.XML:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<!-- Secret Service Quest -->
<event type="kill" name="SecretServiceBlackKnight" script="others/blackKnight.lua"/>
<!-- Spike Task: Drillworm -->
<event type="kill" name="SpikeDrillworm" script="spike task/drillworm.lua"/>
<!-- Thieves Guild Quest -->
<event type="kill" name="ThievesGuildNomad" script="others/nomad.lua"/>
<!-- Pythius The Rotten -->
<event type="kill" name="pythiusDead" script="pythius the rotten/pythiusDead.lua" />
<!-- Gray Island -->
<event type="kill" name="bossesGrayIsland" script="gray island/bossesgrayisland.lua"/>
<!-- Gnomebase -->
<event type="kill" name="WarzoneTwo" script="gnomebase/warzone2.lua"/>
<event type="kill" name="WarzoneThree" script="gnomebase/warzone3.lua"/>
<event type="kill" name="bossesWarzone" script="gnomebase/bossesWarzone.lua"/>
<!-- Svargrond Arena: Killing a boss -->
<event type="kill" name="SvargrondArenaKill" script="svargrond arena quest/arena_kill.lua"/>
<!-- Pharaos: Portal to reward room -->
<event type="kill" name="PharaoKillPortal" script="others/pharaoPortal.lua"/>
<!-- In Service Of Yalahar Quest -->
<event type="kill" name="inServiceOfYalaharQuestsDiseased" script="in service of yalahar quest/inServiceOfYalaharQuestsDiseased.lua"/>
<event type="kill" name="inServiceOfYalaharQuestsMorik" script="in service of yalahar quest/inServiceOfYalaharQuestsMorik.lua"/>
<event type="kill" name="inServiceOfYalaharQuestsQuara" script="in service of yalahar quest/inServiceOfYalaharQuestsQuara.lua"/>
<!-- Inquisition Quest -->
<event type="kill" name="inquisitionQuestBosses" script="inquisition quest/inquisitionQuestBosses.lua"/>
<event type="kill" name="inquisitionQuestUngreez" script="inquisition quest/inquisitionQuestUngreez.lua"/>
<!-- Killing In The Name Of Quest -->
<event type="kill" name="killingInTheNameOfQuestKills" script="killing in the name of quest/killingInTheNameOfQuestKills.lua"/>
<event type="kill" name="TaskCustom" script="killing in the name of quest/taskcustom.lua"/>
<!-- Raging Mage Tower -->
<event type="kill" name="Yielothax" script="raging mage tower/yielothax.lua"/>
<event type="kill" name="Energized" script="raging mage tower/energized.lua"/>
<event type="kill" name="Raging" script="raging mage tower/raging.lua"/>
<!-- The Masters Voice Quest -->
<event type="kill" name="MastersVoiceServants" script="their master's voice quest/ServantsKill.lua"/>
<!-- Wrath of Emperor -->
<event type="kill" name="wrathBoss" script="wrath of the emperor quest/wrathOfTheEmperorQuestBoss.lua"/>
<event type="kill" name="wrathZalamon" script="wrath of the emperor quest/wrathOfTheEmperorQuestZalamon.lua"/>
<!-- Others -->
<event type="logout" name="Cast" script="others/cast.lua"/>
<event type="login" name="PlayerLogin" script="others/login.lua"/>
<event type="login" name="CheckPremium" script="others/checkpremium.lua"/>
<event type="death" name="PlayerDeath" script="others/playerdeath.lua"/>
<event type="advance" name="AdvanceSave" script="others/advance_save.lua"/>
<event type="advance" name="AdvanceRook" script="others/advance_rook.lua"/>
<event type="advance" name="Recompense" script="others/recompense.lua"/>
<event type="login" name="AddonsMounts" script="others/addons-montarias.lua"/>
<event type="kill" name="TaskMulti" script="others/TaskMulti.lua"/>
</creaturescripts>
Mude seu login.lua para esse:
-- ordered as in creaturescripts.xml
local events = {
'pythiusDead',
'bossesGrayIsland',
'ElementalSpheres',
'ElementalSpheresKill',
'ElementalSpheresLogin',
'WarzoneThree',
'WarzoneTwo',
'bossesWarzone',
'SvargrondArenaKill',
'PharaoKillPortal',
'inServiceOfYalaharQuestsDiseased',
'inServiceOfYalaharQuestsMorik',
'inServiceOfYalaharQuestsQuara',
'inquisitionQuestBosses',
'inquisitionQuestUngreez',
'killingInTheNameOfQuestKills',
'TaskCustom',
'Yielothax',
'Energized',
'Raging',
'MastersVoiceServants',
'wrathBoss',
'wrathZalamon',
'PlayerDeath',
'ThievesGuildNomad',
'AdvanceSave',
'SpikeDrillworm',
'SecretServiceBlackKnight',
'TaskMulti'
}
function onLogin(cid)
local player = Player(cid)
local loginStr = 'Bem-vindo ao ' .. configManager.getString(configKeys.SERVER_NAME) .. ' Tibia Server!'
if player:getLastLoginSaved() <= 0 then
loginStr = loginStr .. ' Por favor, escolha a sua roupa.'
player:sendTutorial(1)
else
if loginStr ~= '' then
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
end
loginStr = string.format('Sua última visita foi em %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
db.query("UPDATE `players` SET `cast` = 0 WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end
player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
for i = 1, #events do
player:registerEvent(events[i])
end
return true
end
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

Mude seu login.lua para esse:
-- ordered as in creaturescripts.xml local events = { 'pythiusDead', 'bossesGrayIsland', 'ElementalSpheres', 'ElementalSpheresKill', 'ElementalSpheresLogin', 'WarzoneThree', 'WarzoneTwo', 'bossesWarzone', 'SvargrondArenaKill', 'PharaoKillPortal', 'inServiceOfYalaharQuestsDiseased', 'inServiceOfYalaharQuestsMorik', 'inServiceOfYalaharQuestsQuara', 'inquisitionQuestBosses', 'inquisitionQuestUngreez', 'killingInTheNameOfQuestKills', 'TaskCustom', 'Yielothax', 'Energized', 'Raging', 'MastersVoiceServants', 'wrathBoss', 'wrathZalamon', 'PlayerDeath', 'ThievesGuildNomad', 'AdvanceSave', 'SpikeDrillworm', 'SecretServiceBlackKnight', 'TaskMulti' } function onLogin(cid) local player = Player(cid) local loginStr = 'Bem-vindo ao ' .. configManager.getString(configKeys.SERVER_NAME) .. ' Tibia Server!' if player:getLastLoginSaved() <= 0 then loginStr = loginStr .. ' Por favor, escolha a sua roupa.' player:sendTutorial(1) else if loginStr ~= '' then player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr) end loginStr = string.format('Sua última visita foi em %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved())) db.query("UPDATE `players` SET `cast` = 0 WHERE `id` = " .. getPlayerGUID(cid) .. ";") end player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr) for i = 1, #events do player:registerEvent(events[i]) end return true end
Está aparecendo assim agora:
00:27 [Multi Task Finalizada] (600/600) 00:27 [Multi Task Finalizada] (600/600) 00:27 [Multi Task Finalizada] (600/600)
obs: Apenas matei três.
E no NPC está aparecendo assim:
00:28 Dalila: Você ainda não matou os 600 multis, atualmente você matou 3, resta 603. Seu prazo é de até 09/03/16 03:00:31.
Quase lá, não desista de mim '-'.
obs: Da conflito ao matar outros monstros
error:
Up
UP
Editado Março 4 por julhinhokullitz
local task = {
['multi'] = {total = 600, stoTime = 96586, stoKill = 96587, amount = 1}
}
function onKill(creature, target)
local targetMonster = target:getMonster()
if not targetMonster then
return true
end
local multi = task[targetMonster:getName():lower()]
local player = creature:getPlayer()
if player:getStorageValue(multi.stoTime) >= os.time() then
if player:getStorageValue(multi.stoKill) < 0 then
player:setStorageValue(multi.stoKill,0)
end
player:setStorageValue(multi.stoKill, player:getStorageValue(multi.stoKill) + multi.amount)
if player:getStorageValue(multi.stoKill) >= multi.total then
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task Finalizada] (%d/%d)',monstro:getName(),multi.total,multi.total))
else
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task] (%d/%d)',monstro:getName(),player:getStorageValue(multi.stoKill),multi.total))
end
end
return true
end
Tenta algo assim.
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea

local task = { ['multi'] = {total = 600, stoTime = 96586, stoKill = 96587, amount = 1} } function onKill(creature, target) local targetMonster = target:getMonster() if not targetMonster then return true end local multi = task[targetMonster:getName():lower()] local player = creature:getPlayer() if player:getStorageValue(multi.stoTime) >= os.time() then if player:getStorageValue(multi.stoKill) < 0 then player:setStorageValue(multi.stoKill,0) end player:setStorageValue(multi.stoKill, player:getStorageValue(multi.stoKill) + multi.amount) if player:getStorageValue(multi.stoKill) >= multi.total then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task Finalizada] (%d/%d)',monstro:getName(),multi.total,multi.total)) else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task] (%d/%d)',monstro:getName(),player:getStorageValue(multi.stoKill),multi.total)) end end return true endTenta algo assim.
Erro:
Esse erro ta sendo o mesmo do sistema de task do Limos.
info
Grupo: Visconde
Registrado: 28/06/11
Posts: 356
Reputação: +26
Char no Tibia: Akor Rysea
Olá galera, Boa tarde.
Hoje vim pedir uma ajuda para solucionar um problema no onDeath da minha Task.
TFS: 1.2
Versão: 10.9
CreatureScript:
function onDeath(cid, corpse, deathList) local qntdade = 600 local stoTime = 96586 local stoKill = 96587 if getCreatureName(cid) == "Multi" 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 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 return true endERROR: