Jump to content

event_drop


Aeglon
 Share

Recommended Posts

quest drop_event begin
	state start begin
		--- desta forma é para todos os moobs, se quiseres moobs certos usa
		-- when kill with npc.get_race() == 101 begin	--- para cães selvagens
		-- when kill with npc.get_race() == 101 or npc.get_race() == 102 begin	--- para 2 moobs para mais, basta ires fazendo or  npc.get_race() == vnum do mob
		
		when kill with not npc.is_pc() begin  
			--- para activar o evento faz   	/e drop_event 1		(( Conta gm ))
			--- para deactivar o evento faz 	/e drop_event 0		(( Conta gm ))
			if game.get_event_flag("drop_event") != 1 then  ---- desta forma é para TODOS os mapas
			if game.get_event_flag("drop_event") != 1 and pc.get_map_index() == 41 then  ---- desta forma é apenas para o reino Jinno  index 41
				return
			elseif pc.get_level() < 50 then --- altera para o nivel minimo de drop
				return
			else
				pc.setqf("drop_event", pc.getqf("drop_event") + 1)
				if pc.getqf("drop_event") == 10 then		---	Altera para o numero de kills a fazer para o drop
					game.drop_item_with_ownership(189,1)	--- 189 = espada venenosa \\\ altera para o teu vnum
				end				
			end
		end
	end
end

 

Edited by Aeglon
  • Like 2
Link to comment
Share on other sites

quest drop_event begin
	state start begin
		--- desta forma é para todos os moobs, se quiseres moobs certos usa
		-- when kill with npc.get_race() == 101 begin	--- para cães selvagens
		-- when kill with npc.get_race() == 101 or npc.get_race() == 102 begin	--- para 2 moobs para mais, basta ires fazendo or  npc.get_race() == vnum do mob
		
		when kill with not npc.is_pc() begin  
			if pc.get_level() < 50 then --- altera para o nivel minimo de drop
				return
			else
				pc.setqf("drop_event", pc.getqf("drop_event") + 1)
				if pc.getqf("drop_event") == 10 then		---	Altera para o numero de kills a fazer para o drop
					game.drop_item_with_ownership(189,1)	--- 189 = espada venenosa \\\ altera para o teu vnum
				end				
			end
		end
	end
end

desta forma não é preciso o GM activar

Edited by Aeglon
Link to comment
Share on other sites

1 minuto atrás, Aeglon disse:

quest drop_event begin
	state start begin
		--- desta forma é para todos os moobs, se quiseres moobs certos usa
		-- when kill with npc.get_race() == 101 begin	--- para cães selvagens
		-- when kill with npc.get_race() == 101 or npc.get_race() == 102 begin	--- para 2 moobs para mais, basta ires fazendo or  npc.get_race() == vnum do mob
		
		when kill with not npc.is_pc() begin  
			if pc.get_level() < 50 then --- altera para o nivel minimo de drop
				return
			else
				pc.setqf("drop_event", drop_event + 1)
				if pc.getqf("drop_event") == 10 then		---	Altera para o numero de kills a fazer para o drop
					game.drop_item_with_ownership(189,1)	--- 189 = espada venenosa \\\ altera para o teu vnum
				end				
			end
		end
	end
end

desta forma não é preciso o GM activar

Não está funcionando, você tem discord ou skype para converamos melhor?

Link to comment
Share on other sites

quest drop_event begin
	state start begin
		--- desta forma é para todos os moobs, se quiseres moobs certos usa
		-- when kill with npc.get_race() == 101 begin	--- para cães selvagens
		-- when kill with npc.get_race() == 101 or npc.get_race() == 102 begin	--- para 2 moobs para mais, basta ires fazendo or  npc.get_race() == vnum do mob
		
		when kill with not npc.is_pc() begin  
			if pc.get_level() < 50 then --- altera para o nivel minimo de drop
				return
			else
				pc.setqf("drop_event", pc.getqf("drop_event") + 1)
				if pc.getqf("drop_event") == 10 then		---	Altera para o numero de kills a fazer para o drop
					game.drop_item_with_ownership(189,1)	--- 189 = espada venenosa \\\ altera para o teu vnum
					pc.setqf("drop_event",0)				--- remove esta linha se não queres que eles dropem sempre de x em x moobs
				end				
			end
		end
	end
end

agora testei e funciona

 

e corrigi as anteriores

Edited by Aeglon
Link to comment
Share on other sites

Fiz dessa maneira, porém não funcionou.

quest drop_especial begin
    state start begin
        --- desta forma é para todos os moobs, se quiseres moobs certos usa
        -- when kill with npc.get_race() == 101 begin    --- para cães selvagens
        -- when kill with npc.get_race() == 101 or npc.get_race() == 102 begin    --- para 2 moobs para mais, basta ires fazendo or  npc.get_race() == vnum do mob
        
        when kill with not npc.is_pc() begin  
                -- Diferença maior que 10 niveis
                if math.abs(pc.get_level() - npc.get_level()) > 10 then
                return
                else
                pc.setqf("drop_especial", pc.getqf("drop_especial") + 1)
                if pc.getqf("drop_especial") == 10 then        ---    Altera para o numero de kills a fazer para o drop
                -- Drop aleatório
                local drop = {50135, 50136, 50137}
                game.drop_item_with_ownership(drop[number(1, table.getn(drop))])
                pc.setqf("drop_especial",0)                --- remove esta linha se não queres que eles dropem sempre de x em x moobs
                end                
            end
        end
    end
end

Link to comment
Share on other sites

1 hora atrás, PACI disse:

	-- Diferença maior que 10 niveis
	if math.abs(pc.get_level() - npc.get_level()) > 10 then
		return
	end

	-- Drop aleatório
	local drop = {itemVnum1, itemVnum2, itemVnum3}
	game.drop_item_with_ownership(drop[number(1, table.getn(drop))])

 

@PACI tu não imaginas, mas eu aprendi bastante a nível de quests contigo. E uma vez mais, acabei de aprender uma nova forma para o drop aleatório. Eu usava outra forma, mas com mais uma linha.... é sempre bom, e tenho imenso orgulho\prazer  nisto que te digo: "é delirante ver a "delicadeza" das tuas quests ;)

Obrigado por tudo.

Edited by Aeglon
Link to comment
Share on other sites

 

quest drop_event begin
	state start begin
		when kill with not npc.is_pc() begin 
			if math.abs(pc.get_level() - npc.get_level()) > 10 then return end	-- Limite de 10 níveis de diferença
			if pc.get_level() < 10 then return end	-- mível mínimo de drop
			pc.setqf("drop_event", pc.getqf("drop_event") + 1)
			if pc.getqf("drop_event") == 50 then	-- dropa um item a cada 50 monstros
				local list = { {number(10,19), 1},{number(180,189), 1},{27994, number(5,10)},{27995, number(5,10)} }	-- lista dos itens a dropar
				local give = math.random(1, table.getn(list))
				game.drop_item_with_ownership(list[give][1], list[give][2])
				pc.setqf("drop_event",0)	-- reinicia o loop
			end				
		end
	end
end

@LuizFernando  se voltares ao inicio do tópico e se prestares atenção a tudo. Irás perceber que tens muita coisa para meter os drops por quest da forma que quiseres ;)

Link to comment
Share on other sites

9 minutos atrás, PACI disse:

"..math.randomseed(os.time()).."

 

Desconhecia de todo essa função. 

Quando puderes e se puderes, explica (com exemplos) qual a diferença entre math.random() math.randomseed(os.time())

edit: no need! http://lua-users.org/wiki/MathLibraryTutorial

Edited by Aeglon
Link to comment
Share on other sites

Não possuis a função npc.get_level().
Coloca a seguinte no teu questlua_npc.cpp e adiciona-o ao array de funções.

int npc_get_level(lua_State* L){
	LPCHARACTER pNPC = CQuestManager::instance().GetCurrentNPCCharacterPtr();
	lua_pushnumber(L, pNPC ? pNPC->GetLevel() : 0);
	return 1;
}

 

Edited by PACI
Link to comment
Share on other sites

  • 3 years later...

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
 Share

×
×
  • Create New...