Ir para conteúdo
  • Cadastre-se

(Resolvido)[PEDIDO] Remover itens do tile através da alavanca


Ir para solução Resolvido por egyptPOWER,

Posts Recomendados

Base: tfs 1.2 

 

 

Preciso de um script que ao clicar na alavanca no tile x remova 6 itens do altar como fosse "sacrificio" e teleportasse para outro lugar e caso não tenha todos os itens informar que não tem todos os itens ou os itens estão em ordem errada, agradeço a ajuda desde já !

 

obrigado.

 

 

Link para o post
Compartilhar em outros sites

Testa ai bro.

 

Cria um arquivo com nome que desejar dentro da sua pasta data/actions/scripts/...

 

exemplo.lua

 -- Made by egyptPOWER - www.tibiaking.com --	
 
 function onUse(cid, item, frompos, item2, topos)
 
 -- POSIÇÃO DOS ALTARES --
 
 altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 --
 getaltar1 = getThingfromPos(altar1)
 altar2 = {x = 222, y = 222, z = 2, stackpos = 1} -- ALTAR 2 --
 getaltar2 = getThingfromPos(altar2)
 altar3 = {x = 333, y = 333, z = 3, stackpos = 1} -- ALTAR 3 --
 getaltar3 = getThingfromPos(altar2)
 altar4 = {x = 444, y = 444, z = 4, stackpos = 1} -- ALTAR 4 --
 getaltar4 = getThingfromPos(altar3)
 altar5 = {x = 555, y = 555, z = 5, stackpos = 1} -- ALTAR 5 --
 getaltar5 = getThingfromPos(altar4)
 altar6 = {x = 666, y = 666, z = 6, stackpos = 1} -- ALTAR 6 --
 getaltar6 = getThingfromPos(altar6)


 switchUID= 10102 -- UID da Alavanca
 switchID = 1945 -- ID da Alavanca
 switch2ID = 1946 -- ID da Alavanca após utilizada
 item1	= 1111 -- Item de sacrificio 1
 item2 = 1111 -- Item de sacrificio 2
 item3	= 1111 -- Item de sacrificio 3
 item4	= 1111 -- Item de sacrificio 4
 item5 = 1111 -- Item de sacrificio 5
 item6 = 1111 -- Item de sacrificio 6
 
 tpto = {x = 111, y = 111, z = 1, stackpos = 1} -- Aonde o player será teleportado --
 
 if item.uid == switchUID and item.itemid == switchID and getaltar1.itemid == item1 and getaltar2.itemid == item2 and getaltar3.itemid == item3 and getaltar4.itemid == item4 and getaltar5.itemid == item5 and getaltar6.itemid == item6 then
	doSendMagicEffect(cid, 2)
	doTeleportThing(cid, tpto)
	doSendMagicEffect(tpto, 10)
	doRemoveItem(getaltar1.uid, 1)
	doRemoveItem(getaltar2.uid, 1)
	doRemoveItem(getaltar3.uid, 1)
	doRemoveItem(getaltar4.uid, 1)
	doRemoveItem(getaltar5.uid, 1)
	doRemoveItem(getaltar6.uid, 1)
 elseif item.uid == switchUID and item.itemid == switch2ID then
	doTransformItem(item.uid, item.itemid-1)
 else
	doPlayerSendCancel(cid, "Desculpe, você precisa colocar os items corretos nos altares.")
 
 end
 return false

return true   
end

 

 

Em actions XML você vai adicionar

 

<action uniqueid="1111" script="exemplo.lua"/>

Aonde é "1111" é o uniqueID da alavanca.

 

 

 

 

Espero ter ajudado

No signature.

 

 

 

Link para o post
Compartilhar em outros sites
16 horas atrás, egyptPOWER disse:

Testa ai bro.

 

Cria um arquivo com nome que desejar dentro da sua pasta data/actions/scripts/...

 

