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

    You don't have permission to chat.
    Load More
  • 0
Sign in to follow this  
KB CRAZY CHANNEL

Quest de drops

Question

Boas!

 

Eu apanhei esta QUEST e meti a dropar 4 cofres de uma só vez!

Eu queria meter a sair 1 dos 4 e não os 4 de uma vez ou seja, ao matar um mob tanto pode sair por exemplo um cofre como uma arma desde que sai só 1 coisa de cada vez!

 

QUEST

quest drops_power begin
	state start begin		
	when kill with not npc.is_pc() and game.get_event_flag("eventoegg_drop") == 1 begin
	local r = math.random(1, 50)
	if r == 1 then
	pc.give_item2(50070, 1)
	pc.give_item2(50071, 1)
	pc.give_item2(50072, 1)
	pc.give_item2(50073, 1)
    pc.give_item2(50074, 1)
	chat("Ganhas-te 4 cofres Especiais!")
	end		end		
	when login with game.get_event_flag("eventoegg_drop") == 1 begin
	notice("Evento Cofres ON")
	end	end end

 

Share this post


Link to post
Share on other sites

4 answers to this question

  • 0

Acho que basta acrescentar um "or"

pc.give_item2() or pc.give_item2() or pc.give_item2() or pc.give_item2()

Share this post


Link to post
Share on other sites
antiblock
Rodnia | Alpha & Omega
  • 0
quest drops_power begin
	state start begin
		when kill with not npc.is_pc() and game.get_event_flag("eventoegg_drop") == 1 begin
			local r = math.random(1, 100)
			if (r <= 20) then
				pc.give_item2(50070, 1)
				chat("Ganhas-te o 1º cofre!")
			elseif (r <= 40) then
				pc.give_item2(50071, 1)
				chat("Ganhas-te o 2º cofre!")
			elseif (r <= 60) then
				pc.give_item2(50072, 1)
				chat("Ganhas-te o 3º cofre!")
			elseif (r <= 80) then
				pc.give_item2(50073, 1)
				chat("Ganhas-te o 4º cofre!")
			elseif (r <= 100) then
		    	pc.give_item2(50074, 1)
		    	chat("Ganhas-te o 5º cofre!")
		    end
		end
		when login with game.get_event_flag("eventoegg_drop") == 1 begin
			notice("Evento Cofres ON")
		end
	end
end

 

20% de probabilidade para cada cofre, sendo 5 cofres no total.

Share this post


Link to post
Share on other sites
  • 0
33 minutos atrás, KB CRAZY CHANNEL disse:

Boas!

 

Eu apanhei esta QUEST e meti a dropar 4 cofres de uma só vez!

Eu queria meter a sair 1 dos 4 e não os 4 de uma vez ou seja, ao matar um mob tanto pode sair por exemplo um cofre como uma arma desde que sai só 1 coisa de cada vez!

 

QUEST


quest drops_power begin
	state start begin		
	when kill with not npc.is_pc() and game.get_event_flag("eventoegg_drop") == 1 begin
	local r = math.random(1, 50)
	if r == 1 then
	pc.give_item2(50070, 1)
	pc.give_item2(50071, 1)
	pc.give_item2(50072, 1)
	pc.give_item2(50073, 1)
    pc.give_item2(50074, 1)
	chat("Ganhas-te 4 cofres Especiais!")
	end		end		
	when login with game.get_event_flag("eventoegg_drop") == 1 begin
	notice("Evento Cofres ON")
	end	end end

 

Supondo que esse código esteja certo, algo do género deve dar para o que queres...: 

quest drops_power begin
	state start begin		
	when kill with not npc.is_pc() and game.get_event_flag("eventoegg_drop") == 1 begin
	local r = math.random(1, 50)
	if r == 1 then
	pc.give_item2(50070, 1)
	elseif r == 2 then
	pc.give_item2(50071, 1)
	elseif r == 3 then
	pc.give_item2(50072, 1)
	elseif r == 4 then
	pc.give_item2(50073, 1)
	elseif r == 5 then
    pc.give_item2(50074, 1)
	chat("Ganhas-te 4 cofres Especiais!")
	end		end		
	when login with game.get_event_flag("eventoegg_drop") == 1 begin
	notice("Evento Cofres ON")
	end	end end

Nunca mais programei nada, por isso não sei bem os comandos já, mas suponho que esse "math.random" esteja a escolher um numero random entre 1 e 50. Se for isso, se quiseres que tenha mais probabilidade de sair um item que o outro, podes brincar com intervalos em vez de "==", por exemplo, "elseif 10 > r > 1" (não faço a minima se é assim que se faz, ou tem que se utilizar um "and" ou algo do genero nessa linguagem, mas o raciocineo é esse), quanto maior o range, maior a probabilidade de sair-te o item. 

Edited by Lσα∂ιηg (see edit history)

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