antiblock
Rodnia | Alpha & Omega
  • Chatbox

    You don't have permission to chat.
    Load More
  • 0
Sign in to follow this  
Lσяdρяiмє®

[Ajuda] Ajuda Na Quest

Question

Boas comunidade.

Criei uma quest para abrir uns cofres e escolher a raça que é e dar uns certos itens conforme o escolhido.

Mas infelizmente não está a funcionar. Alguém me consegue dizer o que está errado?

quest cofrenatal begin    state start begin        when 71167.use begin			say_title("Cofre de Natal")			say("")			say("Escolhe uma cor para o teu disfarce:")			say("")			local s = select("Vermelho", "Verde", "Preto")					if 1==s then						pc.give_item2(41137, 1)						pc.give_item2(45075, 1)                        pc.remove_item(71167, 1)					elseif 2==s then						pc.give_item2(41139, 1)						pc.give_item2(45076, 1)                        pc.remove_item(71167, 1)					elseif 3==s then						pc.give_item2(41141, 1)						pc.give_item2(45077, 1)                        pc.remove_item(71167, 1)		end	end        when 71168.use begin			say_title("Cofre de Natal")			say("")			say("Escolhe uma cor para o teu disfarce:")			say("")			local s = select("Vermelho", "Verde", "Preto")					if 1==s then						pc.give_item2(41138, 1)						pc.give_item2(45078, 1)                        pc.remove_item(71168, 1)					elseif 2==s then						pc.give_item2(41140, 1)						pc.give_item2(45078, 1)                        pc.remove_item(71168, 1)					elseif 3==s then						pc.give_item2(41142, 1)						pc.give_item2(45078, 1)                        pc.remove_item(71168, 1)		end	end	        when 71169.use begin			say_title("Cofre de Natal")			say("")			say("Escolhe uma cor para o teu disfarce:")			say("")			local s = select("Vermelho", "Verde", "Preto")					if 1==s then						pc.give_item2(41145, 1)						pc.give_item2(45081, 1)                        pc.remove_item(71169, 1)					elseif 2==s then						pc.give_item2(41147, 1)						pc.give_item2(45082, 1)                        pc.remove_item(71169, 1)					elseif 3==s then						pc.give_item2(41149, 1)						pc.give_item2(45083, 1)                        pc.remove_item(71169, 1)		end	end	        when 71170.use begin			say_title("Cofre de Natal")			say("")			say("Escolhe uma cor para o teu disfarce:")			say("")			local s = select("Vermelho", "Verde", "Preto")					if 1==s then						pc.give_item2(41146, 1)						pc.give_item2(45084, 1)                        pc.remove_item(71170, 1)					elseif 2==s then						pc.give_item2(41148, 1)						pc.give_item2(45084, 1)                        pc.remove_item(71170, 1)					elseif 3==s then						pc.give_item2(41150, 1)						pc.give_item2(45084, 1)                        pc.remove_item(71170, 1)			end		end		endend

Share this post


Link to post
Share on other sites

22 answers to this question

antiblock
https://i.imgur.com/aJ17bf7.gif
  • 0

Faz um array que contenha o vnum dos itens e dividindo cada um tens o id dos itens do give e do remove, assim fazes tudo num só when.

Ex:

local array = {				[iditem] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						},				[iditem2] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						},				[iditem3] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						},				[iditem4] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						}			}
pc.give_item2(array[item.vnum][1], 1)

pc.remove_item(array[item.vnum][2], 1)

Share this post


Link to post
Share on other sites
  • 0

Uma coisa Pacificador. Este método permite-me escolher entre vermelho, preto e verde?

 

 

 

Cumprimentos

Share this post


Link to post
Share on other sites
  • 0

Obviamente.

Repara:

pc.give_item2(array[item.vnum][1], 1)

pc.remove_item(array[item.vnum][2], 1)

s é a variável que corresponde ao select.

Se o s for 1, irá dar return ao vnum1 e vnum2 do item iditem.

PS: Não metas essas cores, dificulta a quem usa skin escura (como eu).

Share this post


Link to post
Share on other sites
  • 0

Desculpa Pacificador mas perdeste-me aí... Não sei mesmo como resolver a situação... não tens uma maneira mais fácil de me ajudar? Desculpa estar a dar-te tanto trabalho, sei que só estás a tentar ajudar...

Share this post


Link to post
Share on other sites
  • 0
quest cofrenatal begin	state start begin		when 71167.use or 71168.use or 71169.use or 71170.use begin			local item = {				[iditem] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						},				[iditem2] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						},				[iditem3] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						},				[iditem4] = {							{vnum1, vnum2},							{vnum3, vnum4},							{vnum5, vnum6}						}			}			say_title("Cofre de Natal")			say("")			say("Escolhe uma cor para o teu disfarce:")			say("")			local s = select("Vermelho", "Verde", "Preto")			if s ~= 4 then				pc.give_item2(item[item.get_vnum()][s][1], 1)				pc.give_item2(item[item.get_vnum()][s][2], 1)				pc.remove_item(item.get_vnum(), 1)			end		end	endend

Share this post


Link to post
Share on other sites
  • 0

ofc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this