exemplo.lua


 -- Made by egyptPOWER - www.tibiaking.com --	
 
 function onUse(cid, item, frompos, item2, topos)
 
 -- POSIÇÃO DOS ALTARES --
 
 altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 --
 getaltar1 = getThingfromPos(altar1)
 altar2 = {x = 222, y = 222, z = 2, stackpos = 1} -- ALTAR 2 --
 getaltar2 = getThingfromPos(altar2)
 altar3 = {x = 333, y = 333, z = 3, stackpos = 1} -- ALTAR 3 --
 getaltar3 = getThingfromPos(altar2)
 altar4 = {x = 444, y = 444, z = 4, stackpos = 1} -- ALTAR 4 --
 getaltar4 = getThingfromPos(altar3)
 altar5 = {x = 555, y = 555, z = 5, stackpos = 1} -- ALTAR 5 --
 getaltar5 = getThingfromPos(altar4)
 altar6 = {x = 666, y = 666, z = 6, stackpos = 1} -- ALTAR 6 --
 getaltar6 = getThingfromPos(altar6)


 switchUID= 10102 -- UID da Alavanca
 switchID = 1945 -- ID da Alavanca
 switch2ID = 1946 -- ID da Alavanca após utilizada
 item1	= 1111 -- Item de sacrificio 1
 item2 = 1111 -- Item de sacrificio 2
 item3	= 1111 -- Item de sacrificio 3
 item4	= 1111 -- Item de sacrificio 4
 item5 = 1111 -- Item de sacrificio 5
 item6 = 1111 -- Item de sacrificio 6
 
 tpto = {x = 111, y = 111, z = 1, stackpos = 1} -- Aonde o player será teleportado --
 
 if item.uid == switchUID and item.itemid == switchID and getaltar1.itemid == item1 and getaltar2.itemid == item2 and getaltar3.itemid == item3 and getaltar4.itemid == item4 and getaltar5.itemid == item5 and getaltar6.itemid == item6 then
	doSendMagicEffect(cid, 2)
	doTeleportThing(cid, tpto)
	doSendMagicEffect(tpto, 10)
	doRemoveItem(getaltar1.uid, 1)
	doRemoveItem(getaltar2.uid, 1)
	doRemoveItem(getaltar3.uid, 1)
	doRemoveItem(getaltar4.uid, 1)
	doRemoveItem(getaltar5.uid, 1)
	doRemoveItem(getaltar6.uid, 1)
 elseif item.uid == switchUID and item.itemid == switch2ID then
	doTransformItem(item.uid, item.itemid-1)
 else
	doPlayerSendCancel(cid, "Desculpe, você precisa colocar os items corretos nos altares.")
 
 end
 return false

return true   
end

 

 

Em actions XML você vai adicionar

 


<action uniqueid="1111" script="exemplo.lua"/>

Aonde é "1111" é o uniqueID da alavanca.

 

 

 

 

Espero ter ajudado

Está dando um erro de função.

C15827B3-ED2A-44B3-AC9F-88D2B75C2520.jpeg

Link para o post
Compartilhar em outros sites
  • Solução

Opa, testa agora meu bom

 

function onUse(cid, item, frompos, item2, topos)

 -- POSIÇÃO DOS ALTARES --
 
 altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 --
 getaltar1 = getThingfromPos(altar1)
 altar2 = {x = 222, y = 222, z = 2, stackpos = 1} -- ALTAR 2 --
 getaltar2 = getThingfromPos(altar2)
 altar3 = {x = 333, y = 333, z = 3, stackpos = 1} -- ALTAR 3 --
 getaltar3 = getThingfromPos(altar2)
 altar4 = {x = 444, y = 444, z = 4, stackpos = 1} -- ALTAR 4 --
 getaltar4 = getThingfromPos(altar3)
 altar5 = {x = 555, y = 555, z = 5, stackpos = 1} -- ALTAR 5 --
 getaltar5 = getThingfromPos(altar4)
 altar6 = {x = 666, y = 666, z = 6, stackpos = 1} -- ALTAR 6 --
 getaltar6 = getThingfromPos(altar6)


 switchUID= 10102 -- UID da Alavanca
 switchID = 1945 -- ID da Alavanca
 switch2ID = 1946 -- ID da Alavanca após utilizada
 item1	= 1111 -- Item de sacrificio 1
 item2 = 1111 -- Item de sacrificio 2
 item3	= 1111 -- Item de sacrificio 3
 item4	= 1111 -- Item de sacrificio 4
 item5 = 1111 -- Item de sacrificio 5
 item6 = 1111 -- Item de sacrificio 6
 
 tpto = {x = 111, y = 111, z = 1, stackpos = 1} -- Aonde o player será teleportado --
 
 if item.uid == switchUID and item.itemid == switchID and getaltar1.itemid == item1 and getaltar2.itemid == item2 and getaltar3.itemid == item3 and getaltar4.itemid == item4 and getaltar5.itemid == item5 and getaltar6.itemid == item6 then
	doSendMagicEffect(cid, 2)
	doTeleportThing(cid, tpto)
	doSendMagicEffect(tpto, 10)
	doRemoveItem(getaltar1.uid, 1)
	doRemoveItem(getaltar2.uid, 1)
	doRemoveItem(getaltar3.uid, 1)
	doRemoveItem(getaltar4.uid, 1)
	doRemoveItem(getaltar5.uid, 1)
	doRemoveItem(getaltar6.uid, 1)
 elseif item.uid == switchUID and item.itemid == switch2ID then
	doTransformItem(item.uid, item.itemid-1)
 else
	doPlayerSendCancel(cid, "Desculpe, você precisa colocar os items corretos nos altares.")
 end
 
	return true
