Ir para conteúdo
  • 0

Function onDeath (cid, corpse, deathList) erro


julhinhuu

Pergunta

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
end

ERROR:

post-321783-0-09319900-1456939766_thumb.png

 

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

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)

Link para o comentário
Compartilhar em outros sites

  • 0

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 por julhinhokullitz
Link para o comentário
Compartilhar em outros sites

  • 0

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
Link para o comentário
Compartilhar em outros sites

  • 0
  Em 02/03/2016 em 21:08, Lucas CP disse:

 

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:

 

  Mostrar conteúdo oculto

 

O sistema todo é só isso mesmo HAHAH'.

 

Link para o comentário
Compartilhar em outros sites

  • 0
  Em 03/03/2016 em 12:10, Lucas CP disse:

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.

Link para o comentário
Compartilhar em outros sites

  • 0
  Em 03/03/2016 em 16:49, Lucas CP disse:

isso não muda em nada, passa essas etapa:

- creaturescripts.xml

- login.lua

 

Login:

 

  Mostrar conteúdo oculto

 

Creaturescript.XML:

 

  Mostrar conteúdo oculto

 

Link para o comentário
Compartilhar em outros sites

  • 0

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
Link para o comentário
Compartilhar em outros sites

  • 0
  Em 03/03/2016 em 17:28, Lucas CP disse:

 

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:

post-321783-0-22784800-1457064234_thumb.png

 

Up

UP

Editado por julhinhokullitz
Link para o comentário
Compartilhar em outros sites

  • 0
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.

Link para o comentário
Compartilhar em outros sites

  • 0
  Em 09/03/2016 em 06:00, TheVankk disse:
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.

 

 

Erro:

post-321783-0-77279000-1457503749_thumb.png

 

Esse erro ta sendo o mesmo do sistema de task do Limos.

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...