Ir para conteúdo

Featured Replies

Postado

Alguém pode me ajudar colocando um tempo no effect desse script?
Tipo quando o bixo morre e dropa um item importante aparece um effect de uma seta em cima do corpo. Más esse effect dura apenas 1 segundo, teria como aumentar para 1 minuto?

Uso TFS 0.3.6

 

local config = {
    itemid =  {2434, 7730},                        --IDs dos items, para aumentar só colocar repetir o padrao Ex: {2471, 7730, 2160}. --Edited by Zefz/Vabrindox
    drop_effect = 296   	--Efeito que aparecerá em cima da corpse, OPCIONAL! Se não quiser, coloque false.
}
 
function examine(cid, position, corpse_id)
    if not isPlayer(cid) then return true end
    local corpse = getTileItemById(position, corpse_id).uid
    
    if corpse <= 1 or not isContainer(corpse) then return true end
 
    for slot = 0, getContainerSize(corpse) - 1 do
        local item = getContainerItem(corpse, slot)
        if item.uid <= 1 then return true end
        
        for i, listid in ipairs(config.itemid) do
            if item.itemid == listid then
                if config.drop_effect then
                    doSendMagicEffect(position, config.drop_effect, cid)
                end
            end
        end

    end
end
 
function onKill(cid, target)
    if not isMonster(target) then return true end
    
    local corpse_id = getMonsterInfo(getCreatureName(target)).lookCorpse
 
addEvent(examine, 2, cid, getThingPos(target), corpse_id)
    return true
end

 

Resolvido por Vodkart

Ir para solução
Postado
local config = {
	itemid = {2434, 7730}, --IDs dos items, para aumentar só colocar repetir o padrao Ex: {2471, 7730, 2160}. --Edited by Zefz/Vabrindox
	drop_effect = 296, 	--Efeito que aparecerá em cima da corpse, OPCIONAL! Se não quiser, coloque false.
	time = 60 -- em segundos
}
function doEffectCorpse(position, corpse_id, seconds)
	local corpse = getTileItemById(position, corpse_id).uid
	if corpse <= 1 or not isContainer(corpse) then return true end
	doSendMagicEffect(position, config.drop_effect)
	if seconds ~= 1 then addEvent(doEffectCorpse, 1000, position, corpse_id, seconds-1) end
end
function examine(cid, position, corpse_id)
	if not isPlayer(cid) then return true end
	local corpse = getTileItemById(position, corpse_id).uid
	if corpse <= 1 or not isContainer(corpse) then return true end
	for slot = 0, getContainerSize(corpse) - 1 do
		local item = getContainerItem(corpse, slot)
		if item.uid <= 1 then return true end
		for i, listid in ipairs(config.itemid) do
			if item.itemid == listid then
				if config.drop_effect then
					doEffectCorpse(position, corpse_id, config.time)
				end
			end
		end	
	end
end
function onKill(cid, target)
	if not isMonster(target) then return true end
	local corpse_id = getMonsterInfo(getCreatureName(target)).lookCorpse
	addEvent(examine, 2, cid, getThingPos(target), corpse_id)
	return true
end

 

Postado
  • Autor
  Em 16/08/2021 em 13:54, Vodkart disse:

local config = {
	itemid = {2434, 7730}, --IDs dos items, para aumentar só colocar repetir o padrao Ex: {2471, 7730, 2160}. --Edited by Zefz/Vabrindox
	drop_effect = 296, 	--Efeito que aparecerá em cima da corpse, OPCIONAL! Se não quiser, coloque false.
	time = 60 -- em segundos
}
function doEffectCorpse(position, corpse_id, seconds)
	local corpse = getTileItemById(position, corpse_id).uid
	if corpse <= 1 or not isContainer(corpse) then return true end
	doSendMagicEffect(position, config.drop_effect)
	if seconds ~= 1 then addEvent(doEffectCorpse, 1000, position, corpse_id, seconds-1) end
end
function examine(cid, position, corpse_id)
	if not isPlayer(cid) then return true end
	local corpse = getTileItemById(position, corpse_id).uid
	if corpse <= 1 or not isContainer(corpse) then return true end
	for slot = 0, getContainerSize(corpse) - 1 do
		local item = getContainerItem(corpse, slot)
		if item.uid <= 1 then return true end
		for i, listid in ipairs(config.itemid) do
			if item.itemid == listid then
				if config.drop_effect then
					doEffectCorpse(position, corpse_id, config.time)
				end
			end
		end	
	end
end
function onKill(cid, target)
	if not isMonster(target) then return true end
	local corpse_id = getMonsterInfo(getCreatureName(target)).lookCorpse
	addEvent(examine, 2, cid, getThingPos(target), corpse_id)
	return true
end

 

Cara deu certinho! XD mas sabe oque pode ser que acontece aqui? 
O efeito está duplicando o tempo todo, acha que pode ser do proprio effect mesmo ou tem alguma forma de arrumar isso?

Capturar.PNG

Postado
  • Solução
  Em 16/08/2021 em 20:44, Nother disse:

Cara deu certinho! XD mas sabe oque pode ser que acontece aqui? 
O efeito está duplicando o tempo todo, acha que pode ser do proprio effect mesmo ou tem alguma forma de arrumar isso?

Capturar.PNG

 

 

é que eu acho que o tempo do efeito a seta é de 2 segundos se não me engano né? 

 

usa assim para ver:

 

local config = {
	itemid = {2434, 7730}, --IDs dos items, para aumentar só colocar repetir o padrao Ex: {2471, 7730, 2160}. --Edited by Zefz/Vabrindox
	drop_effect = 296, 	--Efeito que aparecerá em cima da corpse, OPCIONAL! Se não quiser, coloque false.
	time = 30 -- em segundos
}
function doEffectCorpse(position, corpse_id, seconds)
	local corpse = getTileItemById(position, corpse_id).uid
	if corpse <= 1 or not isContainer(corpse) then return true end
	doSendMagicEffect(position, config.drop_effect)
	if seconds ~= 1 then addEvent(doEffectCorpse, 2000, position, corpse_id, seconds-1) end
end
function examine(cid, position, corpse_id)
	if not isPlayer(cid) then return true end
	local corpse = getTileItemById(position, corpse_id).uid
	if corpse <= 1 or not isContainer(corpse) then return true end
	for slot = 0, getContainerSize(corpse) - 1 do
		local item = getContainerItem(corpse, slot)
		if item.uid <= 1 then return true end
		for i, listid in ipairs(config.itemid) do
			if item.itemid == listid then
				if config.drop_effect then
					doEffectCorpse(position, corpse_id, config.time)
				end
			end
		end	
	end
end
function onKill(cid, target)
	if not isMonster(target) then return true end
	local corpse_id = getMonsterInfo(getCreatureName(target)).lookCorpse
	addEvent(examine, 2, cid, getThingPos(target), corpse_id)
	return true
end

 

 

qualquer coisa mude essa linha:

 

if seconds ~= 1 then addEvent(doEffectCorpse, 2000, position, corpse_id, seconds-1) end

 

 

onde está 2000 coloque por exemplo 2500(2,5 segundos) ou 3000(3 segundos)

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo