antiblock
Elveron
  • Chatbox

    You don't have permission to chat.
    Load More
  • 0
Renanhideki

Duvida Evocar Jazidas

Question

      Está quest está funcionando normalmente , porém, gostaria de saber se tem como elas nascerem separadas? 

 as Jazidas nascem tudo em cima da outra no mesmo local, queria saber se há possibilidade de separa -las .?

 

 

 

  when 20087.chat."Evocar Jazidas" with pc.is_gm() begin
        say("Evocar")
            local s=select( "sim", "não" )
        local coor_x = pc.get_local_x()
        local coor_y = pc.get_local_y()
        local cor_x = math.random(0,10)
        local cor_y = math.random(0,10)
            if s == 1 then
                syschat("você evocou as jazidas")
                mob.spawn(20047, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20048, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20049, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20050, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20051, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20052, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20053, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20054, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20055, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20056, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20057, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20058, coor_x + cor_x , coor_y + cor_y, 1)
                mob.spawn(20059, coor_x + cor_x , coor_y + cor_y, 1)
        pc.setqf("jefesdem", 2)
        elseif s == 2 then
            return
            end
        end

     end

end

Share this post


Link to post
Share on other sites

2 answers to this question

  • 1

As variáveis são inicializadas antes de serem usadas, não vão ser inicializadas ao serem chamadas, tu nesse caso estás a declarar e a inicializar as variáveis, vai ser com esses dados que vão ficar e devolver cada vez que forem invocadas.

 

quest jazidas start
	state start begin
		when 20087.chat."Evocar Jazidas" with pc.is_gm() begin
			say("Evocar")
			local s=select( "sim", "não" )
			local coor_x = pc.get_local_x()
			local coor_y = pc.get_local_y()
			if s == 1 then
				syschat("você evocou as jazidas")
				mob.spawn(20047, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20048, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20049, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20050, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20051, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20052, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20053, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20054, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20055, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20056, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20057, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20058, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20059, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				pc.setqf("jefesdem", 2)
			elseif s == 2 then
				return
			end
		end
     end
end

Ao chamar o math.random cada vez que fores dar spawn a uma jazida esse valor vai ser gerado no momento. No caso que tinhas iam ser sempre os mesmos valores.

Share this post


Link to post
Share on other sites
antiblock
Elveron
  • 0
3 minutos atrás, Karbust disse:

As variáveis são inicializadas antes de serem usadas, não vão ser inicializadas ao serem chamadas, tu nesse caso estás a declarar e a inicializar as variáveis, vai ser com esses dados que vão ficar e devolver cada vez que forem invocadas.

 


quest jazidas start
	state start begin
		when 20087.chat."Evocar Jazidas" with pc.is_gm() begin
			say("Evocar")
			local s=select( "sim", "não" )
			local coor_x = pc.get_local_x()
			local coor_y = pc.get_local_y()
			if s == 1 then
				syschat("você evocou as jazidas")
				mob.spawn(20047, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20048, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20049, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20050, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20051, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20052, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20053, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20054, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20055, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20056, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20057, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20058, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				mob.spawn(20059, coor_x + math.random(0,10), coor_y + math.random(0,10), 1)
				pc.setqf("jefesdem", 2)
			elseif s == 2 then
				return
			end
		end
     end
end

Ao chamar o math.random cada vez que fores dar spawn a uma jazida esse valor vai ser gerado no momento. No caso que tinhas iam ser sempre os mesmos valores.

Muito obrigado .

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