Ir para conteúdo

Featured Replies

Postado

Estou tendo um problema nesse script, ele não faz o que era pra ser feito, alguém pode me ajudar? eu uso tfs 0.4
 no caso o script faria o seguinte, tem uma lista de ids, e cada id recebe um valor "2523 = 1",e tem uma variavel "soma" que recebe a soma dos valores mas só quando o item esta sendo usado e retorna essa valor como addon
 


	    <movevent type="Equip" itemid="2523" slot="shield" event="script" value="addon.lua"/>

	    <movevent type="DeEquip" itemid="2523" slot="shield" event="script" value="addon.lua"/>

	    <movevent type="Equip" itemid="2195" slot="feet" event="script" value="addon.lua"/>

	    <movevent type="DeEquip" itemid="2195" slot="feet" event="script" value="addon.lua"/>
function onEquip(cid, item, slot)

	        local tabVal = {

	        [2523] = 1,

	        [2195] = 2

	    }

	    

	        local soma = 0

	    for k, v in pairs(tabVal) do

	        for slot = 1, 10 do

	            if getPlayerSlotItem(cid, slot).itemid == k then

	                soma = soma + v

	                doPlayerAddOutfit(cid, 128, soma)

	            end

	        end

	    end

	    return true

	end


 

function onDeEquip(cid, item, slot)

	        local tabVal = {

	        [2523] = 1,

	        [2195] = 2

	    }

	    

	        local soma = 0

	    for k, v in pairs(tabVal) do

	        for slot = 1, 10 do

	            if getPlayerSlotItem(cid, slot).itemid == k then

	                soma = soma + v

	                doPlayerAddOutfit(cid, 128, soma)

	            end

	        end

	    end

	    return true

	end


 

 

 

Postado

Não entendi muito bem... Mas vou arriscar:

function onEquip(cid, item, slot)
	local tabVal = {
		[2523] = 1,
		[2195] = 2
	}
	
	local soma = 0
	for k, v in pairs(tabVal) do
		for slot = 1, 10 do
			if(getPlayerSlotItem(cid, slot).itemid == k) then
				soma = soma + v
			end
		end
	end
	if(soma > 0) then
		doPlayerAddOutfit(cid, 128, soma)
	end
	return true
end

 

Postado

MMHUCMQ.png  Esta é uma mensagem automática, este tópico foi movido para a área correta.
  Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680

Bruno Carvalho / Ex-Administrador TibiaKing

[email protected]

 

Em 26/12/2016 em 03:47, Spraypaint disse:

A força da alienação vem dessa fragilidade dos indivíduos, quando apenas conseguem identificar o que os separa e não o que os une.

-miltinho

 

wMwSJFE.png?1

 

Postado

Boa noite,

 

Teste assim:

 

local slots = 10 -- Para registro, nao mexa
local tabVal = {
	[2523] = {value = 1},
	[2195] = {value = 2}
}

function onEquip(cid, item, slot)
local soma = 0
	for slot = 1, 10 do
		checkItem = tabVal[getPlayerSlotItem(cid, slot).itemid]
		if checkItem then
			soma = soma + checkItem.value
		end
		if slot == slots then
			getColor = getCreatureOutfit(cid)
			result = {lookType = 128, lookHead = getColor.lookHead, lookBody = getColor.lookBody, lookLegs = getColor.lookLegs, lookFeet = getColor.lookFeet, lookAddons = soma}
			doSetCreatureOutfit(cid, result, -1)
		end
	end
return true
end

function onDeEquip(cid, item, slot)
local soma = 0
	for slot = 1, 10 do
		checkItem = tabVal[getPlayerSlotItem(cid, slot).itemid]
		if checkItem then
			soma = soma + checkItem.value
		end
		if slot == slots then
			getColor = getCreatureOutfit(cid)
			result = {lookType = 128, lookHead = getColor.lookHead, lookBody = getColor.lookBody, lookLegs = getColor.lookLegs, lookFeet = getColor.lookFeet, lookAddons = soma}
			doSetCreatureOutfit(cid, result, -1)
		end
	end
return true
end

 

Aconselho a fazer também um onLogin com a mesma base para que ao relogar já iniciar com os addons e outfits programados.

 

Boa sorte.

Editado por Adriano SwaTT (veja o histórico de edições)

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 96k
  • Posts 512.6k

Informação Importante

Confirmação de Termo