end

!

No signature.

 

 

 

Link para o post
Compartilhar em outros sites
17 horas atrás, egyptPOWER disse:

Opa, testa agora meu bom

 


function onUse(cid, item, frompos, item2, topos)

 -- POSIÇÃO DOS ALTARES --
 
 altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 --
 getaltar1 = getThingfromPos(altar1)
 altar2 = {x = 222, y = 222, z = 2, stackpos = 1} -- ALTAR 2 --
 getaltar2 = getThingfromPos(altar2)
 altar3 = {x = 333, y = 333, z = 3, stackpos = 1} -- ALTAR 3 --
 getaltar3 = getThingfromPos(altar2)
 altar4 = {x = 444, y = 444, z = 4, stackpos = 1} -- ALTAR 4 --
 getaltar4 = getThingfromPos(altar3)
 altar5 = {x = 555, y = 555, z = 5, stackpos = 1} -- ALTAR 5 --
 getaltar5 = getThingfromPos(altar4)
 altar6 = {x = 666, y = 666, z = 6, stackpos = 1} -- ALTAR 6 --
 getaltar6 = getThingfromPos(altar6)


 switchUID= 10102 -- UID da Alavanca
 switchID = 1945 -- ID da Alavanca
 switch2ID = 1946 -- ID da Alavanca após utilizada
 item1	= 1111 -- Item de sacrificio 1
 item2 = 1111 -- Item de sacrificio 2
 item3	= 1111 -- Item de sacrificio 3
 item4	= 1111 -- Item de sacrificio 4
 item5 = 1111 -- Item de sacrificio 5
 item6 = 1111 -- Item de sacrificio 6
 
 tpto = {x = 111, y = 111, z = 1, stackpos = 1} -- Aonde o player será teleportado --
 
 if item.uid == switchUID and item.itemid == switchID and getaltar1.itemid == item1 and getaltar2.itemid == item2 and getaltar3.itemid == item3 and getaltar4.itemid == item4 and getaltar5.itemid == item5 and getaltar6.itemid == item6 then
	doSendMagicEffect(cid, 2)
	doTeleportThing(cid, tpto)
	doSendMagicEffect(tpto, 10)
	doRemoveItem(getaltar1.uid, 1)
	doRemoveItem(getaltar2.uid, 1)
	doRemoveItem(getaltar3.uid, 1)
	doRemoveItem(getaltar4.uid, 1)
	doRemoveItem(getaltar5.uid, 1)
	doRemoveItem(getaltar6.uid, 1)
 elseif item.uid == switchUID and item.itemid == switch2ID then
	doTransformItem(item.uid, item.itemid-1)
 else
	doPlayerSendCancel(cid, "Desculpe, você precisa colocar os items corretos nos altares.")
 end
 
	return true
end

!

Obrigado brother 100% rep

Link para o post
Compartilhar em outros sites
  • 1 year later...
Em 28/01/2018 em 16:19, egyptPOWER disse:

Opa, testa agora meu bom

 


function onUse(cid, item, frompos, item2, topos)

 -- POSIÇÃO DOS ALTARES --
 
 altar1 = {x = 111, y = 111, z = 1, stackpos = 1} -- ALTAR 1 --
 getaltar1 = getThingfromPos(altar1)
 altar2 = {x = 222, y = 222, z = 2, stackpos = 1} -- ALTAR 2 --
 getaltar2 = getThingfromPos(altar2)
 altar3 = {x = 333, y = 333, z = 3, stackpos = 1} -- ALTAR 3 --
 getaltar3 = getThingfromPos(altar2)
 altar4 = {x = 444, y = 444, z = 4, stackpos = 1} -- ALTAR 4 --
 getaltar4 = getThingfromPos(altar3)
 altar5 = {x = 555, y = 555, z = 5, stackpos = 1} -- ALTAR 5 --
 getaltar5 = getThingfromPos(altar4)
 altar6 = {x = 666, y = 666, z = 6, stackpos = 1} -- ALTAR 6 --
 getaltar6 = getThingfromPos(altar6)


 switchUID= 10102 -- UID da Alavanca
 switchID = 1945 -- ID da Alavanca
 switch2ID = 1946 -- ID da Alavanca após utilizada
 item1	= 1111 -- Item de sacrificio 1
 item2 = 1111 -- Item de sacrificio 2
 item3	= 1111 -- Item de sacrificio 3
 item4	= 1111 -- Item de sacrificio 4
 item5 = 1111 -- Item de sacrificio 5
 item6 = 1111 -- Item de sacrificio 6
 
 tpto = {x = 111, y = 111, z = 1, stackpos = 1} -- Aonde o player será teleportado --
 
 if item.uid == switchUID and item.itemid == switchID and getaltar1.itemid == item1 and getaltar2.itemid == item2 and getaltar3.itemid == item3 and getaltar4.itemid == item4 and getaltar5.itemid == item5 and getaltar6.itemid == item6 then
	doSendMagicEffect(cid, 2)
	doTeleportThing(cid, tpto)
	doSendMagicEffect(tpto, 10)
	doRemoveItem(getaltar1.uid, 1)
	doRemoveItem(getaltar2.uid, 1)
	doRemoveItem(getaltar3.uid, 1)
	doRemoveItem(getaltar4.uid, 1)
	doRemoveItem(getaltar5.uid, 1)
	doRemoveItem(getaltar6.uid, 1)
 elseif item.uid == switchUID and item.itemid == switch2ID then
	doTransformItem(item.uid, item.itemid-1)
 else
	doPlayerSendCancel(cid, "Desculpe, você precisa colocar os items corretos nos altares.")
 end
 
	return true
end

!

 

Boa noite meu consagrado, poderia adcionar checagem de players também? por exemplo eu queria que teleportassem 4 players que estivessem em x posição.

por exemplo, estaria os items nos altares e se os players estivessem no local certo, eles iriam teleportar, Obrigado!

Link para o post
Compartilhar em outros sites
local ALTARES = {
	{POSITION = Position(106, 984, 6), ITEM_ID = }, -- posicao altar e item 1
	{POSITION = Position(106, 985, 6), ITEM_ID = }, -- posicao altar e item 2
	{POSITION = Position(106, 986, 6), ITEM_ID = }, -- posicao altar e item 3
	{POSITION = Position(106, 987, 6), ITEM_ID = }, -- posicao altar e item 4
	{POSITION = Position(106, 987, 6), ITEM_ID = }, -- posicao altar e item 5
	{POSITION = Position(106, 987, 6), ITEM_ID = }, -- posicao altar e item 6
}

local playerPosition = {
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6)
}
local newPosition = {
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6),
	Position(106, 987, 6)
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
	local ok = true
	for i = 1, #ALTARES do
		local tile = Tile(ALTARES[i].POSITION)
		if tile then
			local item = tile:getItemById(ALTARES[i].ITEM_ID)
			if not item then
				ok = false
			end
		end
	end
	
	if ok then
		local players = {}
		for _, position in ipairs(playerPosition) do
			local topPlayer = Tile(position):getTopCreature()
			if not topPlayer or not topPlayer:isPlayer() then
				player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
				return false
			end
			players[#players + 1] = topPlayer
		end
		
		for i, targetPlayer in ipairs(players) do
			playerPosition[i]:sendMagicEffect(CONST_ME_POFF)
			targetPlayer:teleportTo(newPosition[i], false)
			targetPlayer:getPosition():sendMagicEffect(CONST_ME_ENERGYAREA)
		end

		for i = 1, #ALTARES do
			local tile = Tile(ALTARES[i].POSITION)
			if tile then
				local item = tile:getItemById(ALTARES[i].ITEM_ID)
				if item then
					item:remove()
				end
			end
		end
	else
		player:sendTextMessage(MESSAGE_INFO_DESCR, "Desculpe, você precisa colocar os items corretos nos altares.")
		player:getPosition():sendMagicEffect(CONST_ME_POFF)
	end
	
	item:transform(item.itemid == 1945 and 1946 or 1945)
	return true
end

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo